Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: third_party/WebKit/public/platform/WebWorkerFetchContextInfo.h

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..0a47771156cacb6153d4f86659437fcd8ab12f81
--- /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 in a main thread and passed to worker
kinuko 2017/04/14 02:27:02 nit: in a main thread -> on the main thread passed
horo 2017/04/14 07:22:45 Done.
+// (dedicated, shared, service worker). It contins a information about the
kinuko 2017/04/14 02:27:02 a information -> information
horo 2017/04/14 07:22:45 Done.
+// resource fetching context (ex: service worker provider id).
+class WebWorkerFetchContextInfo {
+ 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

Powered by Google App Engine
This is Rietveld 408576698