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

Unified Diff: content/browser/gpu/browser_gpu_channel_host_factory.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
Index: content/browser/gpu/browser_gpu_channel_host_factory.cc
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index 9edb9677c56abc2b4801d5aa62193d362236b95c..d7c34f5f8c9abea664e7c3b63ea84812379d2d54 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -281,6 +281,7 @@ uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget() {
BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory()
: gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
+ main_task_runner_(base::MessageLoopProxy::current()),
shutdown_event_(new base::WaitableEvent(true, false)),
gpu_memory_buffer_manager_(
new BrowserGpuMemoryBufferManager(this, gpu_client_id_)),
@@ -289,7 +290,7 @@ BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory()
}
BrowserGpuChannelHostFactory::~BrowserGpuChannelHostFactory() {
- DCHECK(IsMainThread());
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
if (pending_request_.get())
pending_request_->Cancel();
for (size_t n = 0; n < established_callbacks_.size(); n++)
@@ -297,12 +298,9 @@ BrowserGpuChannelHostFactory::~BrowserGpuChannelHostFactory() {
shutdown_event_->Signal();
}
-bool BrowserGpuChannelHostFactory::IsMainThread() {
- return BrowserThread::CurrentlyOn(BrowserThread::UI);
-}
-
-base::MessageLoop* BrowserGpuChannelHostFactory::GetMainLoop() {
- return BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::UI);
+scoped_refptr<base::SingleThreadTaskRunner>
+BrowserGpuChannelHostFactory::GetMainTaskRunner() {
+ return main_task_runner_;
}
scoped_refptr<base::MessageLoopProxy>
@@ -421,7 +419,7 @@ GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() {
}
void BrowserGpuChannelHostFactory::GpuChannelEstablished() {
- DCHECK(IsMainThread());
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
DCHECK(pending_request_.get());
if (pending_request_->channel_handle().name.empty()) {
DCHECK(!gpu_channel_.get());
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.h ('k') | content/common/gpu/client/gpu_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698