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 WebWorkerFetchContextInfo_h | |
6 #define WebWorkerFetchContextInfo_h | |
7 | |
8 namespace base { | |
9 class SingleThreadTaskRunner; | |
10 } // namespace base | |
11 | |
12 namespace blink { | |
13 | |
14 class WebWorkerFetchContext; | |
15 | |
16 // 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.
| |
17 // (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.
| |
18 // resource fetching context (ex: service worker provider id). | |
19 class WebWorkerFetchContextInfo { | |
20 public: | |
21 virtual ~WebWorkerFetchContextInfo() {} | |
22 | |
23 // Creates a WebWorkerFetchContext in the worker thread which will be used | |
24 // when the worker thread fetches resrouces. | |
25 virtual std::unique_ptr<WebWorkerFetchContext> CreateContext( | |
26 base::SingleThreadTaskRunner*) = 0; | |
27 | |
28 void SetServiceWorkerProviderID(int id) { service_worker_provider_id_ = id; } | |
29 void SetIsControlledByServiceWorker(bool flag) { | |
30 is_controlled_by_service_worker_ = flag; | |
31 } | |
32 | |
33 int GetServiceWorkerProviderID() const { return service_worker_provider_id_; } | |
34 bool IsControlledByServiceWorker() const { | |
35 return is_controlled_by_service_worker_; | |
36 } | |
37 | |
38 private: | |
39 int service_worker_provider_id_ = -1; | |
40 bool is_controlled_by_service_worker_ = false; | |
41 }; | |
42 | |
43 } // namespace blink | |
44 | |
45 #endif // WebWorkerFetchContextInfo_h | |
OLD | NEW |