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

Side by Side Diff: content/browser/shared_worker/shared_worker_instance.h

Issue 2881073003: Support DataSaver for SharedWorker (Closed)
Patch Set: rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_
6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "content/browser/shared_worker/worker_storage_partition.h" 10 #include "content/browser/shared_worker/worker_storage_partition.h"
(...skipping 11 matching lines...) Expand all
22 class CONTENT_EXPORT SharedWorkerInstance { 22 class CONTENT_EXPORT SharedWorkerInstance {
23 public: 23 public:
24 SharedWorkerInstance( 24 SharedWorkerInstance(
25 const GURL& url, 25 const GURL& url,
26 const base::string16& name, 26 const base::string16& name,
27 const base::string16& content_security_policy, 27 const base::string16& content_security_policy,
28 blink::WebContentSecurityPolicyType security_policy_type, 28 blink::WebContentSecurityPolicyType security_policy_type,
29 blink::WebAddressSpace creation_address_space, 29 blink::WebAddressSpace creation_address_space,
30 ResourceContext* resource_context, 30 ResourceContext* resource_context,
31 const WorkerStoragePartitionId& partition_id, 31 const WorkerStoragePartitionId& partition_id,
32 blink::WebSharedWorkerCreationContextType creation_context_type); 32 blink::WebSharedWorkerCreationContextType creation_context_type,
33 bool data_saver_enabled);
falken 2017/05/17 00:54:53 consider an enum like WebDataSaverFlag { Enabled,
kinuko 2017/05/17 02:13:15 +1
horo 2017/05/17 02:15:42 Done.
kinuko 2017/05/17 06:13:22 I know it's a bit of hassle, but could we use enum
33 SharedWorkerInstance(const SharedWorkerInstance& other); 34 SharedWorkerInstance(const SharedWorkerInstance& other);
34 ~SharedWorkerInstance(); 35 ~SharedWorkerInstance();
35 36
36 // Checks if this SharedWorkerInstance matches the passed url/name params 37 // Checks if this SharedWorkerInstance matches the passed url/name params
37 // based on the algorithm in the WebWorkers spec - an instance matches if the 38 // based on the algorithm in the WebWorkers spec - an instance matches if the
38 // origins of the URLs match, and: 39 // origins of the URLs match, and:
39 // a) the names are non-empty and equal. 40 // a) the names are non-empty and equal.
40 // -or- 41 // -or-
41 // b) the names are both empty, and the urls are equal. 42 // b) the names are both empty, and the urls are equal.
42 bool Matches(const GURL& url, 43 bool Matches(const GURL& url,
(...skipping 14 matching lines...) Expand all
57 blink::WebAddressSpace creation_address_space() const { 58 blink::WebAddressSpace creation_address_space() const {
58 return creation_address_space_; 59 return creation_address_space_;
59 } 60 }
60 ResourceContext* resource_context() const { 61 ResourceContext* resource_context() const {
61 return resource_context_; 62 return resource_context_;
62 } 63 }
63 const WorkerStoragePartitionId& partition_id() const { return partition_id_; } 64 const WorkerStoragePartitionId& partition_id() const { return partition_id_; }
64 blink::WebSharedWorkerCreationContextType creation_context_type() const { 65 blink::WebSharedWorkerCreationContextType creation_context_type() const {
65 return creation_context_type_; 66 return creation_context_type_;
66 } 67 }
68 bool data_saver_enabled() const { return data_saver_enabled_; }
67 69
68 private: 70 private:
69 const GURL url_; 71 const GURL url_;
70 const base::string16 name_; 72 const base::string16 name_;
71 const base::string16 content_security_policy_; 73 const base::string16 content_security_policy_;
72 const blink::WebContentSecurityPolicyType security_policy_type_; 74 const blink::WebContentSecurityPolicyType security_policy_type_;
73 const blink::WebAddressSpace creation_address_space_; 75 const blink::WebAddressSpace creation_address_space_;
74 ResourceContext* const resource_context_; 76 ResourceContext* const resource_context_;
75 const WorkerStoragePartitionId partition_id_; 77 const WorkerStoragePartitionId partition_id_;
76 const blink::WebSharedWorkerCreationContextType creation_context_type_; 78 const blink::WebSharedWorkerCreationContextType creation_context_type_;
79 const bool data_saver_enabled_;
77 }; 80 };
78 81
79 } // namespace content 82 } // namespace content
80 83
81 84
82 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ 85 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698