| 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)
|
| +{
|
| + 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);
|
| +}
|
| +}
|
|
|