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

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

Issue 2158423004: gpu: defer mojo registration and binding resume until full initialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 void GpuChildThread::Init(const base::Time& process_start_time) { 214 void GpuChildThread::Init(const base::Time& process_start_time) {
215 process_start_time_ = process_start_time; 215 process_start_time_ = process_start_time;
216 216
217 #if defined(OS_ANDROID) 217 #if defined(OS_ANDROID)
218 // When running in in-process mode, this has been set in the browser at 218 // When running in in-process mode, this has been set in the browser at
219 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun(). 219 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun().
220 if (!in_browser_process_) 220 if (!in_browser_process_)
221 media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid()); 221 media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid());
222 #endif 222 #endif
223
224 // Only set once per process instance.
225 process_control_.reset(new GpuProcessControlImpl());
226
227 GetInterfaceRegistry()->AddInterface(base::Bind(
228 &GpuChildThread::BindProcessControlRequest, base::Unretained(this)));
229
230 if (GetContentClient()->gpu()) { // NULL in tests.
231 GetContentClient()->gpu()->ExposeInterfacesToBrowser(
232 GetInterfaceRegistry());
233 }
234
235 // We don't want to process any incoming interface requests until 223 // We don't want to process any incoming interface requests until
236 // OnInitialize() is invoked. 224 // OnInitialize() is invoked.
237 GetInterfaceRegistry()->PauseBinding(); 225 GetInterfaceRegistry()->PauseBinding();
238 226
239 if (GetContentClient()->gpu()) // NULL in tests. 227 if (GetContentClient()->gpu()) // NULL in tests.
240 GetContentClient()->gpu()->Initialize(this); 228 GetContentClient()->gpu()->Initialize(this);
241 } 229 }
242 230
243 void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name, 231 void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name,
244 const std::string& group_name) { 232 const std::string& group_name) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 329 }
342 #endif 330 #endif
343 331
344 void GpuChildThread::StoreShaderToDisk(int32_t client_id, 332 void GpuChildThread::StoreShaderToDisk(int32_t client_id,
345 const std::string& key, 333 const std::string& key,
346 const std::string& shader) { 334 const std::string& shader) {
347 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); 335 Send(new GpuHostMsg_CacheShader(client_id, key, shader));
348 } 336 }
349 337
350 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { 338 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) {
351 GetInterfaceRegistry()->ResumeBinding();
352
353 gpu_preferences_ = gpu_preferences; 339 gpu_preferences_ = gpu_preferences;
354 340
355 gpu_info_.video_decode_accelerator_capabilities = 341 gpu_info_.video_decode_accelerator_capabilities =
356 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); 342 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_);
357 gpu_info_.video_encode_accelerator_supported_profiles = 343 gpu_info_.video_encode_accelerator_supported_profiles =
358 media::GpuVideoEncodeAccelerator::GetSupportedProfiles( 344 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(
359 gpu_preferences_); 345 gpu_preferences_);
360 gpu_info_.jpeg_decode_accelerator_supported = 346 gpu_info_.jpeg_decode_accelerator_supported =
361 media::GpuJpegDecodeAccelerator::IsSupported(); 347 media::GpuJpegDecodeAccelerator::IsSupported();
362 348
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 ChildProcess::current()->GetShutDownEvent(), 387 ChildProcess::current()->GetShutDownEvent(),
402 sync_point_manager, gpu_memory_buffer_factory_)); 388 sync_point_manager, gpu_memory_buffer_factory_));
403 389
404 media_service_.reset(new media::MediaService(gpu_channel_manager_.get())); 390 media_service_.reset(new media::MediaService(gpu_channel_manager_.get()));
405 391
406 #if defined(USE_OZONE) 392 #if defined(USE_OZONE)
407 ui::OzonePlatform::GetInstance() 393 ui::OzonePlatform::GetInstance()
408 ->GetGpuPlatformSupport() 394 ->GetGpuPlatformSupport()
409 ->OnChannelEstablished(this); 395 ->OnChannelEstablished(this);
410 #endif 396 #endif
397
398 // Only set once per process instance.
399 process_control_.reset(new GpuProcessControlImpl());
400
401 GetInterfaceRegistry()->AddInterface(base::Bind(
402 &GpuChildThread::BindProcessControlRequest, base::Unretained(this)));
403
404 if (GetContentClient()->gpu()) { // NULL in tests.
405 GetContentClient()->gpu()->ExposeInterfacesToBrowser(
406 GetInterfaceRegistry());
407 }
408
409 GetInterfaceRegistry()->ResumeBinding();
411 } 410 }
412 411
413 void GpuChildThread::OnFinalize() { 412 void GpuChildThread::OnFinalize() {
414 // Quit the GPU process 413 // Quit the GPU process
415 base::MessageLoop::current()->QuitWhenIdle(); 414 base::MessageLoop::current()->QuitWhenIdle();
416 } 415 }
417 416
418 void GpuChildThread::StopWatchdog() { 417 void GpuChildThread::StopWatchdog() {
419 if (watchdog_thread_.get()) { 418 if (watchdog_thread_.get()) {
420 watchdog_thread_->Stop(); 419 watchdog_thread_->Stop();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 567
569 void GpuChildThread::BindProcessControlRequest( 568 void GpuChildThread::BindProcessControlRequest(
570 mojom::ProcessControlRequest request) { 569 mojom::ProcessControlRequest request) {
571 DVLOG(1) << "GPU: Binding ProcessControl request"; 570 DVLOG(1) << "GPU: Binding ProcessControl request";
572 DCHECK(process_control_); 571 DCHECK(process_control_);
573 process_control_bindings_.AddBinding(process_control_.get(), 572 process_control_bindings_.AddBinding(process_control_.get(),
574 std::move(request)); 573 std::move(request));
575 } 574 }
576 575
577 } // namespace content 576 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698