| OLD | NEW |
| 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 Loading... |
| 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 base::MessageLoop* BrowserGpuChannelHostFactory::GetMainLoop() { | |
| 309 return BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::UI); | |
| 310 } | |
| 311 | |
| 312 scoped_refptr<base::MessageLoopProxy> | 308 scoped_refptr<base::MessageLoopProxy> |
| 313 BrowserGpuChannelHostFactory::GetIOLoopProxy() { | 309 BrowserGpuChannelHostFactory::GetIOLoopProxy() { |
| 314 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 310 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 315 } | 311 } |
| 316 | 312 |
| 317 scoped_ptr<base::SharedMemory> | 313 scoped_ptr<base::SharedMemory> |
| 318 BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) { | 314 BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) { |
| 319 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory()); | 315 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory()); |
| 320 if (!shm->CreateAnonymous(size)) | 316 if (!shm->CreateAnonymous(size)) |
| 321 return scoped_ptr<base::SharedMemory>(); | 317 return scoped_ptr<base::SharedMemory>(); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 560 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 565 | 561 |
| 566 CreateGpuMemoryBufferCallbackMap::iterator iter = | 562 CreateGpuMemoryBufferCallbackMap::iterator iter = |
| 567 create_gpu_memory_buffer_requests_.find(request_id); | 563 create_gpu_memory_buffer_requests_.find(request_id); |
| 568 DCHECK(iter != create_gpu_memory_buffer_requests_.end()); | 564 DCHECK(iter != create_gpu_memory_buffer_requests_.end()); |
| 569 iter->second.Run(handle); | 565 iter->second.Run(handle); |
| 570 create_gpu_memory_buffer_requests_.erase(iter); | 566 create_gpu_memory_buffer_requests_.erase(iter); |
| 571 } | 567 } |
| 572 | 568 |
| 573 } // namespace content | 569 } // namespace content |
| OLD | NEW |