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

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 1134113002: content/common: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CrOS build. 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
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/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (gpu_channel_) { 298 if (gpu_channel_) {
299 gpu_channel_->DestroyChannel(); 299 gpu_channel_->DestroyChannel();
300 gpu_channel_ = NULL; 300 gpu_channel_ = NULL;
301 } 301 }
302 } 302 }
303 303
304 bool BrowserGpuChannelHostFactory::IsMainThread() { 304 bool BrowserGpuChannelHostFactory::IsMainThread() {
305 return BrowserThread::CurrentlyOn(BrowserThread::UI); 305 return BrowserThread::CurrentlyOn(BrowserThread::UI);
306 } 306 }
307 307
308 scoped_refptr<base::MessageLoopProxy> 308 scoped_refptr<base::SingleThreadTaskRunner>
309 BrowserGpuChannelHostFactory::GetIOLoopProxy() { 309 BrowserGpuChannelHostFactory::GetIOThreadTaskRunner() {
310 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 310 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
311 } 311 }
312 312
313 scoped_ptr<base::SharedMemory> 313 scoped_ptr<base::SharedMemory>
314 BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) { 314 BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) {
315 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory()); 315 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
316 if (!shm->CreateAnonymous(size)) 316 if (!shm->CreateAnonymous(size))
317 return scoped_ptr<base::SharedMemory>(); 317 return scoped_ptr<base::SharedMemory>();
318 return shm.Pass(); 318 return shm.Pass();
319 } 319 }
(...skipping 26 matching lines...) Expand all
346 CreateRequest* request, CreateCommandBufferResult result) { 346 CreateRequest* request, CreateCommandBufferResult result) {
347 request->result = result; 347 request->result = result;
348 request->event.Signal(); 348 request->event.Signal();
349 } 349 }
350 350
351 CreateCommandBufferResult BrowserGpuChannelHostFactory::CreateViewCommandBuffer( 351 CreateCommandBufferResult BrowserGpuChannelHostFactory::CreateViewCommandBuffer(
352 int32 surface_id, 352 int32 surface_id,
353 const GPUCreateCommandBufferConfig& init_params, 353 const GPUCreateCommandBufferConfig& init_params,
354 int32 route_id) { 354 int32 route_id) {
355 CreateRequest request(route_id); 355 CreateRequest request(route_id);
356 GetIOLoopProxy()->PostTask(FROM_HERE, base::Bind( 356 GetIOThreadTaskRunner()->PostTask(
357 &BrowserGpuChannelHostFactory::CreateViewCommandBufferOnIO, 357 FROM_HERE,
358 base::Unretained(this), 358 base::Bind(&BrowserGpuChannelHostFactory::CreateViewCommandBufferOnIO,
359 &request, 359 base::Unretained(this), &request, surface_id, init_params));
360 surface_id,
361 init_params));
362 // TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed. 360 // TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed.
363 tracked_objects::ScopedTracker tracking_profile( 361 tracked_objects::ScopedTracker tracking_profile(
364 FROM_HERE_WITH_EXPLICIT_FUNCTION( 362 FROM_HERE_WITH_EXPLICIT_FUNCTION(
365 "125248 BrowserGpuChannelHostFactory::CreateViewCommandBuffer")); 363 "125248 BrowserGpuChannelHostFactory::CreateViewCommandBuffer"));
366 364
367 // We're blocking the UI thread, which is generally undesirable. 365 // We're blocking the UI thread, which is generally undesirable.
368 // In this case we need to wait for this before we can show any UI /anyway/, 366 // In this case we need to wait for this before we can show any UI /anyway/,
369 // so it won't cause additional jank. 367 // so it won't cause additional jank.
370 // TODO(piman): Make this asynchronous (http://crbug.com/125248). 368 // TODO(piman): Make this asynchronous (http://crbug.com/125248).
371 TRACE_EVENT0("browser", 369 TRACE_EVENT0("browser",
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 DCHECK_CURRENTLY_ON(BrowserThread::IO); 558 DCHECK_CURRENTLY_ON(BrowserThread::IO);
561 559
562 CreateGpuMemoryBufferCallbackMap::iterator iter = 560 CreateGpuMemoryBufferCallbackMap::iterator iter =
563 create_gpu_memory_buffer_requests_.find(request_id); 561 create_gpu_memory_buffer_requests_.find(request_id);
564 DCHECK(iter != create_gpu_memory_buffer_requests_.end()); 562 DCHECK(iter != create_gpu_memory_buffer_requests_.end());
565 iter->second.Run(handle); 563 iter->second.Run(handle);
566 create_gpu_memory_buffer_requests_.erase(iter); 564 create_gpu_memory_buffer_requests_.erase(iter);
567 } 565 }
568 566
569 } // namespace content 567 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.h ('k') | content/common/database_connections_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698