| Index: content/gpu/gpu_child_thread.cc
|
| diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
|
| index 2552d82bff45b05b95e07cefe211a29b8237753e..4aac367429a420feb584e693f71c48800cf7a20b 100644
|
| --- a/content/gpu/gpu_child_thread.cc
|
| +++ b/content/gpu/gpu_child_thread.cc
|
| @@ -13,8 +13,9 @@
|
| #include "build/build_config.h"
|
| #include "content/child/child_process.h"
|
| #include "content/child/thread_safe_sender.h"
|
| +#include "content/common/gpu/establish_channel_params.h"
|
| +#include "content/common/gpu/gpu_browser_messages.h"
|
| #include "content/common/gpu/gpu_memory_buffer_factory.h"
|
| -#include "content/common/gpu/gpu_messages.h"
|
| #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
|
| #include "content/gpu/gpu_process_control_impl.h"
|
| #include "content/gpu/gpu_watchdog_thread.h"
|
| @@ -248,10 +249,63 @@ bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) {
|
| if (ChildThreadImpl::OnMessageReceived(msg))
|
| return true;
|
|
|
| + bool handled = true;
|
| + IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg)
|
| + IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel)
|
| + IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel)
|
| + IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer)
|
| + IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader)
|
| + IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState)
|
| +#if defined(OS_ANDROID)
|
| + IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu);
|
| +#endif
|
| + IPC_MESSAGE_UNHANDLED(handled = false)
|
| + IPC_END_MESSAGE_MAP()
|
| + if (handled)
|
| + return true;
|
| +
|
| return gpu_channel_manager_.get() &&
|
| gpu_channel_manager_->OnMessageReceived(msg);
|
| }
|
|
|
| +void GpuChildThread::AddSubscription(int32_t client_id, unsigned int target) {}
|
| +
|
| +void GpuChildThread::CacheShader(int32_t client_id,
|
| + const std::string& key,
|
| + const std::string& shader) {}
|
| +
|
| +void GpuChildThread::ChannelEstablished(
|
| + const IPC::ChannelHandle& channel_handle) {
|
| + Send(new GpuHostMsg_ChannelEstablished(channel_handle));
|
| +}
|
| +
|
| +void GpuChildThread::DestroyChannel(int client_id) {
|
| + Send(new GpuHostMsg_DestroyChannel(client_id));
|
| +}
|
| +
|
| +void GpuChildThread::DidCreateOffscreenContext(const GURL& active_url) {
|
| + Send(new GpuHostMsg_DidCreateOffscreenContext(active_url));
|
| +}
|
| +
|
| +void GpuChildThread::DidDestroyOffscreenContext(const GURL& active_url) {
|
| + Send(new GpuHostMsg_DidDestroyOffscreenContext(active_url));
|
| +}
|
| +
|
| +void GpuChildThread::DidLoseContext(bool offscreen,
|
| + gpu::error::ContextLostReason reason,
|
| + const GURL& active_url) {
|
| + Send(new GpuHostMsg_DidLoseContext(offscreen, reason, active_url));
|
| +}
|
| +
|
| +void GpuChildThread::GpuMemoryUmaStats(const GPUMemoryUmaStats& params) {
|
| + Send(new GpuHostMsg_GpuMemoryUmaStats(params));
|
| +}
|
| +
|
| +void GpuChildThread::RemoveSubscription(int32_t client_id,
|
| + unsigned int target) {
|
| + Send(new GpuHostMsg_RemoveSubscription(client_id, target));
|
| +}
|
| +
|
| void GpuChildThread::OnInitialize() {
|
| // Record initialization only after collecting the GPU info because that can
|
| // take a significant amount of time.
|
| @@ -277,7 +331,7 @@ void GpuChildThread::OnInitialize() {
|
| // IPC messages before the sandbox has been enabled and all other necessary
|
| // initialization has succeeded.
|
| gpu_channel_manager_.reset(
|
| - new GpuChannelManager(channel(), watchdog_thread_.get(),
|
| + new GpuChannelManager(this, channel(), watchdog_thread_.get(),
|
| base::ThreadTaskRunnerHandle::Get().get(),
|
| ChildProcess::current()->io_task_runner(),
|
| ChildProcess::current()->GetShutDownEvent(),
|
| @@ -357,7 +411,7 @@ void GpuChildThread::OnGetVideoMemoryUsageStats() {
|
| void GpuChildThread::OnClean() {
|
| DVLOG(1) << "GPU: Removing all contexts";
|
| if (gpu_channel_manager_)
|
| - gpu_channel_manager_->LoseAllContexts();
|
| + gpu_channel_manager_->ClearAllChannels();
|
| }
|
|
|
| void GpuChildThread::OnCrash() {
|
| @@ -393,6 +447,48 @@ void GpuChildThread::OnGpuSwitched() {
|
| ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
|
| }
|
|
|
| +void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) {
|
| + if (gpu_channel_manager_)
|
| + gpu_channel_manager_->EstablishChannel(params);
|
| +}
|
| +
|
| +void GpuChildThread::OnCloseChannel(const IPC::ChannelHandle& channel_handle) {
|
| + if (gpu_channel_manager_)
|
| + gpu_channel_manager_->CloseChannel(channel_handle);
|
| +}
|
| +
|
| +void GpuChildThread::OnLoadedShader(const std::string& shader) {
|
| + if (gpu_channel_manager_)
|
| + gpu_channel_manager_->LoadedShader(shader);
|
| +}
|
| +
|
| +void GpuChildThread::OnDestroyGpuMemoryBuffer(
|
| + gfx::GpuMemoryBufferId id,
|
| + int client_id,
|
| + const gpu::SyncToken& sync_token) {
|
| + if (gpu_channel_manager_)
|
| + gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
|
| +}
|
| +
|
| +void GpuChildThread::OnUpdateValueState(int client_id,
|
| + unsigned int target,
|
| + const gpu::ValueState& state) {
|
| + if (gpu_channel_manager_)
|
| + gpu_channel_manager_->UpdateValueState(client_id, target, state);
|
| +}
|
| +
|
| +#if defined(OS_ANDROID)
|
| +void GpuChildThread::OnWakeUpGpu() {
|
| + if (gpu_channel_manager_)
|
| + gpu_channel_manager_->WakeUpGpu();
|
| +}
|
| +#endif
|
| +
|
| +void GpuChildThread::OnLoseAllContexts() {
|
| + if (gpu_channel_manager_)
|
| + gpu_channel_manager_->ClearAllChannels();
|
| +}
|
| +
|
| void GpuChildThread::BindProcessControlRequest(
|
| mojo::InterfaceRequest<ProcessControl> request) {
|
| DVLOG(1) << "GPU: Binding ProcessControl request";
|
|
|