Kaydet (Commit) b51c6613 authored tarafından Ivo Hinkelmann's avatar Ivo Hinkelmann

INTEGRATION: CWS configrefactor01 (1.6.84); FILE MERGED

2007/01/16 12:18:23 mmeeks 1.6.84.5: Submitted by: mmeeks
Kill 'memory::Segment' - no longer needed.
Bin some other (empty / redundant) headers.
2007/01/12 11:48:32 mmeeks 1.6.84.4: Remove a load of unneeded Accessor fluff
Fix SimpleReferenceObject - it has to have 1 virtual method.
2007/01/11 20:16:03 mmeeks 1.6.84.3: Submitted by: mmeeks
More re-factoring, lots of locking rationalized, drastically reduced
the mutex count, also removed ~300k interlocked increments with a non-interlocking
SimpleReferencedObject base
2007/01/11 10:35:35 mmeeks 1.6.84.2: Submitted by: mmeeks

Large scale re-factoring, remove fine-grained locking in favor of a simple,
single global lock (still in progress).
Identify and fix various hot-spots.
Remove otherwise empty / non-compiled files.
Kill UpdateAccessor
2007/01/08 20:49:01 mmeeks 1.6.84.1: Issue number:
Submitted by: mmeeks
Substantial configmgr re-factoring #1 ...
	+ remove endless typedef chains
	+ remove custom allocator & associated complexity
	+ remove Pointer, and 'Address' classes
