Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1664)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 1914143002: Experimental 'purging and suspending' backgrounded tabs behind the flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on dcheng@'s review Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..cb92fc64457ec55190201ffa036cdde30d9e406c 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -811,6 +811,8 @@ void RenderThreadImpl::Init(
service_registry()->ConnectToRemoteService(
mojo::GetProxy(&storage_partition_service_));
+
+ is_cache_purged_ = false;
}
RenderThreadImpl::~RenderThreadImpl() {
@@ -1679,10 +1681,21 @@ bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
void RenderThreadImpl::OnProcessBackgrounded(bool backgrounded) {
ChildThreadImpl::OnProcessBackgrounded(backgrounded);
- if (backgrounded)
+ if (backgrounded) {
renderer_scheduler_->OnRendererBackgrounded();
- else
+ } else {
renderer_scheduler_->OnRendererForegrounded();
+ is_cache_purged_ = false;
+ }
+}
+
+void RenderThreadImpl::OnProcessPurgeAndSuspend() {
+ ChildThreadImpl::OnProcessPurgeAndSuspend();
+ if (is_cache_purged_)
+ return;
+ // TODO(hajimehoshi): Implement purging e.g. cache (crbug/607077)
+ is_cache_purged_ = true;
+ renderer_scheduler_->SuspendRendererWhenBackgrounded();
dcheng 2016/05/10 16:28:06 Will we ever send a "purge and suspend" to a non-b
hajimehoshi 2016/05/11 07:23:31 Good point. Done by adding |is_backgrounded_|.
}
void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) {

Powered by Google App Engine
This is Rietveld 408576698