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/gpu/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "ui/gl/gl_implementation.h" | 37 #include "ui/gl/gl_implementation.h" |
38 #include "ui/gl/gl_switches.h" | 38 #include "ui/gl/gl_switches.h" |
39 #include "ui/gl/gpu_switching_manager.h" | 39 #include "ui/gl/gpu_switching_manager.h" |
40 #include "url/gurl.h" | 40 #include "url/gurl.h" |
41 | 41 |
42 #if defined(USE_OZONE) | 42 #if defined(USE_OZONE) |
43 #include "ui/ozone/public/gpu_platform_support.h" | 43 #include "ui/ozone/public/gpu_platform_support.h" |
44 #include "ui/ozone/public/ozone_platform.h" | 44 #include "ui/ozone/public/ozone_platform.h" |
45 #endif | 45 #endif |
46 | 46 |
47 #if defined(ENABLE_VULKAN) | |
48 #include "gpu/vulkan/vulkan_surface.h" | |
49 #endif | |
50 | |
51 namespace content { | 47 namespace content { |
52 namespace { | 48 namespace { |
53 | 49 |
54 base::LazyInstance<base::ThreadLocalPointer<GpuChildThread>> g_lazy_tls = | 50 base::LazyInstance<base::ThreadLocalPointer<GpuChildThread>> g_lazy_tls = |
55 LAZY_INSTANCE_INITIALIZER; | 51 LAZY_INSTANCE_INITIALIZER; |
56 | 52 |
57 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > | 53 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > |
58 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; | 54 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; |
59 | 55 |
60 bool GpuProcessLogMessageHandler(int severity, | 56 bool GpuProcessLogMessageHandler(int severity, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 in_browser_process_(true), | 191 in_browser_process_(true), |
196 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 192 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
197 #if defined(OS_WIN) | 193 #if defined(OS_WIN) |
198 target_services_ = NULL; | 194 target_services_ = NULL; |
199 #endif | 195 #endif |
200 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 196 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
201 switches::kSingleProcess) || | 197 switches::kSingleProcess) || |
202 base::CommandLine::ForCurrentProcess()->HasSwitch( | 198 base::CommandLine::ForCurrentProcess()->HasSwitch( |
203 switches::kInProcessGPU)); | 199 switches::kInProcessGPU)); |
204 | 200 |
205 #if defined(ENABLE_VULKAN) | |
206 // Temporary Vulkan initialization injection. | |
207 gpu::VulkanSurface::InitializeOneOff(); | |
208 #endif | |
209 | |
210 if (!gfx::GLSurface::InitializeOneOff()) | 201 if (!gfx::GLSurface::InitializeOneOff()) |
211 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; | 202 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; |
212 | 203 |
213 g_thread_safe_sender.Get() = thread_safe_sender(); | 204 g_thread_safe_sender.Get() = thread_safe_sender(); |
214 g_lazy_tls.Pointer()->Set(this); | 205 g_lazy_tls.Pointer()->Set(this); |
215 } | 206 } |
216 | 207 |
217 GpuChildThread::~GpuChildThread() { | 208 GpuChildThread::~GpuChildThread() { |
218 while (!deferred_messages_.empty()) { | 209 while (!deferred_messages_.empty()) { |
219 delete deferred_messages_.front(); | 210 delete deferred_messages_.front(); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 579 |
589 void GpuChildThread::BindProcessControlRequest( | 580 void GpuChildThread::BindProcessControlRequest( |
590 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 581 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
591 DVLOG(1) << "GPU: Binding ProcessControl request"; | 582 DVLOG(1) << "GPU: Binding ProcessControl request"; |
592 DCHECK(process_control_); | 583 DCHECK(process_control_); |
593 process_control_bindings_.AddBinding(process_control_.get(), | 584 process_control_bindings_.AddBinding(process_control_.get(), |
594 std::move(request)); | 585 std::move(request)); |
595 } | 586 } |
596 | 587 |
597 } // namespace content | 588 } // namespace content |
OLD | NEW |