X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FCommonsJavaScript%2FPrivateObject.h;h=8bd816a0982fb4ca46559797c754d08f8ba6b9b8;hb=41f29fee9907304eb6536147682ae2eaa5a2a3d5;hp=d303d7a3bd9a9b70f7d7d98db59ea28cb61bbfb2;hpb=9c61c076f198660f9d9683fc1f091cbc95b3286b;p=platform%2Fframework%2Fweb%2Fwrt-plugins-common.git diff --git a/src/CommonsJavaScript/PrivateObject.h b/src/CommonsJavaScript/PrivateObject.h index d303d7a..8bd816a 100644 --- a/src/CommonsJavaScript/PrivateObject.h +++ b/src/CommonsJavaScript/PrivateObject.h @@ -24,17 +24,15 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - template struct NoAcquire { void acquire(T*) - { - } + {} + protected: ~NoAcquire() - { - } + {} }; template @@ -45,10 +43,10 @@ struct AcquireByProtect Assert(object && "Object passed to protect can't be NULL."); JSValueProtect(object->getContext(), object->getObject()); } + protected: ~AcquireByProtect() - { - } + {} }; template @@ -58,10 +56,10 @@ struct NoRelease { (void)object; } + protected: ~NoRelease() - { - } + {} }; template @@ -71,10 +69,10 @@ struct ReleaseByDelete { delete object->getObject(); } + protected: ~ReleaseByDelete() - { - } + {} }; template @@ -85,10 +83,10 @@ struct ReleaseByUnprotect Assert(object && "Object passed to unprotect can't be NULL."); JSValueUnprotect(object->getContext(), object->getObject()); } + protected: ~ReleaseByUnprotect() - { - } + {} }; template @@ -97,8 +95,7 @@ struct NoOwnership : protected NoAcquire, { protected: ~NoOwnership() - { - } + {} }; template @@ -107,8 +104,7 @@ struct OwnershipByAcquisition : protected NoAcquire, { protected: ~OwnershipByAcquisition() - { - } + {} }; template @@ -117,8 +113,7 @@ struct OwnershipByProtection : protected AcquireByProtect, { protected: ~OwnershipByProtection() - { - } + {} }; template::value(object) && "Object is NULL."); - acquire(this); + Assert(!Commons::IsNull::value( + object) && "Object is NULL."); + this->acquire(this); } /** @@ -151,7 +147,7 @@ class PrivateObject : public DPL::Noncopyable, */ virtual ~PrivateObject() { - release(this); + this->release(this); } /** @@ -198,8 +194,7 @@ class PrivateObject : private DPL::Noncopyable * Destroys instance of the object. */ virtual ~PrivateObject() - { - } + {} /** * Gets stored JS context. @@ -237,7 +232,6 @@ struct PrivateObjectT { typedef PrivateObject Type; }; - } // CommonsJavaScript } // WrtDeviceApis