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

Unified Diff: gpu/blink/webgraphicscontext3d_impl.cc

Issue 1885903002: Revert of 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: 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/blink/webgraphicscontext3d_impl.cc
diff --git a/gpu/blink/webgraphicscontext3d_impl.cc b/gpu/blink/webgraphicscontext3d_impl.cc
index 256d19a7d23b873955ce5d933d933e5d3f9035e1..5a5cdbd1fcacc165bc1ea17a55f163ed3bb1c02b 100644
--- a/gpu/blink/webgraphicscontext3d_impl.cc
+++ b/gpu/blink/webgraphicscontext3d_impl.cc
@@ -26,6 +26,27 @@
namespace gpu_blink {
+class WebGraphicsContext3DErrorMessageCallback
+ : public ::gpu::gles2::GLES2ImplementationErrorMessageCallback {
+ public:
+ WebGraphicsContext3DErrorMessageCallback(
+ WebGraphicsContext3DImpl* context)
+ : graphics_context_(context) {
+ }
+
+ void OnErrorMessage(const char* msg, int id) override;
+
+ private:
+ WebGraphicsContext3DImpl* graphics_context_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebGraphicsContext3DErrorMessageCallback);
+};
+
+void WebGraphicsContext3DErrorMessageCallback::OnErrorMessage(
+ const char* msg, int id) {
+ graphics_context_->OnErrorMessage(msg, id);
+}
+
WebGraphicsContext3DImpl::WebGraphicsContext3DImpl()
: initialized_(false),
initialize_failed_(false),
@@ -47,4 +68,21 @@
context_lost_callback_ = cb;
}
+::gpu::gles2::GLES2ImplementationErrorMessageCallback*
+ WebGraphicsContext3DImpl::getErrorMessageCallback() {
+ if (!client_error_message_callback_) {
+ client_error_message_callback_.reset(
+ new WebGraphicsContext3DErrorMessageCallback(this));
+ }
+ return client_error_message_callback_.get();
+}
+
+void WebGraphicsContext3DImpl::OnErrorMessage(
+ const std::string& message, int id) {
+ if (error_message_callback_) {
+ blink::WebString str = blink::WebString::fromUTF8(message.c_str());
+ error_message_callback_->onErrorMessage(str, id);
+ }
+}
+
} // namespace gpu_blink
« no previous file with comments | « gpu/blink/webgraphicscontext3d_impl.h ('k') | gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698