| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) { | 249 BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) { |
| 250 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); | 250 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); |
| 251 if (!shm->CreateAnonymous(size)) | 251 if (!shm->CreateAnonymous(size)) |
| 252 return std::unique_ptr<base::SharedMemory>(); | 252 return std::unique_ptr<base::SharedMemory>(); |
| 253 return shm; | 253 return shm; |
| 254 } | 254 } |
| 255 | 255 |
| 256 void BrowserGpuChannelHostFactory::EstablishGpuChannel( | 256 void BrowserGpuChannelHostFactory::EstablishGpuChannel( |
| 257 const gpu::GpuChannelEstablishedCallback& callback) { | 257 const gpu::GpuChannelEstablishedCallback& callback) { |
| 258 DCHECK(!service_manager::ServiceManagerIsRemote()); | 258 DCHECK(!service_manager::ServiceManagerIsRemote()); |
| 259 DCHECK(IsMainThread()); |
| 259 if (gpu_channel_.get() && gpu_channel_->IsLost()) { | 260 if (gpu_channel_.get() && gpu_channel_->IsLost()) { |
| 260 DCHECK(!pending_request_.get()); | 261 DCHECK(!pending_request_.get()); |
| 261 // Recreate the channel if it has been lost. | 262 // Recreate the channel if it has been lost. |
| 262 gpu_channel_->DestroyChannel(); | 263 gpu_channel_->DestroyChannel(); |
| 263 gpu_channel_ = NULL; | 264 gpu_channel_ = NULL; |
| 264 } | 265 } |
| 265 | 266 |
| 266 if (!gpu_channel_.get() && !pending_request_.get()) { | 267 if (!gpu_channel_.get() && !pending_request_.get()) { |
| 267 // We should only get here if the context was lost. | 268 // We should only get here if the context was lost. |
| 268 pending_request_ = | 269 pending_request_ = |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } | 339 } |
| 339 | 340 |
| 340 // static | 341 // static |
| 341 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( | 342 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( |
| 342 int gpu_client_id, | 343 int gpu_client_id, |
| 343 const base::FilePath& cache_dir) { | 344 const base::FilePath& cache_dir) { |
| 344 GetShaderCacheFactorySingleton()->SetCacheInfo(gpu_client_id, cache_dir); | 345 GetShaderCacheFactorySingleton()->SetCacheInfo(gpu_client_id, cache_dir); |
| 345 } | 346 } |
| 346 | 347 |
| 347 } // namespace content | 348 } // namespace content |
| OLD | NEW |