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 77ef8752afc9ffdf8411da6f78b178de32bc3838..83bbad180c0f8a69a7ce558370610748526b6ef8 100644 |
--- a/content/common/gpu/client/gpu_channel_host.cc |
+++ b/content/common/gpu/client/gpu_channel_host.cc |
@@ -232,6 +232,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()); |
@@ -311,12 +318,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) { |
} |