Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 2289553002: gpu: Introduce GpuInit. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 return builder.Build(); 140 return builder.Build();
141 } 141 }
142 142
143 } // namespace 143 } // namespace
144 144
145 GpuChildThread::GpuChildThread( 145 GpuChildThread::GpuChildThread(
146 gpu::GpuWatchdogThread* watchdog_thread, 146 gpu::GpuWatchdogThread* watchdog_thread,
147 bool dead_on_arrival, 147 bool dead_on_arrival,
148 const gpu::GPUInfo& gpu_info, 148 const gpu::GPUInfo& gpu_info,
149 const DeferredMessages& deferred_messages, 149 std::vector<gpu::GpuInitLogMessage> deferred_messages,
150 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) 150 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory)
151 : ChildThreadImpl(GetOptions(gpu_memory_buffer_factory)), 151 : ChildThreadImpl(GetOptions(gpu_memory_buffer_factory)),
152 dead_on_arrival_(dead_on_arrival), 152 dead_on_arrival_(dead_on_arrival),
153 gpu_info_(gpu_info), 153 gpu_info_(gpu_info),
154 deferred_messages_(deferred_messages), 154 deferred_messages_(std::move(deferred_messages)),
155 in_browser_process_(false), 155 in_browser_process_(false),
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(
(...skipping 18 matching lines...) Expand all
183 switches::kSingleProcess) || 183 switches::kSingleProcess) ||
184 base::CommandLine::ForCurrentProcess()->HasSwitch( 184 base::CommandLine::ForCurrentProcess()->HasSwitch(
185 switches::kInProcessGPU)); 185 switches::kInProcessGPU));
186 186
187 if (!gl::init::InitializeGLOneOff()) 187 if (!gl::init::InitializeGLOneOff())
188 VLOG(1) << "gl::init::InitializeGLOneOff failed"; 188 VLOG(1) << "gl::init::InitializeGLOneOff failed";
189 189
190 g_thread_safe_sender.Get() = thread_safe_sender(); 190 g_thread_safe_sender.Get() = thread_safe_sender();
191 } 191 }
192 192
193 GpuChildThread::~GpuChildThread() { 193 GpuChildThread::~GpuChildThread() {}
194 while (!deferred_messages_.empty()) {
195 delete deferred_messages_.front();
196 deferred_messages_.pop();
197 }
198 }
199 194
200 void GpuChildThread::Shutdown() { 195 void GpuChildThread::Shutdown() {
201 ChildThreadImpl::Shutdown(); 196 ChildThreadImpl::Shutdown();
202 logging::SetLogMessageHandler(NULL); 197 logging::SetLogMessageHandler(NULL);
203 } 198 }
204 199
205 void GpuChildThread::Init(const base::Time& process_start_time) { 200 void GpuChildThread::Init(const base::Time& process_start_time) {
206 process_start_time_ = process_start_time; 201 process_start_time_ = process_start_time;
207 202
208 #if defined(OS_ANDROID) 203 #if defined(OS_ANDROID)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 gpu_info_.video_encode_accelerator_supported_profiles = 319 gpu_info_.video_encode_accelerator_supported_profiles =
325 media::GpuVideoEncodeAccelerator::GetSupportedProfiles( 320 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(
326 gpu_preferences_); 321 gpu_preferences_);
327 gpu_info_.jpeg_decode_accelerator_supported = 322 gpu_info_.jpeg_decode_accelerator_supported =
328 media::GpuJpegDecodeAccelerator::IsSupported(); 323 media::GpuJpegDecodeAccelerator::IsSupported();
329 324
330 // Record initialization only after collecting the GPU info because that can 325 // Record initialization only after collecting the GPU info because that can
331 // take a significant amount of time. 326 // take a significant amount of time.
332 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; 327 gpu_info_.initialization_time = base::Time::Now() - process_start_time_;
333 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); 328 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_));
334 while (!deferred_messages_.empty()) { 329 for (const auto& msg : deferred_messages_)
335 Send(deferred_messages_.front()); 330 Send(new GpuHostMsg_OnLogMessage(msg.severity, msg.header, msg.message));
336 deferred_messages_.pop(); 331 deferred_messages_.clear();
337 }
338 332
339 if (dead_on_arrival_) { 333 if (dead_on_arrival_) {
340 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; 334 LOG(ERROR) << "Exiting GPU process due to errors during initialization";
341 base::MessageLoop::current()->QuitWhenIdle(); 335 base::MessageLoop::current()->QuitWhenIdle();
342 return; 336 return;
343 } 337 }
344 338
345 // We don't need to pipe log messages if we are running the GPU thread in 339 // We don't need to pipe log messages if we are running the GPU thread in
346 // the browser process. 340 // the browser process.
347 if (!in_browser_process_) 341 if (!in_browser_process_)
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 538
545 void GpuChildThread::BindServiceFactoryRequest( 539 void GpuChildThread::BindServiceFactoryRequest(
546 shell::mojom::ServiceFactoryRequest request) { 540 shell::mojom::ServiceFactoryRequest request) {
547 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest"; 541 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest";
548 DCHECK(service_factory_); 542 DCHECK(service_factory_);
549 service_factory_bindings_.AddBinding(service_factory_.get(), 543 service_factory_bindings_.AddBinding(service_factory_.get(),
550 std::move(request)); 544 std::move(request));
551 } 545 }
552 546
553 } // namespace content 547 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698