summaryrefslogtreecommitdiffstats
path: root/gin/wrappable.h
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 09:40:50 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-12 09:40:50 +0000
commitb4acaf8b4e3092096deebc23f1b60bea0773379a (patch)
tree91fb0223e6c27e1c4675720d78e80b5c3b133812 /gin/wrappable.h
parentab3ed7e4ac3fbe6666f2c0009642b30563fc20d6 (diff)
downloadchromium_src-b4acaf8b4e3092096deebc23f1b60bea0773379a.zip
chromium_src-b4acaf8b4e3092096deebc23f1b60bea0773379a.tar.gz
chromium_src-b4acaf8b4e3092096deebc23f1b60bea0773379a.tar.bz2
[gin] Declare a wrappable's kWrapperInfo on the class deriving from Wrappable
Otherwise, we need to put INIT_WRAPPABLE() in namespace gin no matter where the derived class is declared. I pulled this out from https://codereview.chromium.org/111083005/ BUG=none R=dcarney@chromium.org TBR=aa@chromium.org Review URL: https://codereview.chromium.org/113163007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240271 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/wrappable.h')
-rw-r--r--gin/wrappable.h12
1 files changed, 1 insertions, 11 deletions
diff --git a/gin/wrappable.h b/gin/wrappable.h
index 5644591..b8202df 100644
--- a/gin/wrappable.h
+++ b/gin/wrappable.h
@@ -63,13 +63,11 @@ class WrappableBase {
template<typename T>
class Wrappable : public WrappableBase {
public:
- static WrapperInfo kWrapperInfo;
-
// Retrieve (or create) the v8 wrapper object cooresponding to this object.
// To customize the wrapper created for a subclass, override GetWrapperInfo()
// instead of overriding this function.
v8::Handle<v8::Object> GetWrapper(v8::Isolate* isolate) {
- return GetWrapperImpl(isolate, &kWrapperInfo);
+ return GetWrapperImpl(isolate, &T::kWrapperInfo);
}
protected:
@@ -81,14 +79,6 @@ class Wrappable : public WrappableBase {
};
-// Subclasses of Wrappable must call this within a cc file to initialize their
-// WrapperInfo. This template must be used inside namespace gin.
-#define INIT_WRAPPABLE(TYPE) \
- template <> \
- gin::WrapperInfo gin::Wrappable<TYPE>::kWrapperInfo = { \
- gin::kEmbedderNativeGin \
- }
-
// This converter handles any subclass of Wrappable.
template<typename T>
struct Converter<T*, typename base::enable_if<