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

Unified Diff: gpu/ipc/client/command_buffer_proxy_impl.cc

Issue 1864723003: Make lost context and error message callbacks on GpuControl go to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: errorcallback: blimp Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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 99474e6c272ef7afe8eacc545bd86aadd59230cc..4434fe2f5d29f75fe26ea42cfcd7bbcf6d2c20ae 100644
--- a/gpu/ipc/client/command_buffer_proxy_impl.cc
+++ b/gpu/ipc/client/command_buffer_proxy_impl.cc
@@ -13,6 +13,7 @@
#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"
@@ -41,6 +42,7 @@ CommandBufferProxyImpl::CommandBufferProxyImpl(GpuChannelHost* channel,
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),
@@ -115,23 +117,20 @@ void CommandBufferProxyImpl::OnDestroyed(gpu::error::ContextLostReason reason,
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;
- if (!context_lost_callback_.is_null()) {
- context_lost_callback_.Run();
- // Avoid calling the error callback more than once.
no sievers 2016/04/07 21:07:58 OnDestroyed() might be triggered more than once I
danakj 2016/04/07 21:45:18 Ah.. I had done this but in content/ and the file
- context_lost_callback_.Reset();
- }
+ // When the client sees that the context is lost, they should delete this
+ // CommandBufferProxyImpl and create a new one.
+ DCHECK(gpu_control_client_);
+ gpu_control_client_->OnGpuControlLostContext();
}
void CommandBufferProxyImpl::OnConsoleMessage(
const GPUCommandBufferConsoleMessage& message) {
- if (!console_message_callback_.is_null()) {
- console_message_callback_.Run(message.message, message.id);
- }
+ DCHECK(gpu_control_client_);
+ gpu_control_client_->OnGpuControlErrorMessage(message.message.c_str(),
+ message.id);
}
void CommandBufferProxyImpl::AddDeletionObserver(DeletionObserver* observer) {
@@ -161,12 +160,6 @@ void CommandBufferProxyImpl::OnSignalAck(uint32_t id) {
callback.Run();
}
-void CommandBufferProxyImpl::SetContextLostCallback(
- const base::Closure& callback) {
- CheckLock();
- context_lost_callback_ = callback;
-}
-
bool CommandBufferProxyImpl::Initialize() {
TRACE_EVENT0("gpu", "CommandBufferProxyImpl::Initialize");
shared_state_shm_.reset(channel_->factory()
@@ -394,6 +387,11 @@ void CommandBufferProxyImpl::DestroyTransferBuffer(int32_t id) {
Send(new GpuCommandBufferMsg_DestroyTransferBuffer(route_id_, id));
}
+void CommandBufferProxyImpl::SetGpuControlClient(GpuControlClient* client) {
+ CheckLock();
+ gpu_control_client_ = client;
+}
+
gpu::Capabilities CommandBufferProxyImpl::GetCapabilities() {
return capabilities_;
}
@@ -662,12 +660,6 @@ void CommandBufferProxyImpl::OnUpdateState(
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_);

Powered by Google App Engine
This is Rietveld 408576698