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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 475 |
476 // Count the number of widget hosts for the process, which is equivalent to | 476 // Count the number of widget hosts for the process, which is equivalent to |
477 // views using the process as of this writing. | 477 // views using the process as of this writing. |
478 content::RenderProcessHost::RenderWidgetHostsIterator iter( | 478 content::RenderProcessHost::RenderWidgetHostsIterator iter( |
479 GetProcess()->GetRenderWidgetHostsIterator()); | 479 GetProcess()->GetRenderWidgetHostsIterator()); |
480 for (; !iter.IsAtEnd(); iter.Advance()) | 480 for (; !iter.IsAtEnd(); iter.Advance()) |
481 ++views; | 481 ++views; |
482 | 482 |
483 if (!content::RenderProcessHost::run_renderer_in_process() && | 483 if (!content::RenderProcessHost::run_renderer_in_process() && |
484 process_handle && views <= 1) { | 484 process_handle && views <= 1) { |
485 // We expect the delegate for this RVH to be TabContents, as it is the | 485 // We expect the delegate for this RVH to be WebContents, as it is the |
486 // only class that swaps out render view hosts on navigation. | 486 // only class that swaps out render view hosts on navigation. |
487 DCHECK_EQ(delegate_->GetRenderViewType(), | 487 DCHECK_EQ(delegate_->GetRenderViewType(), |
488 content::VIEW_TYPE_TAB_CONTENTS); | 488 content::VIEW_TYPE_WEB_CONTENTS); |
489 | 489 |
490 // Kill the process only if TabContents sets SuddenTerminationAllowed, | 490 // Kill the process only if WebContents sets SuddenTerminationAllowed, |
491 // which indicates that the timer has expired. | 491 // which indicates that the timer has expired. |
492 // This is not the case if we load data URLs or about:blank. The reason | 492 // This is not the case if we load data URLs or about:blank. The reason |
493 // is that there is no network requests and this code is hit without | 493 // is that there is no network requests and this code is hit without |
494 // setting the unresponsiveness timer. This allows a corner case where a | 494 // setting the unresponsiveness timer. This allows a corner case where a |
495 // navigation to a data URL will leave a process running, if the | 495 // navigation to a data URL will leave a process running, if the |
496 // beforeunload handler completes fine, but the unload handler hangs. | 496 // beforeunload handler completes fine, but the unload handler hangs. |
497 // At this time, the complexity to solve this edge case is not worthwhile. | 497 // At this time, the complexity to solve this edge case is not worthwhile. |
498 if (SuddenTerminationAllowed()) { | 498 if (SuddenTerminationAllowed()) { |
499 base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false); | 499 base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false); |
500 // Log a histogram point to help us diagnose how many of those kills | 500 // Log a histogram point to help us diagnose how many of those kills |
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 is_waiting_for_beforeunload_ack_ = false; | 1814 is_waiting_for_beforeunload_ack_ = false; |
1815 is_waiting_for_unload_ack_ = false; | 1815 is_waiting_for_unload_ack_ = false; |
1816 has_timed_out_on_unload_ = false; | 1816 has_timed_out_on_unload_ = false; |
1817 } | 1817 } |
1818 | 1818 |
1819 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 1819 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
1820 STLDeleteValues(&power_save_blockers_); | 1820 STLDeleteValues(&power_save_blockers_); |
1821 } | 1821 } |
1822 | 1822 |
1823 } // namespace content | 1823 } // namespace content |
OLD | NEW |