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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 1256323008: [Extension ServiceWorkers] Chrome: Passing v8::context to extensions dispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index fb5d507348b8687139e447855d8752ab2bf9612f..63b9d436ac5a2027e511549dfb3963d26df90d8f 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -306,6 +306,21 @@ void Dispatcher::DidCreateScriptContext(
VLOG(1) << "Num tracked contexts: " << script_context_set_->size();
}
+void Dispatcher::DidInitializeWorkerContext(v8::Local<v8::Context> context,
not at google - send to devlin 2015/07/30 22:00:14 Make sure to disambiguate between workers and serv
Devlin 2015/07/30 22:07:24 Being notified about every worker context is a lit
+ const GURL& url) {
+ const Extension* extension = extensions_.GetExtensionOrAppByURL(url);
+ if (extension) {
+ v8::Local<v8::String> key;
+ if (v8::String::NewFromUtf8(context->GetIsolate(), "chrome",
+ v8::NewStringType::kNormal)
not at google - send to devlin 2015/07/30 22:00:14 You can use v8_helpers here (v8_helpers::ToV8Strin
+ .ToLocal(&key)) {
+ v8::Local<v8::Number> value = v8::Number::New(context->GetIsolate(), 42);
Devlin 2015/07/30 21:31:08 While this is fun, let's go ahead and initialize c
annekao 2015/07/30 22:54:18 Done. Tested that chrome was type object.
+ if (context->Global()->Set(context, key, value).IsJust()) {
not at google - send to devlin 2015/07/30 22:00:14 I presume you did this because it has the V8_WARN_
annekao 2015/07/30 22:54:18 Done.
+ }
+ }
+ }
+}
+
void Dispatcher::WillReleaseScriptContext(
blink::WebLocalFrame* frame,
const v8::Local<v8::Context>& v8_context,

Powered by Google App Engine
This is Rietveld 408576698