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

Unified Diff: chrome/browser/memory/tab_manager.cc

Issue 2574663002: TabManager checks if ServiceWorker exists on the suspending process (Closed)
Patch Set: Created 4 years 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 | « no previous file | content/browser/service_worker/embedded_worker_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory/tab_manager.cc
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc
index b6062ab348a7fc4de577743cd6eddddf47e7aff5..04c6a4bf10f93f2f874c8c787a639687118ad845 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -51,6 +51,8 @@
#include "content/public/browser/memory_pressure_controller.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/service_worker_context.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_importance_signals.h"
@@ -459,6 +461,14 @@ bool TabManager::CanSuspendBackgroundedRenderer(int render_process_id) {
return false;
if (IsMediaTab(web_contents))
return false;
+
+ content::ServiceWorkerContext* sw_context =
+ content::BrowserContext::GetDefaultStoragePartition(
+ web_contents->GetBrowserContext())->GetServiceWorkerContext();
+ DCHECK(!sw_context);
+ // -- THIS MUST BE CALLED ON THE IO THREAD --
+ if (sw_context->IsServiceWorkerExistsOnProcess(render_process_id))
shimazu 2016/12/13 04:16:36 This is a problem. Do you have any good idea to ca
nhiroki 2016/12/13 04:33:59 Are we on the UI thread here? If so, we could use
nhiroki 2016/12/13 04:34:56 (without thread hopping)
bashi 2016/12/13 04:40:17 Thank you for the info. Yes, we may want to use wo
+ return false;
}
return true;
}
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698