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

Unified Diff: cc/output/output_surface.cc

Issue 1371163002: Fix output surface Memory Dump Provider unregistration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/output_surface.cc
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 53261d3f79490835a76f8fa22749a873b4a0fd08..efa6d13b8d720dda4dd77f1f99c1091bb063c5ff 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -190,11 +190,6 @@ void OutputSurface::SetExternalDrawConstraints(
}
OutputSurface::~OutputSurface() {
- // Unregister any dump provider. Safe to call (no-op) if we have not yet
- // registered.
- base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
- this);
-
if (client_)
DetachFromClientInternal();
}
@@ -226,7 +221,7 @@ bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
// In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
// Don't register a dump provider in these cases.
// TODO(ericrk): Get this working in Android Webview. crbug.com/517156
- if (base::ThreadTaskRunnerHandle::IsSet()) {
+ if (client_ && base::ThreadTaskRunnerHandle::IsSet()) {
// Now that we are on the context thread, register a dump provider with this
// thread's task runner. This will overwrite any previous dump provider
// registered.
@@ -351,6 +346,12 @@ bool OutputSurface::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
void OutputSurface::DetachFromClientInternal() {
DCHECK(client_thread_checker_.CalledOnValidThread());
DCHECK(client_);
+
+ // Unregister any dump provider. Safe to call (no-op) if we have not yet
+ // registered.
+ base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
+ this);
+
if (context_provider_.get()) {
context_provider_->SetLostContextCallback(
ContextProvider::LostContextCallback());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698