diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-12 17:55:37 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-12 17:55:37 +0000 |
commit | 0f19f563ad5449d28b5764337cb1bbef0e5f83a3 (patch) | |
tree | aed1a9811af865a9ae2cc211f4f172c35222eb79 /chrome/browser/renderer_security_policy.cc | |
parent | 31663dd403b2e4b69a0ec411c377a8c8642cf7d8 (diff) | |
download | chromium_src-0f19f563ad5449d28b5764337cb1bbef0e5f83a3.zip chromium_src-0f19f563ad5449d28b5764337cb1bbef0e5f83a3.tar.gz chromium_src-0f19f563ad5449d28b5764337cb1bbef0e5f83a3.tar.bz2 |
Fix a few places that wind up using Lock recursively.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_security_policy.cc')
-rw-r--r-- | chrome/browser/renderer_security_policy.cc | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/chrome/browser/renderer_security_policy.cc b/chrome/browser/renderer_security_policy.cc index dcffa38..d4a8d965 100644 --- a/chrome/browser/renderer_security_policy.cc +++ b/chrome/browser/renderer_security_policy.cc @@ -166,7 +166,6 @@ bool RendererSecurityPolicy::IsPseudoScheme(const std::string& scheme) { } void RendererSecurityPolicy::GrantRequestURL(int renderer_id, const GURL& url) { - AutoLock lock(lock_); if (!url.is_valid()) return; // Can't grant the capability to request invalid URLs. @@ -188,13 +187,16 @@ void RendererSecurityPolicy::GrantRequestURL(int renderer_id, const GURL& url) { return; // Can't grant the capability to request pseudo schemes. } - SecurityStateMap::iterator state = security_state_.find(renderer_id); - if (state == security_state_.end()) - return; + { + AutoLock lock(lock_); + SecurityStateMap::iterator state = security_state_.find(renderer_id); + if (state == security_state_.end()) + return; - // If the renderer has been commanded to request a scheme, then we grant - // it the capability to request URLs of that scheme. - state->second->GrantScheme(url.scheme()); + // If the renderer has been commanded to request a scheme, then we grant + // it the capability to request URLs of that scheme. + state->second->GrantScheme(url.scheme()); + } } void RendererSecurityPolicy::GrantUploadFile(int renderer_id, @@ -237,8 +239,6 @@ void RendererSecurityPolicy::GrantDOMUIBindings(int renderer_id) { } bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) { - AutoLock lock(lock_); - if (!url.is_valid()) return false; // Can't request invalid URLs. @@ -266,13 +266,17 @@ bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) { if (!URLRequest::IsHandledURL(url)) return true; // This URL request is destined for ShellExecute. - SecurityStateMap::iterator state = security_state_.find(renderer_id); - if (state == security_state_.end()) - return false; + { + AutoLock lock(lock_); + + SecurityStateMap::iterator state = security_state_.find(renderer_id); + if (state == security_state_.end()) + return false; - // Otherwise, we consult the renderer's security state to see if it is - // allowed to request the URL. - return state->second->CanRequestURL(url); + // Otherwise, we consult the renderer's security state to see if it is + // allowed to request the URL. + return state->second->CanRequestURL(url); + } } bool RendererSecurityPolicy::CanUploadFile(int renderer_id, |