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

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

Issue 2881073003: Support DataSaver for SharedWorker (Closed)
Patch Set: fix #include "public/web/WebDataSaverFlag.h" 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_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
7 7
8 #include "content/common/worker_url_loader_factory_provider.mojom.h" 8 #include "content/common/worker_url_loader_factory_provider.mojom.h"
9 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h" 9 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h"
10 #include "third_party/WebKit/public/web/WebDataSaverFlag.h"
10 11
11 namespace base { 12 namespace base {
12 class SingleThreadTaskRunner; 13 class SingleThreadTaskRunner;
13 } // namespace base 14 } // namespace base
14 15
15 namespace content { 16 namespace content {
16 class ResourceDispatcher; 17 class ResourceDispatcher;
17 18
18 class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext { 19 class ServiceWorkerFetchContextImpl : public blink::WebWorkerFetchContext {
19 public: 20 public:
20 ServiceWorkerFetchContextImpl( 21 ServiceWorkerFetchContextImpl(
21 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info, 22 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info,
22 int service_worker_provider_id); 23 int service_worker_provider_id);
23 ~ServiceWorkerFetchContextImpl() override; 24 ~ServiceWorkerFetchContextImpl() override;
24 25
25 // blink::WebWorkerFetchContext implementation: 26 // blink::WebWorkerFetchContext implementation:
26 void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) override; 27 void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) override;
27 std::unique_ptr<blink::WebURLLoader> CreateURLLoader() override; 28 std::unique_ptr<blink::WebURLLoader> CreateURLLoader() override;
28 void WillSendRequest(blink::WebURLRequest&) override; 29 void WillSendRequest(blink::WebURLRequest&) override;
29 bool IsControlledByServiceWorker() const override; 30 bool IsControlledByServiceWorker() const override;
30 void SetDataSaverEnabled(bool enabled) override; 31 void SetDataSaverFlag(blink::WebDataSaverFlag) override;
31 bool IsDataSaverEnabled() const override; 32 blink::WebDataSaverFlag DataSaverFlag() const override;
32 33
33 private: 34 private:
34 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_; 35 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_;
35 const int service_worker_provider_id_; 36 const int service_worker_provider_id_;
36 37
37 // Initialized on the worker thread when InitializeOnWorkerThread() is called. 38 // Initialized on the worker thread when InitializeOnWorkerThread() is called.
38 std::unique_ptr<ResourceDispatcher> resource_dispatcher_; 39 std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
39 mojom::WorkerURLLoaderFactoryProviderPtr provider_; 40 mojom::WorkerURLLoaderFactoryProviderPtr provider_;
40 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_; 41 mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_;
41 42
42 bool is_data_saver_enabled_ = false; 43 blink::WebDataSaverFlag data_saver_flag_ = blink::WebDataSaverFlag::kDisabled;
43 }; 44 };
44 45
45 } // namespace content 46 } // namespace content
46 47
47 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_ 48 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698