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 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 } else { | 1676 } else { |
1677 renderer_scheduler_->OnRendererForegrounded(); | 1677 renderer_scheduler_->OnRendererForegrounded(); |
1678 is_renderer_suspended_ = false; | 1678 is_renderer_suspended_ = false; |
1679 } | 1679 } |
1680 } | 1680 } |
1681 | 1681 |
1682 void RenderThreadImpl::OnProcessPurgeAndSuspend() { | 1682 void RenderThreadImpl::OnProcessPurgeAndSuspend() { |
1683 ChildThreadImpl::OnProcessPurgeAndSuspend(); | 1683 ChildThreadImpl::OnProcessPurgeAndSuspend(); |
1684 if (is_renderer_suspended_) | 1684 if (is_renderer_suspended_) |
1685 return; | 1685 return; |
1686 // TODO(hajimehoshi): Implement purging e.g. cache (crbug/607077) | 1686 // Use ChildMemoryCoordinator to free this renderer's caches as much as |
| 1687 // possible before suspending the renderer. |
| 1688 memory_coordinator::ChildMemoryCoordinatorImpl::GetInstance() |
| 1689 ->PrepareToSuspend(); |
| 1690 |
1687 is_renderer_suspended_ = true; | 1691 is_renderer_suspended_ = true; |
1688 renderer_scheduler_->SuspendRenderer(); | 1692 renderer_scheduler_->SuspendRenderer(); |
1689 } | 1693 } |
1690 | 1694 |
1691 void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) { | 1695 void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) { |
1692 // Debug cases of https://crbug.com/626802. | 1696 // Debug cases of https://crbug.com/626802. |
1693 base::debug::SetCrashKeyValue("newframe_routing_id", | 1697 base::debug::SetCrashKeyValue("newframe_routing_id", |
1694 base::IntToString(params.routing_id)); | 1698 base::IntToString(params.routing_id)); |
1695 base::debug::SetCrashKeyValue("newframe_proxy_id", | 1699 base::debug::SetCrashKeyValue("newframe_proxy_id", |
1696 base::IntToString(params.proxy_routing_id)); | 1700 base::IntToString(params.proxy_routing_id)); |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 if (blink::mainThreadIsolate()) { | 2231 if (blink::mainThreadIsolate()) { |
2228 blink::mainThreadIsolate()->MemoryPressureNotification( | 2232 blink::mainThreadIsolate()->MemoryPressureNotification( |
2229 v8::MemoryPressureLevel::kCritical); | 2233 v8::MemoryPressureLevel::kCritical); |
2230 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2234 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2231 v8::MemoryPressureLevel::kCritical); | 2235 v8::MemoryPressureLevel::kCritical); |
2232 } | 2236 } |
2233 } | 2237 } |
2234 | 2238 |
2235 | 2239 |
2236 } // namespace content | 2240 } // namespace content |
OLD | NEW |