OLD | NEW |
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/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 SiteInstance* RenderViewHostImpl::GetSiteInstance() const { | 247 SiteInstance* RenderViewHostImpl::GetSiteInstance() const { |
248 return instance_.get(); | 248 return instance_.get(); |
249 } | 249 } |
250 | 250 |
251 bool RenderViewHostImpl::CreateRenderView( | 251 bool RenderViewHostImpl::CreateRenderView( |
252 const base::string16& frame_name, | 252 const base::string16& frame_name, |
253 int opener_route_id, | 253 int opener_route_id, |
254 int proxy_route_id, | 254 int proxy_route_id, |
255 int32 max_page_id, | 255 int32 max_page_id, |
256 bool window_was_created_with_opener) { | 256 bool window_was_created_with_opener) { |
257 TRACE_EVENT0("renderer_host", "RenderViewHostImpl::CreateRenderView"); | 257 TRACE_EVENT0("renderer_host,navigation", |
| 258 "RenderViewHostImpl::CreateRenderView"); |
258 DCHECK(!IsRenderViewLive()) << "Creating view twice"; | 259 DCHECK(!IsRenderViewLive()) << "Creating view twice"; |
259 | 260 |
260 // The process may (if we're sharing a process with another host that already | 261 // The process may (if we're sharing a process with another host that already |
261 // initialized it) or may not (we have our own process or the old process | 262 // initialized it) or may not (we have our own process or the old process |
262 // crashed) have been initialized. Calling Init multiple times will be | 263 // crashed) have been initialized. Calling Init multiple times will be |
263 // ignored, so this is safe. | 264 // ignored, so this is safe. |
264 if (!GetProcess()->Init()) | 265 if (!GetProcess()->Init()) |
265 return false; | 266 return false; |
266 DCHECK(GetProcess()->HasConnection()); | 267 DCHECK(GetProcess()->HasConnection()); |
267 DCHECK(GetProcess()->GetBrowserContext()); | 268 DCHECK(GetProcess()->GetBrowserContext()); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } else { | 474 } else { |
474 prefs.v8_cache_options = V8_CACHE_OPTIONS_OFF; | 475 prefs.v8_cache_options = V8_CACHE_OPTIONS_OFF; |
475 } | 476 } |
476 } | 477 } |
477 | 478 |
478 GetContentClient()->browser()->OverrideWebkitPrefs(this, url, &prefs); | 479 GetContentClient()->browser()->OverrideWebkitPrefs(this, url, &prefs); |
479 return prefs; | 480 return prefs; |
480 } | 481 } |
481 | 482 |
482 void RenderViewHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { | 483 void RenderViewHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { |
483 TRACE_EVENT0("renderer_host", "RenderViewHostImpl::Navigate"); | 484 TRACE_EVENT0("renderer_host,navigation", "RenderViewHostImpl::Navigate"); |
484 delegate_->GetFrameTree()->GetMainFrame()->Navigate(params); | 485 delegate_->GetFrameTree()->GetMainFrame()->Navigate(params); |
485 } | 486 } |
486 | 487 |
487 void RenderViewHostImpl::NavigateToURL(const GURL& url) { | 488 void RenderViewHostImpl::NavigateToURL(const GURL& url) { |
488 delegate_->GetFrameTree()->GetMainFrame()->NavigateToURL(url); | 489 delegate_->GetFrameTree()->GetMainFrame()->NavigateToURL(url); |
489 } | 490 } |
490 | 491 |
491 void RenderViewHostImpl::SuppressDialogsUntilSwapOut() { | 492 void RenderViewHostImpl::SuppressDialogsUntilSwapOut() { |
492 Send(new ViewMsg_SuppressDialogsUntilSwapOut(GetRoutingID())); | 493 Send(new ViewMsg_SuppressDialogsUntilSwapOut(GetRoutingID())); |
493 } | 494 } |
494 | 495 |
495 void RenderViewHostImpl::OnSwappedOut(bool timed_out) { | 496 void RenderViewHostImpl::OnSwappedOut(bool timed_out) { |
496 // Ignore spurious swap out ack. | 497 // Ignore spurious swap out ack. |
497 if (!IsWaitingForUnloadACK()) | 498 if (!IsWaitingForUnloadACK()) |
498 return; | 499 return; |
| 500 |
| 501 TRACE_EVENT0("navigation", "RenderViewHostImpl::OnSwappedOut"); |
499 unload_event_monitor_timeout_->Stop(); | 502 unload_event_monitor_timeout_->Stop(); |
500 if (timed_out) { | 503 if (timed_out) { |
501 base::ProcessHandle process_handle = GetProcess()->GetHandle(); | 504 base::ProcessHandle process_handle = GetProcess()->GetHandle(); |
502 int views = 0; | 505 int views = 0; |
503 | 506 |
504 // Count the number of active widget hosts for the process, which | 507 // Count the number of active widget hosts for the process, which |
505 // is equivalent to views using the process as of this writing. | 508 // is equivalent to views using the process as of this writing. |
506 scoped_ptr<RenderWidgetHostIterator> widgets( | 509 scoped_ptr<RenderWidgetHostIterator> widgets( |
507 RenderWidgetHost::GetRenderWidgetHosts()); | 510 RenderWidgetHost::GetRenderWidgetHosts()); |
508 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 511 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
(...skipping 16 matching lines...) Expand all Loading... |
525 // diagnose the kill rate and investigate if separate timer is needed. | 528 // diagnose the kill rate and investigate if separate timer is needed. |
526 // http://crbug.com/104346. | 529 // http://crbug.com/104346. |
527 | 530 |
528 // Log a histogram point to help us diagnose how many of those kills | 531 // Log a histogram point to help us diagnose how many of those kills |
529 // we have performed. 1 is the enum value for RendererType Normal for | 532 // we have performed. 1 is the enum value for RendererType Normal for |
530 // the histogram. | 533 // the histogram. |
531 UMA_HISTOGRAM_PERCENTAGE( | 534 UMA_HISTOGRAM_PERCENTAGE( |
532 "BrowserRenderProcessHost.ChildKillsUnresponsive", 1); | 535 "BrowserRenderProcessHost.ChildKillsUnresponsive", 1); |
533 } | 536 } |
534 } | 537 } |
| 538 // This is going to be incorrect for subframes and will only hit if |
| 539 // --site-per-process is specified. |
| 540 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); |
535 } | 541 } |
536 | 542 |
537 switch (rvh_state_) { | 543 switch (rvh_state_) { |
538 case STATE_PENDING_SWAP_OUT: | 544 case STATE_PENDING_SWAP_OUT: |
539 SetState(STATE_SWAPPED_OUT); | 545 SetState(STATE_SWAPPED_OUT); |
540 break; | 546 break; |
541 case STATE_PENDING_SHUTDOWN: | 547 case STATE_PENDING_SHUTDOWN: |
542 DCHECK(!pending_shutdown_on_swap_out_.is_null()); | 548 DCHECK(!pending_shutdown_on_swap_out_.is_null()); |
543 pending_shutdown_on_swap_out_.Run(); | 549 pending_shutdown_on_swap_out_.Run(); |
544 break; | 550 break; |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1497 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1492 | 1498 |
1493 frame_tree->ResetForMainFrameSwap(); | 1499 frame_tree->ResetForMainFrameSwap(); |
1494 } | 1500 } |
1495 | 1501 |
1496 void RenderViewHostImpl::SelectWordAroundCaret() { | 1502 void RenderViewHostImpl::SelectWordAroundCaret() { |
1497 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1503 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1498 } | 1504 } |
1499 | 1505 |
1500 } // namespace content | 1506 } // namespace content |
OLD | NEW |