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

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

Issue 1767673002: Revert of Decouple Media Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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') | 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"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/threading/worker_pool.h" 13 #include "base/threading/worker_pool.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/child/child_process.h" 15 #include "content/child/child_process.h"
16 #include "content/child/thread_safe_sender.h" 16 #include "content/child/thread_safe_sender.h"
17 #include "content/common/gpu/establish_channel_params.h" 17 #include "content/common/gpu/establish_channel_params.h"
18 #include "content/common/gpu/gpu_host_messages.h" 18 #include "content/common/gpu/gpu_host_messages.h"
19 #include "content/common/gpu/gpu_memory_buffer_factory.h" 19 #include "content/common/gpu/gpu_memory_buffer_factory.h"
20 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 20 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
21 #include "content/common/gpu/media/media_service.h"
22 #include "content/gpu/gpu_process_control_impl.h" 21 #include "content/gpu/gpu_process_control_impl.h"
23 #include "content/gpu/gpu_watchdog_thread.h" 22 #include "content/gpu/gpu_watchdog_thread.h"
24 #include "content/public/common/content_client.h" 23 #include "content/public/common/content_client.h"
25 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
26 #include "content/public/gpu/content_gpu_client.h" 25 #include "content/public/gpu/content_gpu_client.h"
27 #include "gpu/command_buffer/service/gpu_switches.h" 26 #include "gpu/command_buffer/service/gpu_switches.h"
28 #include "gpu/config/gpu_info_collector.h" 27 #include "gpu/config/gpu_info_collector.h"
29 #include "gpu/config/gpu_switches.h" 28 #include "gpu/config/gpu_switches.h"
30 #include "gpu/config/gpu_util.h" 29 #include "gpu/config/gpu_util.h"
31 #include "gpu/ipc/common/memory_stats.h" 30 #include "gpu/ipc/common/memory_stats.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 295
297 void GpuChildThread::AddSubscription(int32_t client_id, unsigned int target) { 296 void GpuChildThread::AddSubscription(int32_t client_id, unsigned int target) {
298 Send(new GpuHostMsg_AddSubscription(client_id, target)); 297 Send(new GpuHostMsg_AddSubscription(client_id, target));
299 } 298 }
300 299
301 void GpuChildThread::DidCreateOffscreenContext(const GURL& active_url) { 300 void GpuChildThread::DidCreateOffscreenContext(const GURL& active_url) {
302 Send(new GpuHostMsg_DidCreateOffscreenContext(active_url)); 301 Send(new GpuHostMsg_DidCreateOffscreenContext(active_url));
303 } 302 }
304 303
305 void GpuChildThread::DidDestroyChannel(int client_id) { 304 void GpuChildThread::DidDestroyChannel(int client_id) {
306 media_service_->RemoveChannel(client_id);
307 Send(new GpuHostMsg_DestroyChannel(client_id)); 305 Send(new GpuHostMsg_DestroyChannel(client_id));
308 } 306 }
309 307
310 void GpuChildThread::DidDestroyOffscreenContext(const GURL& active_url) { 308 void GpuChildThread::DidDestroyOffscreenContext(const GURL& active_url) {
311 Send(new GpuHostMsg_DidDestroyOffscreenContext(active_url)); 309 Send(new GpuHostMsg_DidDestroyOffscreenContext(active_url));
312 } 310 }
313 311
314 void GpuChildThread::DidLoseContext(bool offscreen, 312 void GpuChildThread::DidLoseContext(bool offscreen,
315 gpu::error::ContextLostReason reason, 313 gpu::error::ContextLostReason reason,
316 const GURL& active_url) { 314 const GURL& active_url) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // Defer creation of the render thread. This is to prevent it from handling 370 // Defer creation of the render thread. This is to prevent it from handling
373 // IPC messages before the sandbox has been enabled and all other necessary 371 // IPC messages before the sandbox has been enabled and all other necessary
374 // initialization has succeeded. 372 // initialization has succeeded.
375 gpu_channel_manager_.reset( 373 gpu_channel_manager_.reset(
376 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), 374 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(),
377 base::ThreadTaskRunnerHandle::Get().get(), 375 base::ThreadTaskRunnerHandle::Get().get(),
378 ChildProcess::current()->io_task_runner(), 376 ChildProcess::current()->io_task_runner(),
379 ChildProcess::current()->GetShutDownEvent(), 377 ChildProcess::current()->GetShutDownEvent(),
380 sync_point_manager_, gpu_memory_buffer_factory_)); 378 sync_point_manager_, gpu_memory_buffer_factory_));
381 379
382 media_service_.reset(new MediaService(gpu_channel_manager_.get()));
383
384 #if defined(USE_OZONE) 380 #if defined(USE_OZONE)
385 ui::OzonePlatform::GetInstance() 381 ui::OzonePlatform::GetInstance()
386 ->GetGpuPlatformSupport() 382 ->GetGpuPlatformSupport()
387 ->OnChannelEstablished(this); 383 ->OnChannelEstablished(this);
388 #endif 384 #endif
389 } 385 }
390 386
391 void GpuChildThread::OnFinalize() { 387 void GpuChildThread::OnFinalize() {
392 // Quit the GPU process 388 // Quit the GPU process
393 base::MessageLoop::current()->QuitWhenIdle(); 389 base::MessageLoop::current()->QuitWhenIdle();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 gpu_channel_manager_->BufferPresented(params); 558 gpu_channel_manager_->BufferPresented(params);
563 } 559 }
564 #endif 560 #endif
565 561
566 void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) { 562 void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) {
567 if (!gpu_channel_manager_) 563 if (!gpu_channel_manager_)
568 return; 564 return;
569 565
570 IPC::ChannelHandle channel_handle = 566 IPC::ChannelHandle channel_handle =
571 gpu_channel_manager_->EstablishChannel(params); 567 gpu_channel_manager_->EstablishChannel(params);
572 media_service_->AddChannel(params.client_id);
573 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); 568 Send(new GpuHostMsg_ChannelEstablished(channel_handle));
574 } 569 }
575 570
576 void GpuChildThread::OnCloseChannel(int32_t client_id) { 571 void GpuChildThread::OnCloseChannel(int32_t client_id) {
577 if (gpu_channel_manager_) 572 if (gpu_channel_manager_)
578 gpu_channel_manager_->RemoveChannel(client_id); 573 gpu_channel_manager_->RemoveChannel(client_id);
579 } 574 }
580 575
581 void GpuChildThread::OnLoadedShader(const std::string& shader) { 576 void GpuChildThread::OnLoadedShader(const std::string& shader) {
582 if (gpu_channel_manager_) 577 if (gpu_channel_manager_)
(...skipping 16 matching lines...) Expand all
599 } 594 }
600 595
601 #if defined(OS_ANDROID) 596 #if defined(OS_ANDROID)
602 void GpuChildThread::OnWakeUpGpu() { 597 void GpuChildThread::OnWakeUpGpu() {
603 if (gpu_channel_manager_) 598 if (gpu_channel_manager_)
604 gpu_channel_manager_->WakeUpGpu(); 599 gpu_channel_manager_->WakeUpGpu();
605 } 600 }
606 #endif 601 #endif
607 602
608 void GpuChildThread::OnLoseAllContexts() { 603 void GpuChildThread::OnLoseAllContexts() {
609 if (gpu_channel_manager_) { 604 if (gpu_channel_manager_)
610 gpu_channel_manager_->DestroyAllChannels(); 605 gpu_channel_manager_->DestroyAllChannels();
611 media_service_->DestroyAllChannels();
612 }
613 } 606 }
614 607
615 void GpuChildThread::BindProcessControlRequest( 608 void GpuChildThread::BindProcessControlRequest(
616 mojo::InterfaceRequest<ProcessControl> request) { 609 mojo::InterfaceRequest<ProcessControl> request) {
617 DVLOG(1) << "GPU: Binding ProcessControl request"; 610 DVLOG(1) << "GPU: Binding ProcessControl request";
618 DCHECK(process_control_); 611 DCHECK(process_control_);
619 process_control_bindings_.AddBinding(process_control_.get(), 612 process_control_bindings_.AddBinding(process_control_.get(),
620 std::move(request)); 613 std::move(request));
621 } 614 }
622 615
623 } // namespace content 616 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698