Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: gin/wrappable.h

Issue 116163008: Move the plugin placeholder from CppBoundClass to gin::Wrappable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: counter-proposal Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gin/wrappable.h
diff --git a/gin/wrappable.h b/gin/wrappable.h
index fccca1ac4aa46d03a228fac26d05ce2da116209e..e20c7f1e82b115f95d8670ee56d47df4b63e085e 100644
--- a/gin/wrappable.h
+++ b/gin/wrappable.h
@@ -53,32 +53,23 @@ GIN_EXPORT void* FromV8Impl(v8::Isolate* isolate,
template<typename T>
class Wrappable;
+class ObjectTemplateBuilder;
// Non-template base class to share code between templates instances.
class GIN_EXPORT WrappableBase {
protected:
- typedef v8::Local<v8::ObjectTemplate>(*GetObjectTemplateFunction)(
- v8::Isolate*);
-
WrappableBase();
virtual ~WrappableBase();
- v8::Handle<v8::Object> GetWrapperImpl(
- v8::Isolate* isolate,
- WrapperInfo* wrapper_info,
- GetObjectTemplateFunction template_getter);
+ virtual ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate);
- static v8::Local<v8::ObjectTemplate> GetObjectTemplate(v8::Isolate* isolate);
+ v8::Handle<v8::Object> GetWrapperImpl(v8::Isolate* isolate,
+ WrapperInfo* wrapper_info);
private:
static void WeakCallback(
const v8::WeakCallbackData<v8::Object, WrappableBase>& data);
- v8::Handle<v8::Object> CreateWrapper(
- v8::Isolate* isolate,
- WrapperInfo* wrapper_info,
- GetObjectTemplateFunction template_getter);
-
v8::Persistent<v8::Object> wrapper_; // Weak
DISALLOW_COPY_AND_ASSIGN(WrappableBase);
@@ -92,7 +83,7 @@ class Wrappable : public WrappableBase {
// 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, &T::kWrapperInfo, &T::GetObjectTemplate);
+ return GetWrapperImpl(isolate, &T::kWrapperInfo);
}
protected:
@@ -107,7 +98,7 @@ class Wrappable : public WrappableBase {
// This converter handles any subclass of Wrappable.
template<typename T>
struct Converter<T*, typename base::enable_if<
- base::is_convertible<T*, Wrappable<T>*>::value>::type> {
Aaron Boodman 2013/12/18 19:12:18 This was making it so that only direct descendants
+ base::is_convertible<T*, WrappableBase*>::value>::type> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, T* val) {
return val->GetWrapper(isolate);
}

Powered by Google App Engine
This is Rietveld 408576698