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

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

Issue 1779353003: service worker: Fix valgrind errors on unit_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1dafcef098b02b8f0fef19f5a4fd82da70792057..770a78a054a5244a9e88bb2d28636eb56b38e516 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -101,6 +101,8 @@ ServiceWorkerContextWrapper::ServiceWorkerContextWrapper(
}
ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() {
+ DCHECK(!resource_context_);
+ DCHECK(!request_context_getter_);
}
void ServiceWorkerContextWrapper::Init(
@@ -143,7 +145,6 @@ void ServiceWorkerContextWrapper::InitializeResourceContext(
void ServiceWorkerContextWrapper::OnContextShuttingDown() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- request_context_getter_->RemoveObserver(this);
// OnContextShuttingDown is called when the ProfileIOData (ResourceContext) is
// shutting down, so call ShutdownOnIO() to clear resource_context_.
@@ -698,6 +699,10 @@ void ServiceWorkerContextWrapper::InitInternal(
void ServiceWorkerContextWrapper::ShutdownOnIO() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ // Can be null in tests.
+ if (request_context_getter_)
+ request_context_getter_->RemoveObserver(this);
+ request_context_getter_ = nullptr;
resource_context_ = nullptr;
context_core_.reset();
}
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698