Index: content/renderer/render_thread_impl.cc |
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
index c81e108be2fee15ac2e233e91f3a4035618ed098..de436d4698e0ca27fa3d1028a29a2dc6ce9ddcd7 100644 |
--- a/content/renderer/render_thread_impl.cc |
+++ b/content/renderer/render_thread_impl.cc |
@@ -811,6 +811,9 @@ void RenderThreadImpl::Init( |
service_registry()->ConnectToRemoteService( |
mojo::GetProxy(&storage_partition_service_)); |
+ |
+ is_backgrounded_ = false; |
+ is_cache_purged_ = false; |
} |
RenderThreadImpl::~RenderThreadImpl() { |
@@ -1679,10 +1682,24 @@ bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
void RenderThreadImpl::OnProcessBackgrounded(bool backgrounded) { |
ChildThreadImpl::OnProcessBackgrounded(backgrounded); |
- if (backgrounded) |
+ is_backgrounded_ = backgrounded; |
+ if (backgrounded) { |
renderer_scheduler_->OnRendererBackgrounded(); |
- else |
+ } else { |
renderer_scheduler_->OnRendererForegrounded(); |
+ is_cache_purged_ = false; |
+ } |
+} |
+ |
+void RenderThreadImpl::OnProcessPurgeAndSuspend() { |
+ ChildThreadImpl::OnProcessPurgeAndSuspend(); |
+ if (!is_backgrounded_) |
+ return; |
+ if (is_cache_purged_) |
+ return; |
+ // TODO(hajimehoshi): Implement purging e.g. cache (crbug/607077) |
+ is_cache_purged_ = true; |
+ renderer_scheduler_->SuspendRendererWhenBackgrounded(); |
dcheng
2016/05/11 17:42:22
Sorry, to clarify my earlier comment: it seems lik
hajimehoshi
2016/05/12 05:20:14
I understood that checking |is_backgrounded| is no
hajimehoshi
2016/05/12 08:33:18
OK, renamed SuspendRendererWhenBackgrounded to Sus
|
} |
void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) { |