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) { |
} |