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 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1663 void RenderThreadImpl::OnProcessPurgeAndSuspend() { | 1663 void RenderThreadImpl::OnProcessPurgeAndSuspend() { |
1664 ChildThreadImpl::OnProcessPurgeAndSuspend(); | 1664 ChildThreadImpl::OnProcessPurgeAndSuspend(); |
1665 if (!RendererIsHidden()) | 1665 if (!RendererIsHidden()) |
1666 return; | 1666 return; |
1667 | 1667 |
1668 // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled. | 1668 // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled. |
1669 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) | 1669 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) |
1670 return; | 1670 return; |
1671 | 1671 |
1672 if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) { | 1672 if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) { |
1673 // TODO(tasak): After enabling MemoryCoordinator, remove this Notify | 1673 memory_coordinator_->PurgeMemory(); |
bashi
2017/02/02 19:47:00
I think we can remove this comment because we coul
tasak
2017/02/03 04:09:33
I agree with you.
| |
1674 // and follow MemoryCoordinator's request. | |
1675 base::MemoryCoordinatorClientRegistry::GetInstance()->Notify( | |
1676 base::MemoryState::SUSPENDED); | |
1677 } | 1674 } |
1678 // Since purging is not a synchronous task (e.g. v8 GC, oilpan GC, ...), | 1675 // Since purging is not a synchronous task (e.g. v8 GC, oilpan GC, ...), |
1679 // we need to wait until the task is finished. So wait 15 seconds and | 1676 // we need to wait until the task is finished. So wait 15 seconds and |
1680 // update purge+suspend UMA histogram. | 1677 // update purge+suspend UMA histogram. |
1681 // TODO(tasak): use MemoryCoordinator's callback to report purge+suspend | 1678 // TODO(tasak): use MemoryCoordinator's callback to report purge+suspend |
1682 // UMA when MemoryCoordinator is available. | 1679 // UMA when MemoryCoordinator is available. |
1683 GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask( | 1680 GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask( |
1684 FROM_HERE, record_purge_suspend_metric_closure_.callback(), | 1681 FROM_HERE, record_purge_suspend_metric_closure_.callback(), |
1685 base::TimeDelta::FromSeconds(15)); | 1682 base::TimeDelta::FromSeconds(15)); |
1686 } | 1683 } |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2440 } | 2437 } |
2441 } | 2438 } |
2442 | 2439 |
2443 void RenderThreadImpl::OnRendererInterfaceRequest( | 2440 void RenderThreadImpl::OnRendererInterfaceRequest( |
2444 mojom::RendererAssociatedRequest request) { | 2441 mojom::RendererAssociatedRequest request) { |
2445 DCHECK(!renderer_binding_.is_bound()); | 2442 DCHECK(!renderer_binding_.is_bound()); |
2446 renderer_binding_.Bind(std::move(request)); | 2443 renderer_binding_.Bind(std::move(request)); |
2447 } | 2444 } |
2448 | 2445 |
2449 } // namespace content | 2446 } // namespace content |
OLD | NEW |