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

Side by Side Diff: content/renderer/service_worker/worker_fetch_context_impl.h

Issue 2890723002: Set the requester context info to the requests for off-main-thread-fetch. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ 6 #define CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_
7 7
8 #include "content/common/service_worker/service_worker_types.h" 8 #include "content/common/service_worker/service_worker_types.h"
9 #include "content/common/worker_url_loader_factory_provider.mojom.h" 9 #include "content/common/worker_url_loader_factory_provider.mojom.h"
10 #include "mojo/public/cpp/bindings/associated_binding.h" 10 #include "mojo/public/cpp/bindings/associated_binding.h"
11 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h" 11 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h"
12 12
13 namespace base { 13 namespace base {
14 class SingleThreadTaskRunner; 14 class SingleThreadTaskRunner;
15 } // namespace base 15 } // namespace base
16 16
17 namespace content { 17 namespace content {
18 18
19 class ResourceDispatcher; 19 class ResourceDispatcher;
20 20
falken 2017/05/17 08:40:26 just to be sure: this context is going to be assoc
horo 2017/05/17 10:33:52 Done.
21 class WorkerFetchContextImpl : public blink::WebWorkerFetchContext, 21 class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
22 public mojom::ServiceWorkerWorkerClient { 22 public mojom::ServiceWorkerWorkerClient {
23 public: 23 public:
24 explicit WorkerFetchContextImpl( 24 explicit WorkerFetchContextImpl(
25 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info); 25 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info);
26 ~WorkerFetchContextImpl() override; 26 ~WorkerFetchContextImpl() override;
27 27
28 // blink::WebWorkerFetchContext implementation: 28 // blink::WebWorkerFetchContext implementation:
29 void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) override; 29 void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) override;
30 std::unique_ptr<blink::WebURLLoader> CreateURLLoader() override; 30 std::unique_ptr<blink::WebURLLoader> CreateURLLoader() override;
31 void WillSendRequest(blink::WebURLRequest&) override; 31 void WillSendRequest(blink::WebURLRequest&) override;
32 bool IsControlledByServiceWorker() const override; 32 bool IsControlledByServiceWorker() const override;
33 void SetDataSaverEnabled(bool) override; 33 void SetDataSaverEnabled(bool) override;
34 bool IsDataSaverEnabled() const override; 34 bool IsDataSaverEnabled() const override;
35 35
36 // mojom::ServiceWorkerWorkerClient implementation: 36 // mojom::ServiceWorkerWorkerClient implementation:
37 void SetControllerServiceWorker(int64_t controller_version_id) override; 37 void SetControllerServiceWorker(int64_t controller_version_id) override;
38 38
39 // Sets the service worker status of the parent frame. 39 // Sets the fetch context status of the parent frame.
falken 2017/05/17 08:40:26 What's the "parent frame" when this is for a share
horo 2017/05/17 10:33:52 Added comment.
40 void set_service_worker_provider_id(int id); 40 void set_service_worker_provider_id(int id);
41 void set_is_controlled_by_service_worker(bool flag); 41 void set_is_controlled_by_service_worker(bool flag);
42 void set_is_secure_context(bool flag);
falken 2017/05/17 08:40:26 Can you document what this flag means?
horo 2017/05/17 10:33:52 Done.
42 43
43 private: 44 private:
44 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_; 45 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_;
45 int service_worker_provider_id_ = kInvalidServiceWorkerProviderId; 46 int service_worker_provider_id_ = kInvalidServiceWorkerProviderId;
46 bool is_controlled_by_service_worker_ = false; 47 bool is_controlled_by_service_worker_ = false;
47 48
48 // Initialized on the worker thread when InitializeOnWorkerThread() is called. 49 // Initialized on the worker thread when InitializeOnWorkerThread() is called.
49 std::unique_ptr<ResourceDispatcher> resource_dispatcher_; 50 std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
50 std::unique_ptr<mojo::AssociatedBinding<mojom::ServiceWorkerWorkerClient>> 51 std::unique_ptr<mojo::AssociatedBinding<mojom::ServiceWorkerWorkerClient>>
51 binding_; 52 binding_;
52 mojom::WorkerURLLoaderFactoryProviderPtr provider_; 53 mojom::WorkerURLLoaderFactoryProviderPtr provider_;
53 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_; 54 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_;
54 55
55 // Updated when mojom::ServiceWorkerWorkerClient::SetControllerServiceWorker() 56 // Updated when mojom::ServiceWorkerWorkerClient::SetControllerServiceWorker()
56 // is called from the browser process via mojo IPC. 57 // is called from the browser process via mojo IPC.
57 int controller_version_id_ = kInvalidServiceWorkerVersionId; 58 int controller_version_id_ = kInvalidServiceWorkerVersionId;
58 59
59 bool is_data_saver_enabled_ = false; 60 bool is_data_saver_enabled_ = false;
61 bool is_secure_context_ = false;
60 }; 62 };
61 63
62 } // namespace content 64 } // namespace content
63 65
64 #endif // CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_ 66 #endif // CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698