From: Jan Olszak Date: Tue, 27 Nov 2012 10:12:31 +0000 (+0100) Subject: Changed SharedPtr to std:shared_ptr. X-Git-Tag: 2.1b_release~6^2~127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee9996d0217252b55e86d602ff6c961332805c7f;p=framework%2Fweb%2Fwrt-commons.git Changed SharedPtr to std:shared_ptr. [Issue#] Code refactoring. [Bug] N/A [Cause] N/A [Solution] Used std::shared_ptr as SharedPtr [Verification] Build commons, plugins, installer. Change-Id: Icf661c0a638cfae0c53e249b6cb36e84ffdb8003 --- diff --git a/modules/db/include/dpl/db/orm.h b/modules/db/include/dpl/db/orm.h index 0d851a6..dcc67a5 100644 --- a/modules/db/include/dpl/db/orm.h +++ b/modules/db/include/dpl/db/orm.h @@ -26,12 +26,12 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -84,7 +84,7 @@ public: virtual ArgumentIndex BindTo(DataCommand *command, ArgumentIndex index) = 0; }; -typedef DPL::SharedPtr ExpressionPtr; +typedef std::shared_ptr ExpressionPtr; template class __attribute__ ((visibility("hidden"))) BinaryExpression : public Expression { @@ -586,7 +586,7 @@ public: str.str()); } //TODO maybe don't make a copy here but just generate the string part of the query. - m_whereExpression.Reset(new Expression(expression)); + m_whereExpression.reset(new Expression(expression)); } }; diff --git a/modules/event/include/dpl/event/inter_context_delegate.h b/modules/event/include/dpl/event/inter_context_delegate.h index 55af651..745e84a 100644 --- a/modules/event/include/dpl/event/inter_context_delegate.h +++ b/modules/event/include/dpl/event/inter_context_delegate.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -43,6 +42,7 @@ #include #include #include +#include /* * - Created ICDelegate can be passed freely to other threads. @@ -88,7 +88,7 @@ namespace ICDPrivate { class ICDSharedDataBase { public: - typedef DPL::SharedPtr ICDSharedDataBasePtr; + typedef std::shared_ptr ICDSharedDataBasePtr; typedef std::list ICDSharedDataBaseList; class ScopedLock : DPL::Noncopyable @@ -146,7 +146,7 @@ class DeleteICDSharedDataBaseEventCall : public DPL::Event::AbstractEventCall } virtual void Call() { - m_helperBase.Reset(); + m_helperBase.reset(); } private: @@ -227,7 +227,7 @@ class ICDelegate template friend class ICDelegateSupport; class ICDSharedData; - typedef DPL::SharedPtr ICDSharedDataPtr; + typedef std::shared_ptr ICDSharedDataPtr; struct PrivateEvent { @@ -245,7 +245,7 @@ class ICDelegate typedef DPL::FastDelegate ICDSharedDataDelegateType; class ICDSharedData : private DPL::Event::EventSupport, - private DPL::EnableSharedFromThis, + private std::enable_shared_from_this, public ICDPrivate::ICDSharedDataBase { public: @@ -290,7 +290,7 @@ class ICDelegate } private: - friend class DPL::SharedPtr; + friend class std::shared_ptr; ICDSharedDataDelegateType m_subDelegate; ICDPrivate::ICDelegateSupportInterface* m_base; DPL::FastDelegate m_outerDelegate; @@ -364,7 +364,7 @@ class ICDelegateSupport : public ICDPrivate::ICDelegateSupportInterface m_ICDSharedDatas; FOREACH(helper, list) { ICDPrivate::ICDSharedDataBase::ScopedLock lock( - DPL::StaticPointerCast(*helper)); + std::static_pointer_cast(*helper)); (*helper)->disable(); } m_ICDSharedDatas.clear(); diff --git a/modules/popup/include/dpl/popup/evas_object.h b/modules/popup/include/dpl/popup/evas_object.h index ba4ad9b..25d7a66 100644 --- a/modules/popup/include/dpl/popup/evas_object.h +++ b/modules/popup/include/dpl/popup/evas_object.h @@ -22,23 +22,23 @@ #ifndef WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H #define WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H +#include #include #include -#include #include #include #include #include #include #include - +#include namespace DPL { namespace Popup { class EvasObject { class EvasObjectShared; - typedef DPL::SharedPtr EvasObjectSharedPtr; + typedef std::shared_ptr EvasObjectSharedPtr; public: class IConnection diff --git a/modules/popup/include/dpl/popup/popup.h b/modules/popup/include/dpl/popup/popup.h index e5c926c..84c2c4e 100644 --- a/modules/popup/include/dpl/popup/popup.h +++ b/modules/popup/include/dpl/popup/popup.h @@ -23,8 +23,7 @@ #ifndef WRT_SRC_POPUP_POPUP_H_ #define WRT_SRC_POPUP_POPUP_H_ -#include -#include +#include #include #include #include @@ -43,9 +42,9 @@ struct AnswerCallbackData class PopupManager; class IPopup; -typedef DPL::SharedPtr IPopupPtr; +typedef std::shared_ptr IPopupPtr; -class IPopup : protected DPL::EnableSharedFromThis +class IPopup : public std::enable_shared_from_this { public: virtual void SetTitle(const std::string &title) = 0; @@ -63,7 +62,7 @@ class IPopup : protected DPL::EnableSharedFromThis private: friend class PopupManager; - friend class DPL::SharedPtr; + friend class std::shared_ptr; }; } // namespace Popup diff --git a/modules/popup/include/dpl/popup/popup_controller.h b/modules/popup/include/dpl/popup/popup_controller.h index 0b49201..5f2938a 100644 --- a/modules/popup/include/dpl/popup/popup_controller.h +++ b/modules/popup/include/dpl/popup/popup_controller.h @@ -65,14 +65,13 @@ #ifndef WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_ #define WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_ +#include #include #include #include #include #include #include -#include -#include #include #include #include @@ -99,7 +98,7 @@ struct PopupAnswerCallback class PopupController; class CtrlPopup; -typedef DPL::SharedPtr CtrlPopupPtr; +typedef std::shared_ptr CtrlPopupPtr; DECLARE_GENERIC_EVENT_3(PopupAnswerEvent, CtrlPopupPtr, @@ -111,18 +110,18 @@ DECLARE_GENERIC_EVENT_2(ShowPopupEventShort, PopupAnswerCallback) class CtrlPopup : public DPL::Event::EventSupport, - protected DPL::EnableSharedFromThis + public std::enable_shared_from_this { public: void SetTitle(const std::string &title); void Append(PopupObject::IPopupObject *object); + ~CtrlPopup(); private: friend class PopupController; - friend class DPL::SharedPtr; + friend class std::shared_ptr; explicit CtrlPopup(IPopupPtr popup); - ~CtrlPopup(); void EmitAnswer(const AnswerCallbackData& answer); IPopupPtr m_popup; diff --git a/modules/popup/include/dpl/popup/popup_manager.h b/modules/popup/include/dpl/popup/popup_manager.h index 267cd14..42a4de5 100644 --- a/modules/popup/include/dpl/popup/popup_manager.h +++ b/modules/popup/include/dpl/popup/popup_manager.h @@ -23,8 +23,8 @@ #ifndef WRT_SRC_POPUP_POPUP_MANAGER_H_ #define WRT_SRC_POPUP_POPUP_MANAGER_H_ +#include #include -#include #include #include #include diff --git a/modules/popup/include/dpl/popup/popup_renderer.h b/modules/popup/include/dpl/popup/popup_renderer.h index 593c231..18d2aab 100644 --- a/modules/popup/include/dpl/popup/popup_renderer.h +++ b/modules/popup/include/dpl/popup/popup_renderer.h @@ -25,20 +25,18 @@ #include #include +#include -#include #include #include #include -#include #include - #include namespace DPL { namespace Popup { -class PopupRenderer : public DPL::EnableSharedFromThis +class PopupRenderer : public std::enable_shared_from_this { public: PopupRenderer(); @@ -49,7 +47,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis virtual void setExternalCanvas(void* externalCanvas); protected: class Popup; - typedef DPL::SharedPtr PopupPtr; + typedef std::shared_ptr PopupPtr; class Popup : public IPopup { @@ -73,7 +71,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis Assert(callback); m_data = data; m_callback = callback; - m_renderer->Render(DPL::StaticPointerCast(SharedFromThis())); + m_renderer->Render(std::static_pointer_cast(shared_from_this())); } const std::string& GetTitle() const @@ -95,10 +93,10 @@ class PopupRenderer : public DPL::EnableSharedFromThis private: friend class PopupRenderer; - friend class DPL::SharedPtr; + friend class std::shared_ptr; friend class PopupObjectTheme; - Popup(DPL::SharedPtr renderer) : m_renderer(renderer) + Popup(std::shared_ptr renderer) : m_renderer(renderer) { } @@ -111,7 +109,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis void* m_data; IPopup::PopupCallbackType m_callback; PopupObject::PopupObjects m_popupObjectList; - DPL::SharedPtr m_renderer; + std::shared_ptr m_renderer; }; private: @@ -121,7 +119,7 @@ class PopupRenderer : public DPL::EnableSharedFromThis Impl* m_impl; }; -typedef DPL::SharedPtr PopupRendererPtr; +typedef std::shared_ptr PopupRendererPtr; } // namespace Popup } // namespace DPL diff --git a/modules/popup/src/popup_controller.cpp b/modules/popup/src/popup_controller.cpp index f67dc16..5bd1cf1 100644 --- a/modules/popup/src/popup_controller.cpp +++ b/modules/popup/src/popup_controller.cpp @@ -56,7 +56,7 @@ CtrlPopup::~CtrlPopup() void CtrlPopup::EmitAnswer(const AnswerCallbackData & answer) { AnswerCallbackData l_answer = answer; - PopupAnswerEvent event(SharedFromThis(), m_callback, l_answer); + PopupAnswerEvent event(shared_from_this(), m_callback, l_answer); DPL::Event::EventSupport::EmitEvent(event); } diff --git a/modules/popup/src/popup_manager.cpp b/modules/popup/src/popup_manager.cpp index be1b680..a6fa465 100644 --- a/modules/popup/src/popup_manager.cpp +++ b/modules/popup/src/popup_manager.cpp @@ -22,9 +22,7 @@ #include #include #include - #include -#include #include #include @@ -45,7 +43,7 @@ void PopupManager::Deinitialize() { m_popupRenderer->Deinitialize(); Assert(m_initialized); - m_popupRenderer.Reset(); + m_popupRenderer.reset(); m_initialized = false; } diff --git a/modules/popup/src/popup_renderer.cpp b/modules/popup/src/popup_renderer.cpp index aa5b214..411c709 100644 --- a/modules/popup/src/popup_renderer.cpp +++ b/modules/popup/src/popup_renderer.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -93,7 +92,7 @@ class PopupRenderer::Impl void Deinitialize() { Assert(m_initialized); - m_current.Reset(NULL); + m_current.reset(); while (!m_popupsToRender.empty()) { m_popupsToRender.pop(); } @@ -112,7 +111,7 @@ class PopupRenderer::Impl answerData.chackState = m_checkState; answerData.password = m_password; m_current->ForwardAnswer(answerData); - m_current.Reset(); + m_current.reset(); FOREACH(it, m_createdObjects) { @@ -398,8 +397,8 @@ void PopupRenderer::Deinitialize() IPopupPtr PopupRenderer::CreatePopup() { - return DPL::StaticPointerCast(IPopupPtr - (new Popup(SharedFromThis()))); + return std::static_pointer_cast(IPopupPtr + (new Popup(shared_from_this()))); } void PopupRenderer::Render(PopupPtr popup) diff --git a/modules/test/include/dpl/test/test_results_collector.h b/modules/test/include/dpl/test/test_results_collector.h index cf8fa4e..d3f44bb 100644 --- a/modules/test/include/dpl/test/test_results_collector.h +++ b/modules/test/include/dpl/test/test_results_collector.h @@ -23,12 +23,12 @@ #ifndef DPL_TEST_RESULTS_COLLECTOR_H #define DPL_TEST_RESULTS_COLLECTOR_H -#include #include #include #include #include #include +#include namespace DPL { @@ -36,7 +36,7 @@ namespace Test { class TestResultsCollectorBase; -typedef DPL::SharedPtr +typedef std::shared_ptr TestResultsCollectorBasePtr; class TestResultsCollectorBase diff --git a/modules/test/src/test_runner.cpp b/modules/test/src/test_runner.cpp index 8ad093a..506dd10 100644 --- a/modules/test/src/test_runner.cpp +++ b/modules/test/src/test_runner.cpp @@ -417,7 +417,7 @@ int TestRunner::ExecTestRunner(const ArgsList& value) Usage(); return -1; } - currentCollector.Reset(TestResultsCollectorBase::Create(arg)); + currentCollector.reset(TestResultsCollectorBase::Create(arg)); if (!currentCollector) { InvalidArgs("Unsupported output type!"); Usage(); @@ -469,7 +469,7 @@ int TestRunner::ExecTestRunner(const ArgsList& value) } } - currentCollector.Reset(); + currentCollector.reset(); // Show help if (showHelp) diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h index c40e396..57659ad 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h @@ -29,9 +29,9 @@ #include #include #include -#include -#include #include +#include + namespace WrtDB { class PluginMetafileData @@ -63,7 +63,7 @@ class PluginObjectsDAO { public: typedef std::set Objects; - typedef DPL::SharedPtr ObjectsPtr; + typedef std::shared_ptr ObjectsPtr; public: explicit PluginObjectsDAO() {} diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/feature_model.h b/modules/widget_dao/include/dpl/wrt-dao-ro/feature_model.h index d9440da..fc9754d 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/feature_model.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/feature_model.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ namespace WrtDB { typedef int FeatureHandle; typedef std::list FeatureHandleList; -typedef DPL::SharedPtr FeatureHandleListPtr; +typedef std::shared_ptr FeatureHandleListPtr; typedef int FeatureSetHandle; typedef std::list FeatureSetHandleList; @@ -69,7 +69,7 @@ class FeatureModel : public DPL::Event::Model } }; -typedef DPL::SharedPtr FeatureModelPtr; +typedef std::shared_ptr FeatureModelPtr; } // namespace WrtDB diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h index 33c83b1..044d3d0 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h @@ -26,8 +26,8 @@ #include #include +#include #include -#include #include namespace WrtDB { @@ -35,7 +35,7 @@ namespace WrtDB { typedef std::list PluginHandleList; typedef std::set PluginHandleSet; typedef std::list ImplementedObjectsList; -typedef DPL::SharedPtr PluginHandleSetPtr; +typedef std::shared_ptr PluginHandleSetPtr; //TODO make it friend to FeatureDAO or inherit class PluginDAOReadOnly