Extensions: pass ChromeV8Context around instead of v8::Handle.
There was a TODO about this in object_backed_native_handler.h.
The passed handle was a Persistent behind the scenes, and we're going to disable
copying Persistents. We'd need to pass a Local handle instead, but this way the
TODO gets done with a similar amount of effort.
BUG=236290
Review URL: https://chromiumcodereview.appspot.com/16032015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203978 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/renderer/extensions/module_system.cc b/chrome/renderer/extensions/module_system.cc
index 85050a7d..3f46ee1 100644
--- a/chrome/renderer/extensions/module_system.cc
+++ b/chrome/renderer/extensions/module_system.cc
@@ -69,7 +69,7 @@
} // namespace
-ModuleSystem::ModuleSystem(v8::Handle<v8::Context> context,
+ModuleSystem::ModuleSystem(ChromeV8Context* context,
SourceMap* source_map)
: ObjectBackedNativeHandler(context),
source_map_(source_map),
@@ -79,7 +79,7 @@
RouteFunction("requireNative",
base::Bind(&ModuleSystem::RequireNative, base::Unretained(this)));
- v8::Handle<v8::Object> global(context->Global());
+ v8::Handle<v8::Object> global(context->v8_context()->Global());
global->SetHiddenValue(v8::String::New(kModulesField), v8::Object::New());
global->SetHiddenValue(v8::String::New(kModuleSystem),
v8::External::New(this));
@@ -97,7 +97,7 @@
// and we use this as a signal in lazy handlers that we no longer exist.
{
v8::HandleScope scope;
- v8::Handle<v8::Object> global = v8_context()->Global();
+ v8::Handle<v8::Object> global = context()->v8_context()->Global();
global->DeleteHiddenValue(v8::String::New(kModulesField));
global->DeleteHiddenValue(v8::String::New(kModuleSystem));
}
@@ -144,9 +144,9 @@
v8::Handle<v8::Value> ModuleSystem::RequireForJsInner(
v8::Handle<v8::String> module_name) {
v8::HandleScope handle_scope;
- v8::Context::Scope context_scope(v8_context());
+ v8::Context::Scope context_scope(context()->v8_context());
- v8::Handle<v8::Object> global(v8_context()->Global());
+ v8::Handle<v8::Object> global(context()->v8_context()->Global());
// The module system might have been deleted. This can happen if a different
// context keeps a reference to us, but our frame is destroyed (e.g.
@@ -236,7 +236,7 @@
v8::Handle<v8::Function> func =
v8::Handle<v8::Function>::Cast(value);
- v8::Handle<v8::Object> global(v8_context()->Global());
+ v8::Handle<v8::Object> global(context()->v8_context()->Global());
v8::Local<v8::Value> result;
{
WebKit::WebScopedMicrotaskSuppression suppression;
@@ -287,7 +287,7 @@
CHECK(info.Data()->IsObject());
v8::HandleScope handle_scope;
v8::Handle<v8::Object> parameters = v8::Handle<v8::Object>::Cast(info.Data());
- // This context should be the same as v8_context().
+ // This context should be the same as context()->v8_context().
v8::Handle<v8::Context> context = parameters->CreationContext();
v8::Handle<v8::Object> global(context->Global());
v8::Handle<v8::Value> module_system_value =