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

Side by Side Diff: content/browser/child_process_security_policy_impl.cc

Issue 2921063003: Fix process reuse for dedicated processes when over process limit. (Closed)
Patch Set: Rebase Created 3 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/child_process_security_policy_impl.h" 5 #include "content/browser/child_process_security_policy_impl.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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 bool CanAccessDataForOrigin(const GURL& site_url) { 261 bool CanAccessDataForOrigin(const GURL& site_url) {
262 if (origin_lock_.is_empty()) 262 if (origin_lock_.is_empty())
263 return true; 263 return true;
264 return origin_lock_ == site_url; 264 return origin_lock_ == site_url;
265 } 265 }
266 266
267 void LockToOrigin(const GURL& gurl) { 267 void LockToOrigin(const GURL& gurl) {
268 origin_lock_ = gurl; 268 origin_lock_ = gurl;
269 } 269 }
270 270
271 ChildProcessSecurityPolicyImpl::CheckOriginLockResult CheckOriginLock(
272 const GURL& gurl) {
273 if (origin_lock_.is_empty())
274 return ChildProcessSecurityPolicyImpl::CheckOriginLockResult::NO_LOCK;
275
276 if (origin_lock_ == gurl) {
277 return ChildProcessSecurityPolicyImpl::CheckOriginLockResult::
278 HAS_EQUAL_LOCK;
279 }
280
281 return ChildProcessSecurityPolicyImpl::CheckOriginLockResult::
282 HAS_WRONG_LOCK;
283 }
284
271 bool has_web_ui_bindings() const { 285 bool has_web_ui_bindings() const {
272 return enabled_bindings_ & BINDINGS_POLICY_WEB_UI; 286 return enabled_bindings_ & BINDINGS_POLICY_WEB_UI;
273 } 287 }
274 288
275 bool can_read_raw_cookies() const { 289 bool can_read_raw_cookies() const {
276 return can_read_raw_cookies_; 290 return can_read_raw_cookies_;
277 } 291 }
278 292
279 bool can_send_midi_sysex() const { 293 bool can_send_midi_sysex() const {
280 return can_send_midi_sysex_; 294 return can_send_midi_sysex_;
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 void ChildProcessSecurityPolicyImpl::LockToOrigin(int child_id, 1032 void ChildProcessSecurityPolicyImpl::LockToOrigin(int child_id,
1019 const GURL& gurl) { 1033 const GURL& gurl) {
1020 // "gurl" can be currently empty in some cases, such as file://blah. 1034 // "gurl" can be currently empty in some cases, such as file://blah.
1021 DCHECK(SiteInstanceImpl::GetSiteForURL(NULL, gurl) == gurl); 1035 DCHECK(SiteInstanceImpl::GetSiteForURL(NULL, gurl) == gurl);
1022 base::AutoLock lock(lock_); 1036 base::AutoLock lock(lock_);
1023 SecurityStateMap::iterator state = security_state_.find(child_id); 1037 SecurityStateMap::iterator state = security_state_.find(child_id);
1024 DCHECK(state != security_state_.end()); 1038 DCHECK(state != security_state_.end());
1025 state->second->LockToOrigin(gurl); 1039 state->second->LockToOrigin(gurl);
1026 } 1040 }
1027 1041
1042 ChildProcessSecurityPolicyImpl::CheckOriginLockResult
1043 ChildProcessSecurityPolicyImpl::CheckOriginLock(int child_id,
1044 const GURL& site_url) {
1045 base::AutoLock lock(lock_);
1046 SecurityStateMap::iterator state = security_state_.find(child_id);
1047 if (state == security_state_.end())
1048 return ChildProcessSecurityPolicyImpl::CheckOriginLockResult::NO_LOCK;
1049 return state->second->CheckOriginLock(site_url);
1050 }
1051
1028 void ChildProcessSecurityPolicyImpl::GrantPermissionsForFileSystem( 1052 void ChildProcessSecurityPolicyImpl::GrantPermissionsForFileSystem(
1029 int child_id, 1053 int child_id,
1030 const std::string& filesystem_id, 1054 const std::string& filesystem_id,
1031 int permission) { 1055 int permission) {
1032 base::AutoLock lock(lock_); 1056 base::AutoLock lock(lock_);
1033 1057
1034 SecurityStateMap::iterator state = security_state_.find(child_id); 1058 SecurityStateMap::iterator state = security_state_.find(child_id);
1035 if (state == security_state_.end()) 1059 if (state == security_state_.end())
1036 return; 1060 return;
1037 state->second->GrantPermissionsForFileSystem(filesystem_id, permission); 1061 state->second->GrantPermissionsForFileSystem(filesystem_id, permission);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 } 1112 }
1089 } 1113 }
1090 1114
1091 bool ChildProcessSecurityPolicyImpl::IsIsolatedOrigin( 1115 bool ChildProcessSecurityPolicyImpl::IsIsolatedOrigin(
1092 const url::Origin& origin) { 1116 const url::Origin& origin) {
1093 base::AutoLock lock(lock_); 1117 base::AutoLock lock(lock_);
1094 return isolated_origins_.find(origin) != isolated_origins_.end(); 1118 return isolated_origins_.find(origin) != isolated_origins_.end();
1095 } 1119 }
1096 1120
1097 } // namespace content 1121 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_security_policy_impl.h ('k') | content/browser/isolated_origin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698