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

Unified Diff: content/browser/service_worker/service_worker_context_wrapper.cc

Issue 852463002: Keep track of ServiceWorkerContext's BrowserContext and expose it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nullptr
Patch Set: review comments Created 5 years, 11 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/browser/service_worker/service_worker_context_wrapper.cc
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
index 8f9b1db06205cb20187df3d079abd442e3c29f44..57cfee6e93f7d40db699798e64d3b3d02a81050d 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -21,6 +21,7 @@
#include "content/browser/service_worker/service_worker_process_manager.h"
#include "content/browser/service_worker/service_worker_quota_client.h"
#include "content/browser/service_worker/service_worker_request_handler.h"
+#include "content/browser/storage_partition_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/service_worker_context.h"
@@ -74,6 +75,7 @@ ServiceWorkerContextWrapper::ServiceWorkerContextWrapper(
new ObserverListThreadSafe<ServiceWorkerContextObserver>()),
process_manager_(new ServiceWorkerProcessManager(browser_context)),
is_incognito_(false) {
michaeln 2015/01/14 23:36:47 ooops, wait, please initialize storage_partition_(
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() {
@@ -83,6 +85,8 @@ void ServiceWorkerContextWrapper::Init(
const base::FilePath& user_data_directory,
storage::QuotaManagerProxy* quota_manager_proxy,
storage::SpecialStoragePolicy* special_storage_policy) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
is_incognito_ = user_data_directory.empty();
base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager(
@@ -103,6 +107,8 @@ void ServiceWorkerContextWrapper::Init(
void ServiceWorkerContextWrapper::Shutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ storage_partition_ = nullptr;
process_manager_->Shutdown();
BrowserThread::PostTask(
BrowserThread::IO,
@@ -121,6 +127,17 @@ ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() {
return context_core_.get();
}
+StoragePartitionImpl* ServiceWorkerContextWrapper::storage_partition() const {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ return storage_partition_;
+}
+
+void ServiceWorkerContextWrapper::set_storage_partition(
+ StoragePartitionImpl* storage_partition) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ storage_partition_ = storage_partition;
+}
+
static void FinishRegistrationOnIO(
const ServiceWorkerContext::ResultCallback& continuation,
ServiceWorkerStatusCode status,
« no previous file with comments | « content/browser/service_worker/service_worker_context_wrapper.h ('k') | content/browser/storage_partition_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698