üst 338bcd20
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: cacheaccess.hxx,v $ * $RCSfile: cacheaccess.hxx,v $
* *
* $Revision: 1.6 $ * $Revision: 1.7 $
* *
* last change: $Author: rt $ $Date: 2005-09-08 04:21:46 $ * last change: $Author: ihi $ $Date: 2007-11-23 14:34:50 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
#ifndef _OSL_MUTEX_HXX_ #ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#endif #endif
#ifndef _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_ #ifndef _CONFIGMGR_UTILITY_HXX_
#include <salhelper/simplereferenceobject.hxx> #include <utility.hxx>
#endif #endif
#ifndef _RTL_REF_HXX_ #ifndef _RTL_REF_HXX_
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
...@@ -67,23 +67,15 @@ namespace configmgr ...@@ -67,23 +67,15 @@ namespace configmgr
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class CacheClientAccess : public salhelper::SimpleReferenceObject, Noncopyable class CacheClientAccess : public configmgr::SimpleReferenceObject, Noncopyable
{ {
public:
typedef CacheData Data;
typedef Data::Module Module;
typedef Data::ModuleRef ModuleRef;
typedef Data::ModuleName ModuleName;
typedef Data::Path Path;
private: private:
osl::Mutex m_aMutex; CacheData m_aData;
Data m_aData;
ConfigChangeBroadcastHelper* m_pBroadcastHelper; ConfigChangeBroadcastHelper* m_pBroadcastHelper;
public: public:
explicit explicit
CacheClientAccess(memory::HeapManager & _rHeapManager, CacheClientAccess(ConfigChangeBroadcastHelper* _pBroadcastHelper);
ConfigChangeBroadcastHelper* _pBroadcastHelper);
~CacheClientAccess(); ~CacheClientAccess();
...@@ -94,89 +86,74 @@ namespace configmgr ...@@ -94,89 +86,74 @@ namespace configmgr
/// removes an existing broadcast helper /// removes an existing broadcast helper
ConfigChangeBroadcastHelper * releaseBroadcaster(); ConfigChangeBroadcastHelper * releaseBroadcaster();
/// gets a data segment reference for the given path - creates if necessary
memory::Segment * attachDataSegment(const memory::SegmentAddress & _aSegment, const Path& _aLocation);
/// gets a data segment reference for the given path if exists
memory::Segment * getDataSegment(const Path& _aLocation);
/// return TRUE if there is no data (left) in this object's cache data /// return TRUE if there is no data (left) in this object's cache data
bool isEmpty(); bool isEmpty();
// attach a module with a given name
void attachModule(data::TreeAddress _aLocation, CacheLine::Name const & _aModule);
/// check if the given module exists already (and is not empty) /// check if the given module exists already (and is not empty)
bool hasModule(const Path& _aLocation); bool hasModule(const CacheLine::Path& _aLocation);
/// checks if the given module exists and has defaults available /// checks if the given module exists and has defaults available
bool hasModuleDefaults(memory::Accessor const & _aAccessor, Path const & _aLocation); bool hasModuleDefaults(CacheLine::Path const & _aLocation);
/// retrieve the subtree at _aPath (maybe if it has the requested defaults) and clientAcquire() it /// retrieve the subtree at _aPath (maybe if it has the requested defaults) and clientAcquire() it
data::NodeAddress acquireNode(memory::Accessor const& _aAccessToken, Path const& _aPath); data::NodeAddress acquireNode(CacheLine::Path const& _aPath);
/** add or merge the given subtree at the given location, /** add or merge the given subtree at the given location,
return <TRUE/> if the tree has defaults then return <TRUE/> if the tree has defaults then
*/ */
bool insertDefaults(memory::UpdateAccessor& _aUpdateToken, backend::NodeInstance const & _aDefaultData ) CFG_UNO_THROW_RTE( ); bool insertDefaults( backend::NodeInstance const & _aDefaultData ) CFG_UNO_THROW_RTE( );
/// clientRelease() the tree at aComponentName, and return the resulting reference count /// clientRelease() the tree at aComponentName, and return the resulting reference count
CacheLine::RefCount releaseNode( Path const& _aPath ); oslInterlockedCount releaseNode( CacheLine::Path const& _aPath );
/// retrieve the given subtree without changing its ref count /// retrieve the given subtree without changing its ref count
data::NodeAddress findInnerNode(memory::Accessor const& _aAccessToken, Path const& _aPath ); data::NodeAddress findInnerNode(CacheLine::Path const& _aPath );
/// merge the given change list into this tree - reflects old data to _aUpdate /// merge the given change list into this tree - reflects old data to _aUpdate
void applyUpdate(memory::UpdateAccessor& _aUpdateToken, backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( ); void applyUpdate(backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( );
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class CacheLoadingAccess : public salhelper::SimpleReferenceObject, Noncopyable class CacheLoadingAccess : public configmgr::SimpleReferenceObject, Noncopyable
{ {
public: public:
typedef ExtendedCacheData Data; typedef std::vector< CacheLineRef > DisposeList;
typedef Data::Module Module;
typedef Data::ModuleRef ModuleRef;
typedef Data::ModuleName ModuleName;
typedef Data::Path Path;
typedef std::vector< ModuleRef > DisposeList;
friend class backend::CacheController; friend class backend::CacheController;
private: private:
friend class CacheDisposeScheduler; friend class CacheDisposeScheduler;
typedef std::map< ModuleName, TimeStamp > DeadModuleList; typedef std::map< CacheLine::Name, TimeStamp > DeadModuleList;
osl::Mutex m_aMutex; ExtendedCacheData m_aData;
Data m_aData;
DeadModuleList m_aDeadModules; /// list of nodes which are registered for throwing away DeadModuleList m_aDeadModules; /// list of nodes which are registered for throwing away
public: public:
explicit explicit
CacheLoadingAccess(memory::HeapManager & _rHeapManager); CacheLoadingAccess();
~CacheLoadingAccess(); ~CacheLoadingAccess();
/// gets a data segment reference for the given path if exists /// gets a tree address for the given module if it exists
memory::Segment * createNewDataSegment(ModuleName const & _aModule); data::TreeAddress getTreeAddress(CacheLine::Name const & _aModule);
/// gets a data segment reference for the given path - creates if necessary
memory::Segment * attachDataSegment(const memory::SegmentAddress & _aSegment, ModuleName const & _aModule);
/// gets a data segment reference for the given path if exists
memory::Segment * getDataSegment(ModuleName const & _aModule);
/// gets a data segment address for the given module if it exists
memory::SegmentAddress getDataSegmentAddress(ModuleName const & _aModule);
/// return TRUE if there is no data (left) in this object's cache data /// return TRUE if there is no data (left) in this object's cache data
bool isEmpty(); bool isEmpty();
// create a module with a given name
void createModule(CacheLine::Name const & _aModule);
/// check if the given module exists already (and is not empty) /// check if the given module exists already (and is not empty)
bool hasModule(ModuleName const & _aLocation); bool hasModule(CacheLine::Name const & _aLocation);
/// retrieve the subtree at aComponentName and clientAcquire() it, true if succeeded
/// retrieve the subtree at aComponentName and clientAcquire() it bool acquireModule(CacheLine::Name const & _aModule);
data::TreeAddress acquireModule(ModuleName const & _aModule);
/// clientRelease() the tree at aComponentName, and return the resulting reference count /// clientRelease() the tree at aComponentName, and return the resulting reference count
CacheLine::RefCount releaseModule( ModuleName const & _aModule ); oslInterlockedCount releaseModule( CacheLine::Name const & _aModule );
/// retrieve the given subtree without changing its ref count /// retrieve the given subtree without changing its ref count
data::NodeAddress findNode(memory::Accessor const& _aAccessToken, Path const& _aPath ); data::NodeAddress findNode(CacheLine::Path const& _aPath );
/// merge the given change list into this tree - reflects old data to _aUpdate /// merge the given change list into this tree - reflects old data to _aUpdate
void applyUpdate(memory::UpdateAccessor& _aUpdateToken, backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( ); void applyUpdate(backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( );
/// collect the modules that can be disposed now (i.e. released after _rLimitReleaseTime) /// collect the modules that can be disposed now (i.e. released after _rLimitReleaseTime)
TimeStamp collectDisposeList(CacheLoadingAccess::DisposeList & _rList, TimeStamp collectDisposeList(CacheLoadingAccess::DisposeList & _rList,
...@@ -190,21 +167,17 @@ namespace configmgr ...@@ -190,21 +167,17 @@ namespace configmgr
/** add the given subtree at the given location, /** add the given subtree at the given location,
return the tree that is then pertinent and clientAcquire() it once return the tree that is then pertinent and clientAcquire() it once
*/ */
data::TreeAddress addComponentData( memory::UpdateAccessor& _aAccessToken, data::TreeAddress addComponentData( backend::ComponentInstance const & _aComponentInstance,
backend::ComponentInstance const & _aComponentInstance,
bool _bIncludesDefaults bool _bIncludesDefaults
) CFG_UNO_THROW_RTE(); ) CFG_UNO_THROW_RTE();
/// merge the given change list into the pending change list of this tree /// merge the given change list into the pending change list of this tree
void addChangesToPending( backend::ConstUpdateInstance const& _anUpdate ) CFG_UNO_THROW_RTE( ); void addChangesToPending( backend::ConstUpdateInstance const& _anUpdate ) CFG_UNO_THROW_RTE( );
/// retrieve accumulated pending changes /// retrieve accumulated pending changes
std::auto_ptr<SubtreeChange> releasePendingChanges(ModuleName const& _aModule); std::auto_ptr<SubtreeChange> releasePendingChanges(CacheLine::Name const& _aModule);
/// find the modules having pending changes /// find the modules having pending changes
bool findPendingChangedModules( Data::PendingModuleList & _rPendingList ); bool findPendingChangedModules( ExtendedCacheData::PendingModuleList & _rPendingList );
/// get a local lock for this cache line
osl::Mutex & mutex() { return m_aMutex; }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment