Chromium Code Reviews| 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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1762 ChildThreadImpl::OnProcessPurgeAndSuspend(); | 1762 ChildThreadImpl::OnProcessPurgeAndSuspend(); |
| 1763 DCHECK(!is_renderer_suspended_); | 1763 DCHECK(!is_renderer_suspended_); |
| 1764 if (!RendererIsHidden()) | 1764 if (!RendererIsHidden()) |
| 1765 return; | 1765 return; |
| 1766 is_renderer_suspended_ = true; | 1766 is_renderer_suspended_ = true; |
| 1767 if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) { | 1767 if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) { |
| 1768 // TODO(tasak): After enabling MemoryCoordinator, remove this Notify | 1768 // TODO(tasak): After enabling MemoryCoordinator, remove this Notify |
| 1769 // and follow MemoryCoordinator's request. | 1769 // and follow MemoryCoordinator's request. |
| 1770 base::MemoryCoordinatorClientRegistry::GetInstance()->Notify( | 1770 base::MemoryCoordinatorClientRegistry::GetInstance()->Notify( |
| 1771 base::MemoryState::SUSPENDED); | 1771 base::MemoryState::SUSPENDED); |
| 1772 RenderThreadImpl::OnSyncMemoryPressure( | |
|
bashi
2016/11/11 07:45:23
nit: Could you add a comment why we call this and
tasak
2016/11/14 06:07:58
Done.
| |
| 1773 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL); | |
|
haraken
2016/11/11 08:58:40
Just to confirm: This triggers Oilpan's GC too, ri
tasak
2016/11/14 06:07:58
Yes.
Manually tested purge+suspend without action_
| |
| 1772 renderer_scheduler_->SuspendRenderer(); | 1774 renderer_scheduler_->SuspendRenderer(); |
| 1773 } | 1775 } |
| 1774 | 1776 |
| 1775 // Since purging is not a synchronous task (e.g. v8 GC, oilpan GC, ...), | 1777 // Since purging is not a synchronous task (e.g. v8 GC, oilpan GC, ...), |
| 1776 // we need to wait until the task is finished. So wait 15 seconds and | 1778 // we need to wait until the task is finished. So wait 15 seconds and |
| 1777 // update purge+suspend UMA histogram. | 1779 // update purge+suspend UMA histogram. |
| 1778 // TODO(tasak): use MemoryCoordinator's callback to report purge+suspend | 1780 // TODO(tasak): use MemoryCoordinator's callback to report purge+suspend |
| 1779 // UMA when MemoryCoordinator is available. | 1781 // UMA when MemoryCoordinator is available. |
| 1780 GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask( | 1782 GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask( |
| 1781 FROM_HERE, record_purge_suspend_metric_closure_.callback(), | 1783 FROM_HERE, record_purge_suspend_metric_closure_.callback(), |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2477 } | 2479 } |
| 2478 } | 2480 } |
| 2479 | 2481 |
| 2480 void RenderThreadImpl::OnRendererInterfaceRequest( | 2482 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2481 mojom::RendererAssociatedRequest request) { | 2483 mojom::RendererAssociatedRequest request) { |
| 2482 DCHECK(!renderer_binding_.is_bound()); | 2484 DCHECK(!renderer_binding_.is_bound()); |
| 2483 renderer_binding_.Bind(std::move(request)); | 2485 renderer_binding_.Bind(std::move(request)); |
| 2484 } | 2486 } |
| 2485 | 2487 |
| 2486 } // namespace content | 2488 } // namespace content |
| OLD | NEW |