| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 156 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 157 watchdog_thread_ = watchdog_thread; | 157 watchdog_thread_ = watchdog_thread; |
| 158 #if defined(OS_WIN) | 158 #if defined(OS_WIN) |
| 159 target_services_ = NULL; | 159 target_services_ = NULL; |
| 160 #endif | 160 #endif |
| 161 g_thread_safe_sender.Get() = thread_safe_sender(); | 161 g_thread_safe_sender.Get() = thread_safe_sender(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 GpuChildThread::GpuChildThread( | 164 GpuChildThread::GpuChildThread( |
| 165 const InProcessChildThreadParams& params, | 165 const InProcessChildThreadParams& params, |
| 166 const gpu::GPUInfo& gpu_info, |
| 166 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 167 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 167 : ChildThreadImpl(ChildThreadImpl::Options::Builder() | 168 : ChildThreadImpl(ChildThreadImpl::Options::Builder() |
| 168 .InBrowserProcess(params) | 169 .InBrowserProcess(params) |
| 169 .UseMojoChannel(true) | 170 .UseMojoChannel(true) |
| 170 .AddStartupFilter(new GpuMemoryBufferMessageFilter( | 171 .AddStartupFilter(new GpuMemoryBufferMessageFilter( |
| 171 gpu_memory_buffer_factory)) | 172 gpu_memory_buffer_factory)) |
| 172 .ConnectToBrowser(true) | 173 .ConnectToBrowser(true) |
| 173 .Build()), | 174 .Build()), |
| 174 dead_on_arrival_(false), | 175 dead_on_arrival_(false), |
| 176 gpu_info_(gpu_info), |
| 175 in_browser_process_(true), | 177 in_browser_process_(true), |
| 176 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { | 178 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { |
| 177 #if defined(OS_WIN) | 179 #if defined(OS_WIN) |
| 178 target_services_ = NULL; | 180 target_services_ = NULL; |
| 179 #endif | 181 #endif |
| 180 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 182 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 181 switches::kSingleProcess) || | 183 switches::kSingleProcess) || |
| 182 base::CommandLine::ForCurrentProcess()->HasSwitch( | 184 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 183 switches::kInProcessGPU)); | 185 switches::kInProcessGPU)); |
| 184 | 186 |
| 185 if (!gl::init::InitializeGLOneOff()) | |
| 186 VLOG(1) << "gl::init::InitializeGLOneOff failed"; | |
| 187 | |
| 188 g_thread_safe_sender.Get() = thread_safe_sender(); | 187 g_thread_safe_sender.Get() = thread_safe_sender(); |
| 189 } | 188 } |
| 190 | 189 |
| 191 GpuChildThread::~GpuChildThread() { | 190 GpuChildThread::~GpuChildThread() { |
| 192 while (!deferred_messages_.empty()) { | 191 while (!deferred_messages_.empty()) { |
| 193 delete deferred_messages_.front(); | 192 delete deferred_messages_.front(); |
| 194 deferred_messages_.pop(); | 193 deferred_messages_.pop(); |
| 195 } | 194 } |
| 196 } | 195 } |
| 197 | 196 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 543 |
| 545 void GpuChildThread::BindServiceFactoryRequest( | 544 void GpuChildThread::BindServiceFactoryRequest( |
| 546 shell::mojom::ServiceFactoryRequest request) { | 545 shell::mojom::ServiceFactoryRequest request) { |
| 547 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest"; | 546 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest"; |
| 548 DCHECK(service_factory_); | 547 DCHECK(service_factory_); |
| 549 service_factory_bindings_.AddBinding(service_factory_.get(), | 548 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 550 std::move(request)); | 549 std::move(request)); |
| 551 } | 550 } |
| 552 | 551 |
| 553 } // namespace content | 552 } // namespace content |
| OLD | NEW |