Chromium Code Reviews| Index: third_party/WebKit/Source/core/workers/WorkerSettings.cpp |
| diff --git a/third_party/WebKit/Source/core/workers/WorkerSettings.cpp b/third_party/WebKit/Source/core/workers/WorkerSettings.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..80bdedc840b077b9bbe690b2afd8cf8c9a129b65 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/workers/WorkerSettings.cpp |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/workers/WorkerSettings.h" |
| + |
| +#include "core/workers/WorkerGlobalScope.h" |
| + |
| +namespace blink { |
| + |
| +const char* WorkerSettings::supplementName() |
| +{ |
| + return "WorkerSettings"; |
| +} |
| + |
| +WorkerSettings* WorkerSettings::create(Settings* settings) |
| +{ |
| + WorkerSettings* workerSettings = new WorkerSettings(); |
| + workerSettings->copyFlagValuesFromSettings(settings); |
| + return workerSettings; |
| +} |
| + |
| +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.
|
| +{ |
| + if (context->isWorkerGlobalScope()) { |
| + WorkerClients* clients = toWorkerGlobalScope(*context).clients(); |
| + DCHECK(clients); |
| + return static_cast<WorkerSettings*>(Supplement<WorkerClients>::from(clients, supplementName())); |
| + } |
| + return nullptr; |
| +} |
| + |
| +void WorkerSettings::copyFlagValuesFromSettings(Settings* settings) |
| +{ |
| + m_disableReadingFromCanvas = settings->disableReadingFromCanvas(); |
| +} |
| + |
| +void provideWorkerSettingsToWorker(WorkerClients* clients, WorkerSettings* client) |
| +{ |
| + clients->provideSupplement(WorkerSettings::supplementName(), client); |
| +} |
| + |
| +DEFINE_TRACE(WorkerSettings) |
| +{ |
| + Supplement<WorkerClients>::trace(visitor); |
| +} |
| +} |
|
kinuko
2016/07/22 09:02:54
ditto
xlai (Olivia)
2016/07/22 21:53:30
Done.
|