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

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

Issue 1117183006: Remove BrowserGpuChannelHostFactory usage of UnsafeGetMessageLoopForThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « content/common/gpu/client/gpu_channel_host.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698