Chromium Code Reviews| 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, |