Chromium Code Reviews| Index: third_party/WebKit/public/platform/WebWorkerFetchContextInfo.h |
| diff --git a/third_party/WebKit/public/platform/WebWorkerFetchContextInfo.h b/third_party/WebKit/public/platform/WebWorkerFetchContextInfo.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dc59bad71ce7e9cd322ee25a368f4ee1b62b87df |
| --- /dev/null |
| +++ b/third_party/WebKit/public/platform/WebWorkerFetchContextInfo.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2017 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. |
| + |
| +#ifndef WebWorkerFetchContextInfo_h |
| +#define WebWorkerFetchContextInfo_h |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} // namespace base |
| + |
| +namespace blink { |
| + |
| +class WebWorkerFetchContext; |
| + |
| +// WebWorkerFetchContextInfo is created on the main thread and passed to a |
| +// worker (dedicated, shared, service worker). It contins information about the |
|
kinuko
2017/04/14 14:00:27
contins -> contains
horo
2017/04/17 15:12:04
Done.
|
| +// resource fetching context (ex: service worker provider id). |
| +class WebWorkerFetchContextInfo { |
|
kinuko
2017/04/14 14:00:26
I wonder if it's possible to only expose WebWorker
horo
2017/04/17 15:12:04
Done.
|
| + public: |
| + virtual ~WebWorkerFetchContextInfo() {} |
| + |
| + // Creates a WebWorkerFetchContext in the worker thread which will be used |
| + // when the worker thread fetches resrouces. |
| + virtual std::unique_ptr<WebWorkerFetchContext> CreateContext( |
| + base::SingleThreadTaskRunner*) = 0; |
| + |
| + void SetServiceWorkerProviderID(int id) { service_worker_provider_id_ = id; } |
| + void SetIsControlledByServiceWorker(bool flag) { |
| + is_controlled_by_service_worker_ = flag; |
| + } |
| + |
| + int GetServiceWorkerProviderID() const { return service_worker_provider_id_; } |
| + bool IsControlledByServiceWorker() const { |
| + return is_controlled_by_service_worker_; |
| + } |
| + |
| + private: |
| + int service_worker_provider_id_ = -1; |
| + bool is_controlled_by_service_worker_ = false; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // WebWorkerFetchContextInfo_h |