Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "core/workers/WorkerSettings.h" | |
| 6 | |
| 7 #include "core/workers/WorkerGlobalScope.h" | |
| 8 | |
| 9 namespace blink { | |
| 10 | |
| 11 const char* WorkerSettings::supplementName() | |
| 12 { | |
| 13 return "WorkerSettings"; | |
| 14 } | |
| 15 | |
| 16 WorkerSettings* WorkerSettings::create(Settings* settings) | |
| 17 { | |
| 18 WorkerSettings* workerSettings = new WorkerSettings(); | |
| 19 workerSettings->copyFlagValuesFromSettings(settings); | |
| 20 return workerSettings; | |
| 21 } | |
| 22 | |
| 23 WorkerSettings* WorkerSettings::from(ExecutionContext* context) | |
|
kinuko
2016/07/22 09:02:54
I'm not sure if we should pass this as a supplemen
xlai (Olivia)
2016/07/22 21:53:30
I did think of making WorkerSetting to become a me
nhiroki
2016/07/25 11:14:48
I'd prefer to pass it via WorkerThreadStartupData.
| |
| 24 { | |
| 25 if (context->isWorkerGlobalScope()) { | |
| 26 WorkerClients* clients = toWorkerGlobalScope(*context).clients(); | |
| 27 DCHECK(clients); | |
| 28 return static_cast<WorkerSettings*>(Supplement<WorkerClients>::from(clie nts, supplementName())); | |
| 29 } | |
| 30 return nullptr; | |
| 31 } | |
| 32 | |
| 33 void WorkerSettings::copyFlagValuesFromSettings(Settings* settings) | |
| 34 { | |
| 35 m_disableReadingFromCanvas = settings->disableReadingFromCanvas(); | |
| 36 } | |
| 37 | |
| 38 void provideWorkerSettingsToWorker(WorkerClients* clients, WorkerSettings* clien t) | |
| 39 { | |
| 40 clients->provideSupplement(WorkerSettings::supplementName(), client); | |
| 41 } | |
| 42 | |
| 43 DEFINE_TRACE(WorkerSettings) | |
| 44 { | |
| 45 Supplement<WorkerClients>::trace(visitor); | |
| 46 } | |
| 47 } | |
|
kinuko
2016/07/22 09:02:54
ditto
xlai (Olivia)
2016/07/22 21:53:30
Done.
| |
| OLD | NEW |