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

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

Issue 2108343002: Defer Mojo interface binding in the gpu process until OnInitialize (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 | « content/gpu/gpu_child_thread.h ('k') | services/shell/public/cpp/interface_registry.h » ('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"
11 #include "base/callback_helpers.h"
11 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "base/threading/thread_local.h" 14 #include "base/threading/thread_local.h"
14 #include "base/threading/worker_pool.h" 15 #include "base/threading/worker_pool.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "content/child/child_process.h" 17 #include "content/child/child_process.h"
17 #include "content/child/thread_safe_sender.h" 18 #include "content/child/thread_safe_sender.h"
18 #include "content/common/establish_channel_params.h" 19 #include "content/common/establish_channel_params.h"
19 #include "content/common/gpu_host_messages.h" 20 #include "content/common/gpu_host_messages.h"
20 #include "content/gpu/gpu_process_control_impl.h" 21 #include "content/gpu/gpu_process_control_impl.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 bool GpuChildThread::AcceptConnection(shell::Connection* connection) { 293 bool GpuChildThread::AcceptConnection(shell::Connection* connection) {
293 // Use of base::Unretained(this) is safe here because |service_registry()| 294 // Use of base::Unretained(this) is safe here because |service_registry()|
294 // will be destroyed before GpuChildThread is destructed. 295 // will be destroyed before GpuChildThread is destructed.
295 connection->GetInterfaceRegistry()->AddInterface(base::Bind( 296 connection->GetInterfaceRegistry()->AddInterface(base::Bind(
296 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); 297 &GpuChildThread::BindProcessControlRequest, base::Unretained(this)));
297 298
298 if (GetContentClient()->gpu()) { // NULL in tests. 299 if (GetContentClient()->gpu()) { // NULL in tests.
299 GetContentClient()->gpu()->ExposeInterfacesToBrowser( 300 GetContentClient()->gpu()->ExposeInterfacesToBrowser(
300 connection->GetInterfaceRegistry()); 301 connection->GetInterfaceRegistry());
301 } 302 }
303
304 // We don't want to process any incoming interface requests until
305 // OnInitialize().
306 connection->GetInterfaceRegistry()->PauseBinding();
307 resume_interface_bindings_callback_ = base::Bind(
308 &shell::InterfaceRegistry::ResumeBinding,
309 connection->GetInterfaceRegistry()->GetWeakPtr());
310
302 return true; 311 return true;
303 } 312 }
304 313
305 shell::InterfaceRegistry* GpuChildThread::GetInterfaceRegistryForConnection() { 314 shell::InterfaceRegistry* GpuChildThread::GetInterfaceRegistryForConnection() {
306 return nullptr; 315 return nullptr;
307 } 316 }
308 317
309 shell::InterfaceProvider* GpuChildThread::GetInterfaceProviderForConnection() { 318 shell::InterfaceProvider* GpuChildThread::GetInterfaceProviderForConnection() {
310 return nullptr; 319 return nullptr;
311 } 320 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 355 }
347 #endif 356 #endif
348 357
349 void GpuChildThread::StoreShaderToDisk(int32_t client_id, 358 void GpuChildThread::StoreShaderToDisk(int32_t client_id,
350 const std::string& key, 359 const std::string& key,
351 const std::string& shader) { 360 const std::string& shader) {
352 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); 361 Send(new GpuHostMsg_CacheShader(client_id, key, shader));
353 } 362 }
354 363
355 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { 364 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) {
365 if (!resume_interface_bindings_callback_.is_null())
366 base::ResetAndReturn(&resume_interface_bindings_callback_).Run();
367
356 gpu_preferences_ = gpu_preferences; 368 gpu_preferences_ = gpu_preferences;
357 369
358 gpu_info_.video_decode_accelerator_capabilities = 370 gpu_info_.video_decode_accelerator_capabilities =
359 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); 371 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_);
360 gpu_info_.video_encode_accelerator_supported_profiles = 372 gpu_info_.video_encode_accelerator_supported_profiles =
361 media::GpuVideoEncodeAccelerator::GetSupportedProfiles( 373 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(
362 gpu_preferences_); 374 gpu_preferences_);
363 gpu_info_.jpeg_decode_accelerator_supported = 375 gpu_info_.jpeg_decode_accelerator_supported =
364 media::GpuJpegDecodeAccelerator::IsSupported(); 376 media::GpuJpegDecodeAccelerator::IsSupported();
365 377
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 583
572 void GpuChildThread::BindProcessControlRequest( 584 void GpuChildThread::BindProcessControlRequest(
573 mojo::InterfaceRequest<mojom::ProcessControl> request) { 585 mojo::InterfaceRequest<mojom::ProcessControl> request) {
574 DVLOG(1) << "GPU: Binding ProcessControl request"; 586 DVLOG(1) << "GPU: Binding ProcessControl request";
575 DCHECK(process_control_); 587 DCHECK(process_control_);
576 process_control_bindings_.AddBinding(process_control_.get(), 588 process_control_bindings_.AddBinding(process_control_.get(),
577 std::move(request)); 589 std::move(request));
578 } 590 }
579 591
580 } // namespace content 592 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | services/shell/public/cpp/interface_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698