Index: third_party/WebKit/public/platform/WebWorkerFetchContext.h |
diff --git a/third_party/WebKit/public/platform/WebWorkerFetchContext.h b/third_party/WebKit/public/platform/WebWorkerFetchContext.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a5932add4fa747c2a60006ff626e678c1bcddd7f |
--- /dev/null |
+++ b/third_party/WebKit/public/platform/WebWorkerFetchContext.h |
@@ -0,0 +1,48 @@ |
+// 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 WebWorkerFetchContext_h |
+#define WebWorkerFetchContext_h |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+} // namespace base |
+ |
+namespace blink { |
+ |
+class WebURLLoader; |
+class WebURLRequest; |
+ |
+// WebWorkerFetchContext is created on the main thread and passed to a worker |
kinuko
2017/04/18 08:00:31
It'd be nicer to note that this is a per-worker ob
kinuko
2017/04/18 08:00:31
nit: and -> ,
horo
2017/04/18 12:53:35
Done.
horo
2017/04/18 12:53:35
Done.
|
+// (dedicated, shared, service worker) and initialized on the worker thread by |
+// InitializeOnWorkerThread(). It contains information about the resource |
+// fetching context (ex: service worker provider id), and is used to create a |
+// new WebURLLoader instance in the worker thread. |
+class WebWorkerFetchContext { |
+ public: |
+ virtual ~WebWorkerFetchContext() {} |
+ |
+ virtual void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) = 0; |
+ |
+ // Returns a new WebURLLoader instance which is associated with the worker |
+ // thread. |
+ virtual WebURLLoader* CreateURLLoader() = 0; |
+ |
+ // Called when a request is about to be sent out to modify the request to |
+ // handle the request correctly in the loading stack later. (Example: service |
+ // worker) |
+ virtual void WillSendRequest(WebURLRequest&) = 0; |
+ |
+ // Whether the fetch context is controlled by a service worker. |
+ virtual bool IsControlledByServiceWorker() const = 0; |
+ |
+ // Set the information about the resource fetching context. Must be called on |
+ // the main thread. |
kinuko
2017/04/18 08:00:31
Ok I see, I looked at the dependent patch. Hmm...
kinuko
2017/04/18 08:00:32
Who calls these?
kinuko
2017/04/18 08:35:37
Or we could also revisit this later too when we st
horo
2017/04/18 12:53:35
Acknowledged.
horo
2017/04/18 12:53:35
We don't have the information on the worker thread
horo
2017/04/18 12:53:35
This will be called in DedicatedWorkerMessagingPro
kinuko
2017/04/19 03:24:49
That's the caller side's constraint, not this clas
kinuko
2017/04/19 03:50:49
I see. CreateWorkerFetchContext might rather be on
|
+ virtual void SetServiceWorkerProviderID(int id) {} |
+ virtual void SetIsControlledByServiceWorker(bool flag) {} |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // WebWorkerFetchContext_h |