OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WebWorkerFetchContext_h | |
6 #define WebWorkerFetchContext_h | |
7 | |
8 namespace base { | |
9 class SingleThreadTaskRunner; | |
10 } // namespace base | |
11 | |
12 namespace blink { | |
13 | |
14 class WebURLLoader; | |
15 class WebURLRequest; | |
16 | |
17 // 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.
| |
18 // (dedicated, shared, service worker) and initialized on the worker thread by | |
19 // InitializeOnWorkerThread(). It contains information about the resource | |
20 // fetching context (ex: service worker provider id), and is used to create a | |
21 // new WebURLLoader instance in the worker thread. | |
22 class WebWorkerFetchContext { | |
23 public: | |
24 virtual ~WebWorkerFetchContext() {} | |
25 | |
26 virtual void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) = 0; | |
27 | |
28 // Returns a new WebURLLoader instance which is associated with the worker | |
29 // thread. | |
30 virtual WebURLLoader* CreateURLLoader() = 0; | |
31 | |
32 // Called when a request is about to be sent out to modify the request to | |
33 // handle the request correctly in the loading stack later. (Example: service | |
34 // worker) | |
35 virtual void WillSendRequest(WebURLRequest&) = 0; | |
36 | |
37 // Whether the fetch context is controlled by a service worker. | |
38 virtual bool IsControlledByServiceWorker() const = 0; | |
39 | |
40 // Set the information about the resource fetching context. Must be called on | |
41 // 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
| |
42 virtual void SetServiceWorkerProviderID(int id) {} | |
43 virtual void SetIsControlledByServiceWorker(bool flag) {} | |
44 }; | |
45 | |
46 } // namespace blink | |
47 | |
48 #endif // WebWorkerFetchContext_h | |
OLD | NEW |