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

Unified Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 583043005: Pending tasks in a message loop should be deleted before shutting down Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/common/gpu/client/gpu_channel_host.cc
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index d0ceecd26211e2c255ad48504a0c40dd459782a7..bb38b22462c17ddc83b43da3619d47ba46a1b27d 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -247,6 +247,13 @@ void GpuChannelHost::DestroyCommandBuffer(
delete command_buffer;
}
+void GpuChannelHost::DestroyChannel() {
+ // channel_ must be destroyed on the main thread.
+ if (channel_.get() && !factory_->IsMainThread())
+ factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release());
+ channel_.reset();
+}
+
void GpuChannelHost::AddRoute(
int route_id, base::WeakPtr<IPC::Listener> listener) {
DCHECK(MessageLoopProxy::current().get());
@@ -335,12 +342,9 @@ int32 GpuChannelHost::GenerateRouteID() {
}
GpuChannelHost::~GpuChannelHost() {
- // channel_ must be destroyed on the main thread.
- if (!factory_->IsMainThread())
- factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release());
+ DestroyChannel();
}
-
GpuChannelHost::MessageFilter::MessageFilter()
: lost_(false) {
}

Powered by Google App Engine
This is Rietveld 408576698