| OLD | NEW |
| 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 #include "content/browser/shared_worker/shared_worker_instance.h" | 5 #include "content/browser/shared_worker/shared_worker_instance.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 SharedWorkerInstance::SharedWorkerInstance( | 11 SharedWorkerInstance::SharedWorkerInstance( |
| 12 const GURL& url, | 12 const GURL& url, |
| 13 const base::string16& name, | 13 const base::string16& name, |
| 14 const base::string16& content_security_policy, | 14 const base::string16& content_security_policy, |
| 15 blink::WebContentSecurityPolicyType security_policy_type, | 15 blink::WebContentSecurityPolicyType security_policy_type, |
| 16 blink::WebAddressSpace creation_address_space, | 16 blink::WebAddressSpace creation_address_space, |
| 17 ResourceContext* resource_context, | 17 ResourceContext* resource_context, |
| 18 const WorkerStoragePartitionId& partition_id, | 18 const WorkerStoragePartitionId& partition_id, |
| 19 blink::WebSharedWorkerCreationContextType creation_context_type) | 19 blink::WebSharedWorkerCreationContextType creation_context_type, |
| 20 bool data_saver_enabled) |
| 20 : url_(url), | 21 : url_(url), |
| 21 name_(name), | 22 name_(name), |
| 22 content_security_policy_(content_security_policy), | 23 content_security_policy_(content_security_policy), |
| 23 security_policy_type_(security_policy_type), | 24 security_policy_type_(security_policy_type), |
| 24 creation_address_space_(creation_address_space), | 25 creation_address_space_(creation_address_space), |
| 25 resource_context_(resource_context), | 26 resource_context_(resource_context), |
| 26 partition_id_(partition_id), | 27 partition_id_(partition_id), |
| 27 creation_context_type_(creation_context_type) { | 28 creation_context_type_(creation_context_type), |
| 29 data_saver_enabled_(data_saver_enabled) { |
| 28 DCHECK(resource_context_); | 30 DCHECK(resource_context_); |
| 29 } | 31 } |
| 30 | 32 |
| 31 SharedWorkerInstance::SharedWorkerInstance(const SharedWorkerInstance& other) | 33 SharedWorkerInstance::SharedWorkerInstance(const SharedWorkerInstance& other) |
| 32 : url_(other.url_), | 34 : url_(other.url_), |
| 33 name_(other.name_), | 35 name_(other.name_), |
| 34 content_security_policy_(other.content_security_policy_), | 36 content_security_policy_(other.content_security_policy_), |
| 35 security_policy_type_(other.security_policy_type_), | 37 security_policy_type_(other.security_policy_type_), |
| 36 creation_address_space_(other.creation_address_space_), | 38 creation_address_space_(other.creation_address_space_), |
| 37 resource_context_(other.resource_context_), | 39 resource_context_(other.resource_context_), |
| 38 partition_id_(other.partition_id_), | 40 partition_id_(other.partition_id_), |
| 39 creation_context_type_(other.creation_context_type_) {} | 41 creation_context_type_(other.creation_context_type_), |
| 42 data_saver_enabled_(other.data_saver_enabled_) {} |
| 40 | 43 |
| 41 SharedWorkerInstance::~SharedWorkerInstance() {} | 44 SharedWorkerInstance::~SharedWorkerInstance() {} |
| 42 | 45 |
| 43 bool SharedWorkerInstance::Matches(const GURL& match_url, | 46 bool SharedWorkerInstance::Matches(const GURL& match_url, |
| 44 const base::string16& match_name, | 47 const base::string16& match_name, |
| 45 const WorkerStoragePartitionId& partition_id, | 48 const WorkerStoragePartitionId& partition_id, |
| 46 ResourceContext* resource_context) const { | 49 ResourceContext* resource_context) const { |
| 47 // ResourceContext equivalence is being used as a proxy to ensure we only | 50 // ResourceContext equivalence is being used as a proxy to ensure we only |
| 48 // matched shared workers within the same BrowserContext. | 51 // matched shared workers within the same BrowserContext. |
| 49 if (resource_context_ != resource_context) | 52 if (resource_context_ != resource_context) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 63 } | 66 } |
| 64 | 67 |
| 65 bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const { | 68 bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const { |
| 66 return Matches(other.url(), | 69 return Matches(other.url(), |
| 67 other.name(), | 70 other.name(), |
| 68 other.partition_id(), | 71 other.partition_id(), |
| 69 other.resource_context()); | 72 other.resource_context()); |
| 70 } | 73 } |
| 71 | 74 |
| 72 } // namespace content | 75 } // namespace content |
| OLD | NEW |