From 027e9a8f1eb4a1064edc8462d03704cc56cc603b Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 23 Jul 2015 19:24:58 +0300 Subject: [mwm set] Avoid shared_ptr for MwmValue instances. --- indexer/mwm_set.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indexer/mwm_set.hpp') diff --git a/indexer/mwm_set.hpp b/indexer/mwm_set.hpp index a63a24905a..67e00fb6c5 100644 --- a/indexer/mwm_set.hpp +++ b/indexer/mwm_set.hpp @@ -112,7 +112,7 @@ public: virtual ~MwmValueBase() = default; }; - using TMwmValueBasePtr = shared_ptr; + using TMwmValuePtr = MwmValueBase *; // Mwm handle, which is used to refer to mwm and prevent it from // deletion when its FileContainer is used. @@ -128,10 +128,10 @@ public: template inline T * GetValue() const { - return static_cast(m_value.get()); + return static_cast(m_value); } - inline bool IsAlive() const { return m_value.get() != nullptr; } + inline bool IsAlive() const { return m_value; } inline MwmId const & GetId() const { return m_mwmId; } shared_ptr const & GetInfo() const; @@ -140,11 +140,11 @@ public: private: friend class MwmSet; - MwmHandle(MwmSet & mwmSet, MwmId const & mwmId, TMwmValueBasePtr value); + MwmHandle(MwmSet & mwmSet, MwmId const & mwmId, TMwmValuePtr value); MwmSet * m_mwmSet; MwmId m_mwmId; - TMwmValueBasePtr m_value; + TMwmValuePtr m_value; DISALLOW_COPY(MwmHandle); }; @@ -215,15 +215,15 @@ protected: virtual MwmValueBase * CreateValue(MwmInfo & info) const = 0; private: - typedef deque> CacheType; + typedef deque> CacheType; /// @precondition This function is always called under mutex m_lock. MwmHandle GetMwmHandleByIdImpl(MwmId const & id); - TMwmValueBasePtr LockValue(MwmId const & id); - TMwmValueBasePtr LockValueImpl(MwmId const & id); - void UnlockValue(MwmId const & id, TMwmValueBasePtr p); - void UnlockValueImpl(MwmId const & id, TMwmValueBasePtr p); + TMwmValuePtr LockValue(MwmId const & id); + TMwmValuePtr LockValueImpl(MwmId const & id); + void UnlockValue(MwmId const & id, TMwmValuePtr p); + void UnlockValueImpl(MwmId const & id, TMwmValuePtr p); /// Do the cleaning for [beg, end) without acquiring the mutex. /// @precondition This function is always called under mutex m_lock. -- cgit v1.2.3