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

Side by Side Diff: content/renderer/render_thread_impl.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 unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 Send(new ViewHostMsg_ResolveProxy(url, &result, proxy_list)); 1262 Send(new ViewHostMsg_ResolveProxy(url, &result, proxy_list));
1263 return result; 1263 return result;
1264 } 1264 }
1265 1265
1266 void RenderThreadImpl::PostponeIdleNotification() { 1266 void RenderThreadImpl::PostponeIdleNotification() {
1267 idle_notifications_to_skip_ = 2; 1267 idle_notifications_to_skip_ = 2;
1268 } 1268 }
1269 1269
1270 scoped_refptr<media::GpuVideoAcceleratorFactories> 1270 scoped_refptr<media::GpuVideoAcceleratorFactories>
1271 RenderThreadImpl::GetGpuFactories() { 1271 RenderThreadImpl::GetGpuFactories() {
1272 DCHECK(IsMainThread()); 1272 DCHECK(GetMainTaskRunner()->BelongsToCurrentThread());
1273 1273
1274 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); 1274 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel();
1275 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 1275 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
1276 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories; 1276 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories;
1277 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = 1277 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner =
1278 GetMediaThreadTaskRunner(); 1278 GetMediaThreadTaskRunner();
1279 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { 1279 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
1280 if (!gpu_va_context_provider_.get() || 1280 if (!gpu_va_context_provider_.get() ||
1281 gpu_va_context_provider_->DestroyedOnMainThread()) { 1281 gpu_va_context_provider_->DestroyedOnMainThread()) {
1282 if (!gpu_channel_host.get()) { 1282 if (!gpu_channel_host.get()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 gpu_channel_host.get(), 1316 gpu_channel_host.get(),
1317 attributes, 1317 attributes,
1318 lose_context_when_out_of_memory, 1318 lose_context_when_out_of_memory,
1319 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), 1319 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"),
1320 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), 1320 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
1321 NULL)); 1321 NULL));
1322 } 1322 }
1323 1323
1324 scoped_refptr<cc_blink::ContextProviderWebContext> 1324 scoped_refptr<cc_blink::ContextProviderWebContext>
1325 RenderThreadImpl::SharedMainThreadContextProvider() { 1325 RenderThreadImpl::SharedMainThreadContextProvider() {
1326 DCHECK(IsMainThread()); 1326 DCHECK(GetMainTaskRunner()->BelongsToCurrentThread());
1327 if (!shared_main_thread_contexts_.get() || 1327 if (!shared_main_thread_contexts_.get() ||
1328 shared_main_thread_contexts_->DestroyedOnMainThread()) { 1328 shared_main_thread_contexts_->DestroyedOnMainThread()) {
1329 shared_main_thread_contexts_ = NULL; 1329 shared_main_thread_contexts_ = NULL;
1330 #if defined(OS_ANDROID) 1330 #if defined(OS_ANDROID)
1331 if (SynchronousCompositorFactory* factory = 1331 if (SynchronousCompositorFactory* factory =
1332 SynchronousCompositorFactory::GetInstance()) { 1332 SynchronousCompositorFactory::GetInstance()) {
1333 shared_main_thread_contexts_ = factory->CreateOffscreenContextProvider( 1333 shared_main_thread_contexts_ = factory->CreateOffscreenContextProvider(
1334 GetOffscreenAttribs(), "Offscreen-MainThread"); 1334 GetOffscreenAttribs(), "Offscreen-MainThread");
1335 } 1335 }
1336 #endif 1336 #endif
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 } 1464 }
1465 1465
1466 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() { 1466 cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() {
1467 return compositor_task_graph_runner_.get(); 1467 return compositor_task_graph_runner_.get();
1468 } 1468 }
1469 1469
1470 bool RenderThreadImpl::IsGatherPixelRefsEnabled() { 1470 bool RenderThreadImpl::IsGatherPixelRefsEnabled() {
1471 return is_gather_pixel_refs_enabled_; 1471 return is_gather_pixel_refs_enabled_;
1472 } 1472 }
1473 1473
1474 bool RenderThreadImpl::IsMainThread() { 1474 scoped_refptr<base::SingleThreadTaskRunner>
1475 return !!current(); 1475 RenderThreadImpl::GetMainTaskRunner() {
1476 } 1476 return message_loop()->task_runner();
1477
1478 base::MessageLoop* RenderThreadImpl::GetMainLoop() {
1479 return message_loop();
1480 } 1477 }
1481 1478
1482 scoped_refptr<base::MessageLoopProxy> RenderThreadImpl::GetIOLoopProxy() { 1479 scoped_refptr<base::MessageLoopProxy> RenderThreadImpl::GetIOLoopProxy() {
1483 return io_message_loop_proxy_; 1480 return io_message_loop_proxy_;
1484 } 1481 }
1485 1482
1486 scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( 1483 scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory(
1487 size_t size) { 1484 size_t size) {
1488 return scoped_ptr<base::SharedMemory>( 1485 return scoped_ptr<base::SharedMemory>(
1489 HostAllocateSharedMemoryBuffer(size)); 1486 HostAllocateSharedMemoryBuffer(size));
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 } 1892 }
1896 1893
1897 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { 1894 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() {
1898 size_t erased = 1895 size_t erased =
1899 RenderThreadImpl::current()->pending_render_frame_connects_.erase( 1896 RenderThreadImpl::current()->pending_render_frame_connects_.erase(
1900 routing_id_); 1897 routing_id_);
1901 DCHECK_EQ(1u, erased); 1898 DCHECK_EQ(1u, erased);
1902 } 1899 }
1903 1900
1904 } // namespace content 1901 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698