Add nodeIntegrationInWorker option

This commit is contained in:
Cheng Zhao 2017-03-15 18:51:21 +09:00
parent e496e18f6e
commit a49af26e39
4 changed files with 20 additions and 2 deletions

View file

@ -441,12 +441,18 @@ void AtomRendererClient::AddSupportedKeySystems(
void AtomRendererClient::DidInitializeWorkerContextOnWorkerThread(
v8::Local<v8::Context> context) {
WebWorkerObserver::GetCurrent()->ContextCreated(context);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNodeIntegrationInWorker)) {
WebWorkerObserver::GetCurrent()->ContextCreated(context);
}
}
void AtomRendererClient::WillDestroyWorkerContextOnWorkerThread(
v8::Local<v8::Context> context) {
WebWorkerObserver::GetCurrent()->ContextWillDestroy(context);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNodeIntegrationInWorker)) {
WebWorkerObserver::GetCurrent()->ContextWillDestroy(context);
}
}
v8::Local<v8::Context> AtomRendererClient::GetContext(