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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
11 #include "content/browser/gpu/gpu_data_manager_impl.h" | 11 #include "content/browser/gpu/gpu_data_manager_impl.h" |
12 #include "content/browser/gpu/gpu_process_host.h" | 12 #include "content/browser/gpu/gpu_process_host.h" |
13 #include "content/browser/gpu/gpu_surface_tracker.h" | 13 #include "content/browser/gpu/gpu_surface_tracker.h" |
14 #include "content/common/child_process_host_impl.h" | 14 #include "content/common/child_process_host_impl.h" |
15 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 15 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
16 #include "content/common/gpu/gpu_messages.h" | 16 #include "content/common/gpu/gpu_messages.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/gpu_data_manager.h" | 18 #include "content/public/browser/gpu_data_manager.h" |
19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
20 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
21 #include "ipc/ipc_forwarding_message_filter.h" | 21 #include "ipc/ipc_forwarding_message_filter.h" |
22 #include "ipc/message_filter.h" | 22 #include "ipc/message_filter.h" |
23 | 23 |
24 #if defined(USE_OZONE) | |
25 #include "ui/ozone/gpu/gpu_platform_support_host.h" | |
26 #endif | |
27 | |
24 namespace content { | 28 namespace content { |
25 | 29 |
26 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; | 30 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; |
27 | 31 |
28 struct BrowserGpuChannelHostFactory::CreateRequest { | 32 struct BrowserGpuChannelHostFactory::CreateRequest { |
29 CreateRequest() | 33 CreateRequest() |
30 : event(true, false), gpu_host_id(0), route_id(MSG_ROUTING_NONE) {} | 34 : event(true, false), gpu_host_id(0), route_id(MSG_ROUTING_NONE) {} |
31 ~CreateRequest() {} | 35 ~CreateRequest() {} |
32 base::WaitableEvent event; | 36 base::WaitableEvent event; |
33 int gpu_host_id; | 37 int gpu_host_id; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 return GpuDataManager::GetInstance()->GpuAccessAllowed(NULL); | 194 return GpuDataManager::GetInstance()->GpuAccessAllowed(NULL); |
191 } | 195 } |
192 | 196 |
193 void BrowserGpuChannelHostFactory::Initialize(bool establish_gpu_channel) { | 197 void BrowserGpuChannelHostFactory::Initialize(bool establish_gpu_channel) { |
194 DCHECK(!instance_); | 198 DCHECK(!instance_); |
195 instance_ = new BrowserGpuChannelHostFactory(); | 199 instance_ = new BrowserGpuChannelHostFactory(); |
196 if (establish_gpu_channel) { | 200 if (establish_gpu_channel) { |
197 instance_->EstablishGpuChannel(CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP, | 201 instance_->EstablishGpuChannel(CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP, |
198 base::Closure()); | 202 base::Closure()); |
199 } | 203 } |
204 #if defined(USE_OZONE) | |
205 ui::GpuPlatformSupportHost::Initialize(); | |
alexst (slow to review)
2014/06/16 21:34:23
Do we need to explicitly init this here? Presumabl
spang
2014/06/17 14:47:34
Actually, our other initializer can't do this beca
| |
206 #endif | |
200 } | 207 } |
201 | 208 |
202 void BrowserGpuChannelHostFactory::Terminate() { | 209 void BrowserGpuChannelHostFactory::Terminate() { |
203 DCHECK(instance_); | 210 DCHECK(instance_); |
204 delete instance_; | 211 delete instance_; |
205 instance_ = NULL; | 212 instance_ = NULL; |
206 } | 213 } |
207 | 214 |
208 BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() | 215 BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() |
209 : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 216 : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
550 const gfx::GpuMemoryBufferHandle& handle, | 557 const gfx::GpuMemoryBufferHandle& handle, |
551 int32 sync_point) { | 558 int32 sync_point) { |
552 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); | 559 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |
553 if (!host) | 560 if (!host) |
554 return; | 561 return; |
555 | 562 |
556 host->DestroyGpuMemoryBuffer(handle, sync_point); | 563 host->DestroyGpuMemoryBuffer(handle, sync_point); |
557 } | 564 } |
558 | 565 |
559 } // namespace content | 566 } // namespace content |
OLD | NEW |