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

Side by Side Diff: extensions/common/permissions/permissions_data.cc

Issue 2873133006: Removed unecessary thread owner check. We just care about whether the lock was acquired. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "extensions/common/permissions/permissions_data.h" 5 #include "extensions/common/permissions/permissions_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const URLPatternSet& PermissionsData::default_policy_allowed_hosts() { 151 const URLPatternSet& PermissionsData::default_policy_allowed_hosts() {
152 return default_runtime_policy.Get().allowed_hosts; 152 return default_runtime_policy.Get().allowed_hosts;
153 } 153 }
154 154
155 const URLPatternSet PermissionsData::policy_blocked_hosts() const { 155 const URLPatternSet PermissionsData::policy_blocked_hosts() const {
156 base::AutoLock auto_lock(runtime_lock_); 156 base::AutoLock auto_lock(runtime_lock_);
157 return PolicyBlockedHostsUnsafe(); 157 return PolicyBlockedHostsUnsafe();
158 } 158 }
159 159
160 const URLPatternSet& PermissionsData::PolicyBlockedHostsUnsafe() const { 160 const URLPatternSet& PermissionsData::PolicyBlockedHostsUnsafe() const {
161 DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread()); 161 runtime_lock_.AssertAcquired();
162 if (uses_default_policy_host_restrictions) 162 if (uses_default_policy_host_restrictions)
163 return default_policy_blocked_hosts(); 163 return default_policy_blocked_hosts();
164 runtime_lock_.AssertAcquired();
165 return policy_blocked_hosts_unsafe_; 164 return policy_blocked_hosts_unsafe_;
166 } 165 }
167 166
168 const URLPatternSet PermissionsData::policy_allowed_hosts() const { 167 const URLPatternSet PermissionsData::policy_allowed_hosts() const {
169 base::AutoLock auto_lock(runtime_lock_); 168 base::AutoLock auto_lock(runtime_lock_);
170 return PolicyAllowedHostsUnsafe(); 169 return PolicyAllowedHostsUnsafe();
171 } 170 }
172 171
173 const URLPatternSet& PermissionsData::PolicyAllowedHostsUnsafe() const { 172 const URLPatternSet& PermissionsData::PolicyAllowedHostsUnsafe() const {
174 DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread()); 173 runtime_lock_.AssertAcquired();
175 if (uses_default_policy_host_restrictions) 174 if (uses_default_policy_host_restrictions)
176 return default_policy_allowed_hosts(); 175 return default_policy_allowed_hosts();
177 runtime_lock_.AssertAcquired();
178 return policy_allowed_hosts_unsafe_; 176 return policy_allowed_hosts_unsafe_;
179 } 177 }
180 178
181 void PermissionsData::BindToCurrentThread() const { 179 void PermissionsData::BindToCurrentThread() const {
182 DCHECK(!thread_checker_); 180 DCHECK(!thread_checker_);
183 thread_checker_.reset(new base::ThreadChecker()); 181 thread_checker_.reset(new base::ThreadChecker());
184 } 182 }
185 183
186 void PermissionsData::SetPermissions( 184 void PermissionsData::SetPermissions(
187 std::unique_ptr<const PermissionSet> active, 185 std::unique_ptr<const PermissionSet> active,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 manifest_errors::kCannotAccessPageWithUrl, document_url.spec()); 456 manifest_errors::kCannotAccessPageWithUrl, document_url.spec());
459 } else { 457 } else {
460 *error = manifest_errors::kCannotAccessPage; 458 *error = manifest_errors::kCannotAccessPage;
461 } 459 }
462 } 460 }
463 461
464 return ACCESS_DENIED; 462 return ACCESS_DENIED;
465 } 463 }
466 464
467 } // namespace extensions 465 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698