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

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

Issue 498883002: Add/improve tracing in navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes based on Charlie's review Created 6 years, 3 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 | Annotate | Revision Log
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/site_instance_impl.h" 5 #include "content/browser/site_instance_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/browsing_instance.h" 8 #include "content/browser/browsing_instance.h"
9 #include "content/browser/child_process_security_policy_impl.h" 9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/frame_host/debug_urls.h" 10 #include "content/browser/frame_host/debug_urls.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 process_->AddObserver(this); 113 process_->AddObserver(this);
114 114
115 // If we are using process-per-site, we need to register this process 115 // If we are using process-per-site, we need to register this process
116 // for the current site so that we can find it again. (If no site is set 116 // for the current site so that we can find it again. (If no site is set
117 // at this time, we will register it in SetSite().) 117 // at this time, we will register it in SetSite().)
118 if (use_process_per_site) { 118 if (use_process_per_site) {
119 RenderProcessHostImpl::RegisterProcessHostForSite(browser_context, 119 RenderProcessHostImpl::RegisterProcessHostForSite(browser_context,
120 process_, site_); 120 process_, site_);
121 } 121 }
122 122
123 TRACE_EVENT2("navigation", "SiteInstanceImpl::GetProcess",
124 "site id", id_, "process id", process_->GetID());
123 GetContentClient()->browser()->SiteInstanceGotProcess(this); 125 GetContentClient()->browser()->SiteInstanceGotProcess(this);
124 126
125 if (has_site_) 127 if (has_site_)
126 LockToOrigin(); 128 LockToOrigin();
127 } 129 }
128 DCHECK(process_); 130 DCHECK(process_);
129 131
130 return process_; 132 return process_;
131 } 133 }
132 134
133 void SiteInstanceImpl::SetSite(const GURL& url) { 135 void SiteInstanceImpl::SetSite(const GURL& url) {
136 TRACE_EVENT2("navigation", "SiteInstanceImpl::SetSite",
137 "site id", id_, "url", url.possibly_invalid_spec());
134 // A SiteInstance's site should not change. 138 // A SiteInstance's site should not change.
135 // TODO(creis): When following links or script navigations, we can currently 139 // TODO(creis): When following links or script navigations, we can currently
136 // render pages from other sites in this SiteInstance. This will eventually 140 // render pages from other sites in this SiteInstance. This will eventually
137 // be fixed, but until then, we should still not set the site of a 141 // be fixed, but until then, we should still not set the site of a
138 // SiteInstance more than once. 142 // SiteInstance more than once.
139 DCHECK(!has_site_); 143 DCHECK(!has_site_);
140 144
141 // Remember that this SiteInstance has been used to load a URL, even if the 145 // Remember that this SiteInstance has been used to load a URL, even if the
142 // URL is invalid. 146 // URL is invalid.
143 has_site_ = true; 147 has_site_ = true;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 *base::CommandLine::ForCurrentProcess(); 345 *base::CommandLine::ForCurrentProcess();
342 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || 346 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) ||
343 command_line.HasSwitch(switches::kSitePerProcess)) { 347 command_line.HasSwitch(switches::kSitePerProcess)) {
344 ChildProcessSecurityPolicyImpl* policy = 348 ChildProcessSecurityPolicyImpl* policy =
345 ChildProcessSecurityPolicyImpl::GetInstance(); 349 ChildProcessSecurityPolicyImpl::GetInstance();
346 policy->LockToOrigin(process_->GetID(), site_); 350 policy->LockToOrigin(process_->GetID(), site_);
347 } 351 }
348 } 352 }
349 353
350 } // namespace content 354 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698