| Index: gpu/ipc/client/command_buffer_proxy_impl.cc
|
| diff --git a/gpu/ipc/client/command_buffer_proxy_impl.cc b/gpu/ipc/client/command_buffer_proxy_impl.cc
|
| index eaa2ff13dc7c0f45ce9fd9185eb908083423082b..99474e6c272ef7afe8eacc545bd86aadd59230cc 100644
|
| --- a/gpu/ipc/client/command_buffer_proxy_impl.cc
|
| +++ b/gpu/ipc/client/command_buffer_proxy_impl.cc
|
| @@ -13,7 +13,6 @@
|
| #include "base/stl_util.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "base/trace_event/trace_event.h"
|
| -#include "gpu/command_buffer/client/gpu_control_client.h"
|
| #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
|
| #include "gpu/command_buffer/common/cmd_buffer_common.h"
|
| #include "gpu/command_buffer/common/command_buffer_id.h"
|
| @@ -42,7 +41,6 @@
|
| int32_t route_id,
|
| int32_t stream_id)
|
| : lock_(nullptr),
|
| - gpu_control_client_(nullptr),
|
| channel_(channel),
|
| command_buffer_id_(CommandBufferProxyID(channel->channel_id(), route_id)),
|
| route_id_(route_id),
|
| @@ -111,27 +109,29 @@
|
| void CommandBufferProxyImpl::OnDestroyed(gpu::error::ContextLostReason reason,
|
| gpu::error::Error error) {
|
| CheckLock();
|
| + // Prevent any further messages from being sent.
|
| + if (channel_) {
|
| + channel_->DestroyCommandBuffer(this);
|
| + channel_ = nullptr;
|
| + }
|
|
|
| // When the client sees that the context is lost, they should delete this
|
| // CommandBufferProxyImpl and create a new one.
|
| last_state_.error = error;
|
| last_state_.context_lost_reason = reason;
|
|
|
| - // Prevent any further messages from being sent, and ensure we only call
|
| - // the client for lost context a single time.
|
| - if (channel_) {
|
| - channel_->DestroyCommandBuffer(this);
|
| - channel_ = nullptr;
|
| - if (gpu_control_client_)
|
| - gpu_control_client_->OnGpuControlLostContext();
|
| + if (!context_lost_callback_.is_null()) {
|
| + context_lost_callback_.Run();
|
| + // Avoid calling the error callback more than once.
|
| + context_lost_callback_.Reset();
|
| }
|
| }
|
|
|
| void CommandBufferProxyImpl::OnConsoleMessage(
|
| const GPUCommandBufferConsoleMessage& message) {
|
| - if (gpu_control_client_)
|
| - gpu_control_client_->OnGpuControlErrorMessage(message.message.c_str(),
|
| - message.id);
|
| + if (!console_message_callback_.is_null()) {
|
| + console_message_callback_.Run(message.message, message.id);
|
| + }
|
| }
|
|
|
| void CommandBufferProxyImpl::AddDeletionObserver(DeletionObserver* observer) {
|
| @@ -159,6 +159,12 @@
|
| base::Closure callback = it->second;
|
| signal_tasks_.erase(it);
|
| callback.Run();
|
| +}
|
| +
|
| +void CommandBufferProxyImpl::SetContextLostCallback(
|
| + const base::Closure& callback) {
|
| + CheckLock();
|
| + context_lost_callback_ = callback;
|
| }
|
|
|
| bool CommandBufferProxyImpl::Initialize() {
|
| @@ -388,11 +394,6 @@
|
| Send(new GpuCommandBufferMsg_DestroyTransferBuffer(route_id_, id));
|
| }
|
|
|
| -void CommandBufferProxyImpl::SetGpuControlClient(GpuControlClient* client) {
|
| - CheckLock();
|
| - gpu_control_client_ = client;
|
| -}
|
| -
|
| gpu::Capabilities CommandBufferProxyImpl::GetCapabilities() {
|
| return capabilities_;
|
| }
|
| @@ -661,6 +662,12 @@
|
| last_state_ = state;
|
| }
|
|
|
| +void CommandBufferProxyImpl::SetOnConsoleMessageCallback(
|
| + const GpuConsoleMessageCallback& callback) {
|
| + CheckLock();
|
| + console_message_callback_ = callback;
|
| +}
|
| +
|
| void CommandBufferProxyImpl::TryUpdateState() {
|
| if (last_state_.error == gpu::error::kNoError)
|
| shared_state()->Read(&last_state_);
|
|
|