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 aa47e2fd677bad9d115abb27209433292689fe57..527855aeb41792f5c275dd516994c21cb1fa5912 100644 |
--- a/content/common/gpu/client/gpu_channel_host.cc |
+++ b/content/common/gpu/client/gpu_channel_host.cc |
@@ -47,7 +47,7 @@ scoped_refptr<GpuChannelHost> GpuChannelHost::Create( |
const IPC::ChannelHandle& channel_handle, |
base::WaitableEvent* shutdown_event, |
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { |
- DCHECK(factory->IsMainThread()); |
+ DCHECK(factory->GetMainTaskRunner()->BelongsToCurrentThread()); |
scoped_refptr<GpuChannelHost> host = |
new GpuChannelHost(factory, gpu_info, gpu_memory_buffer_manager); |
host->Connect(channel_handle, shutdown_event); |
@@ -105,7 +105,7 @@ bool GpuChannelHost::Send(IPC::Message* msg) { |
// |
// TODO: Can we just always use sync_filter_ since we setup the channel |
// without a main listener? |
- if (factory_->IsMainThread()) { |
+ if (factory_->GetMainTaskRunner()->BelongsToCurrentThread()) { |
// http://crbug.com/125264 |
base::ThreadRestrictions::ScopedAllowWait allow_wait; |
bool result = channel_->Send(message.release()); |
@@ -274,8 +274,12 @@ void GpuChannelHost::DestroyCommandBuffer( |
void GpuChannelHost::DestroyChannel() { |
// channel_ must be destroyed on the main thread. |
- if (channel_.get() && !factory_->IsMainThread()) |
- factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release()); |
+ if (channel_.get()) { |
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner = |
+ factory_->GetMainTaskRunner(); |
+ if (!main_task_runner->RunsTasksOnCurrentThread()) |
+ main_task_runner->DeleteSoon(FROM_HERE, channel_.release()); |
+ } |
channel_.reset(); |
} |