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

Unified Diff: extensions/renderer/object_backed_native_handler.cc

Issue 983793003: Replace extensions::ScopedPersistent with v8::UniquePersistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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: extensions/renderer/object_backed_native_handler.cc
diff --git a/extensions/renderer/object_backed_native_handler.cc b/extensions/renderer/object_backed_native_handler.cc
index 0c75ea0e82160d0224bb78de6363d2fc14e7fa04..10bedc1772fb714a604860d20e133ad1e07226d9 100644
--- a/extensions/renderer/object_backed_native_handler.cc
+++ b/extensions/renderer/object_backed_native_handler.cc
@@ -19,15 +19,17 @@ const char* kHandlerFunction = "handler_function";
} // namespace
ObjectBackedNativeHandler::ObjectBackedNativeHandler(ScriptContext* context)
- : router_data_(context->v8_context()->GetIsolate()),
+ : router_data_(context->isolate()),
context_(context),
- object_template_(
- v8::ObjectTemplate::New(context->v8_context()->GetIsolate())) {}
+ object_template_(context->isolate(),
+ v8::ObjectTemplate::New(context->isolate())) {
+}
ObjectBackedNativeHandler::~ObjectBackedNativeHandler() { Invalidate(); }
v8::Handle<v8::Object> ObjectBackedNativeHandler::NewInstance() {
- return object_template_.NewHandle(v8::Isolate::GetCurrent())->NewInstance();
+ return v8::Local<v8::ObjectTemplate>::New(GetIsolate(), object_template_)
+ ->NewInstance();
}
// static
@@ -63,7 +65,7 @@ void ObjectBackedNativeHandler::RouteFunction(
v8::External::New(isolate, new HandlerFunction(handler_function)));
v8::Handle<v8::FunctionTemplate> function_template =
v8::FunctionTemplate::New(isolate, Router, data);
- object_template_.NewHandle(isolate)
+ v8::Local<v8::ObjectTemplate>::New(isolate, object_template_)
->Set(isolate, name.c_str(), function_template);
router_data_.Append(data);
}
@@ -89,7 +91,7 @@ void ObjectBackedNativeHandler::Invalidate() {
data->Delete(v8::String::NewFromUtf8(isolate, kHandlerFunction));
}
router_data_.Clear();
- object_template_.reset();
+ object_template_.Reset();
context_ = NULL;
NativeHandler::Invalidate();
}
« no previous file with comments | « extensions/renderer/object_backed_native_handler.h ('k') | extensions/renderer/render_view_observer_natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698