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 11 matching lines...) Expand all Loading... |
22 #include "content/common/child_process_host_impl.h" | 22 #include "content/common/child_process_host_impl.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/content_browser_client.h" | 24 #include "content/public/browser/content_browser_client.h" |
25 #include "content/public/browser/gpu_data_manager.h" | 25 #include "content/public/browser/gpu_data_manager.h" |
26 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
27 #include "gpu/command_buffer/service/gpu_switches.h" | 27 #include "gpu/command_buffer/service/gpu_switches.h" |
28 #include "gpu/ipc/common/gpu_messages.h" | 28 #include "gpu/ipc/common/gpu_messages.h" |
29 #include "ipc/ipc_channel_handle.h" | 29 #include "ipc/ipc_channel_handle.h" |
30 #include "ipc/message_filter.h" | 30 #include "ipc/message_filter.h" |
31 | 31 |
| 32 #if defined(MOJO_RUNNER_CLIENT) |
| 33 #include "services/shell/runner/common/client_util.h" |
| 34 #endif |
| 35 |
32 namespace content { | 36 namespace content { |
33 | 37 |
34 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; | 38 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; |
35 | 39 |
36 class BrowserGpuChannelHostFactory::EstablishRequest | 40 class BrowserGpuChannelHostFactory::EstablishRequest |
37 : public base::RefCountedThreadSafe<EstablishRequest> { | 41 : public base::RefCountedThreadSafe<EstablishRequest> { |
38 public: | 42 public: |
39 static scoped_refptr<EstablishRequest> Create(CauseForGpuLaunch cause, | 43 static scoped_refptr<EstablishRequest> Create(CauseForGpuLaunch cause, |
40 int gpu_client_id, | 44 int gpu_client_id, |
41 uint64_t gpu_client_tracing_id, | 45 uint64_t gpu_client_tracing_id, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if (pending_request_.get()) | 294 if (pending_request_.get()) |
291 pending_request_->Wait(); | 295 pending_request_->Wait(); |
292 | 296 |
293 return gpu_channel_; | 297 return gpu_channel_; |
294 } | 298 } |
295 #endif | 299 #endif |
296 | 300 |
297 void BrowserGpuChannelHostFactory::EstablishGpuChannel( | 301 void BrowserGpuChannelHostFactory::EstablishGpuChannel( |
298 CauseForGpuLaunch cause_for_gpu_launch, | 302 CauseForGpuLaunch cause_for_gpu_launch, |
299 const base::Closure& callback) { | 303 const base::Closure& callback) { |
| 304 #if defined(MOJO_RUNNER_CLIENT) |
| 305 DCHECK(!shell::ShellIsRemote()); |
| 306 #endif |
300 if (gpu_channel_.get() && gpu_channel_->IsLost()) { | 307 if (gpu_channel_.get() && gpu_channel_->IsLost()) { |
301 DCHECK(!pending_request_.get()); | 308 DCHECK(!pending_request_.get()); |
302 // Recreate the channel if it has been lost. | 309 // Recreate the channel if it has been lost. |
303 gpu_channel_->DestroyChannel(); | 310 gpu_channel_->DestroyChannel(); |
304 gpu_channel_ = NULL; | 311 gpu_channel_ = NULL; |
305 } | 312 } |
306 | 313 |
307 if (!gpu_channel_.get() && !pending_request_.get()) { | 314 if (!gpu_channel_.get() && !pending_request_.get()) { |
308 // We should only get here if the context was lost. | 315 // We should only get here if the context was lost. |
309 pending_request_ = EstablishRequest::Create( | 316 pending_request_ = EstablishRequest::Create( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 378 } |
372 | 379 |
373 // static | 380 // static |
374 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( | 381 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( |
375 int gpu_client_id, | 382 int gpu_client_id, |
376 const base::FilePath& cache_dir) { | 383 const base::FilePath& cache_dir) { |
377 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); | 384 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); |
378 } | 385 } |
379 | 386 |
380 } // namespace content | 387 } // namespace content |
OLD | NEW |