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

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 haraken'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
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/test/fake_renderer_scheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 795e8cf02aa0fd970425b9f434fee33c8c173294..7a2915da12e322c3d0844c402adb657bc8749a29 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -822,6 +822,8 @@ void RenderThreadImpl::Init(
service_registry()->ConnectToRemoteService(
mojo::GetProxy(&storage_partition_service_));
+
+ is_renderer_suspended_ = false;
}
RenderThreadImpl::~RenderThreadImpl() {
@@ -1707,10 +1709,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_renderer_suspended_ = false;
+ }
+}
+
+void RenderThreadImpl::OnProcessPurgeAndSuspend() {
+ ChildThreadImpl::OnProcessPurgeAndSuspend();
+ if (is_renderer_suspended_)
+ return;
+ // TODO(hajimehoshi): Implement purging e.g. cache (crbug/607077)
+ is_renderer_suspended_ = true;
+ renderer_scheduler_->SuspendRenderer();
}
void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) {
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/test/fake_renderer_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698