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

Unified Diff: gin/wrappable.cc

Issue 118423004: Add support for wrapping classes indirectly inherited from gin::Wrappable<T> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update StatsCollectionController 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
« no previous file with comments | « gin/wrappable.h ('k') | gin/wrappable_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/wrappable.cc
diff --git a/gin/wrappable.cc b/gin/wrappable.cc
index 3446f4fa1ea928da83da7110332dd0920085c913..8d41ce06c4dfc4b5abb0a08b50f5ac84929777c2 100644
--- a/gin/wrappable.cc
+++ b/gin/wrappable.cc
@@ -17,18 +17,9 @@ WrappableBase::~WrappableBase() {
wrapper_.Reset();
}
-v8::Handle<v8::Object> WrappableBase::GetWrapperImpl(
- v8::Isolate* isolate,
- WrapperInfo* wrapper_info,
- GetObjectTemplateFunction template_getter) {
- if (wrapper_.IsEmpty())
- CreateWrapper(isolate, wrapper_info, template_getter);
- return v8::Local<v8::Object>::New(isolate, wrapper_);
-}
-
-v8::Local<v8::ObjectTemplate> WrappableBase::GetObjectTemplate(
+ObjectTemplateBuilder WrappableBase::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
- return ObjectTemplateBuilder(isolate).Build();
+ return ObjectTemplateBuilder(isolate);
}
void WrappableBase::WeakCallback(
@@ -38,14 +29,16 @@ void WrappableBase::WeakCallback(
delete wrappable;
}
-v8::Handle<v8::Object> WrappableBase::CreateWrapper(
- v8::Isolate* isolate,
- WrapperInfo* info,
- GetObjectTemplateFunction template_getter) {
+v8::Handle<v8::Object> WrappableBase::GetWrapperImpl(v8::Isolate* isolate,
+ WrapperInfo* info) {
+ if (!wrapper_.IsEmpty()) {
+ return v8::Local<v8::Object>::New(isolate, wrapper_);
+ }
+
PerIsolateData* data = PerIsolateData::From(isolate);
v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(info);
if (templ.IsEmpty()) {
- templ = template_getter(isolate);
+ templ = GetObjectTemplateBuilder(isolate).Build();
CHECK(!templ.IsEmpty());
data->SetObjectTemplate(info, templ);
}
« no previous file with comments | « gin/wrappable.h ('k') | gin/wrappable_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698