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

Unified Diff: content/renderer/pepper/ppb_graphics_3d_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
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | gpu/blink/webgraphicscontext3d_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/ppb_graphics_3d_impl.cc
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc
index 691f524497ad9cc53dd90b6dff80e2ea31878c10..a5625a464da25f658f1e17c415d405de0d2a7f2f 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -45,9 +45,7 @@
has_alpha_(false),
weak_ptr_factory_(this) {}
-PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() {
- command_buffer_->SetGpuControlClient(nullptr);
-}
+PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() {}
// static
PP_Resource PPB_Graphics3D_Impl::CreateRaw(
@@ -246,28 +244,27 @@
gpu_preference);
if (!command_buffer_)
return false;
-
- command_buffer_->SetGpuControlClient(this);
-
if (!command_buffer_->Initialize())
return false;
-
if (shared_state_handle)
*shared_state_handle = command_buffer_->GetSharedStateHandle();
if (capabilities)
*capabilities = command_buffer_->GetCapabilities();
if (command_buffer_id)
*command_buffer_id = command_buffer_->GetCommandBufferID();
-
mailbox_ = gpu::Mailbox::Generate();
if (!command_buffer_->ProduceFrontBuffer(mailbox_))
return false;
+ command_buffer_->SetContextLostCallback(base::Bind(
+ &PPB_Graphics3D_Impl::OnContextLost, weak_ptr_factory_.GetWeakPtr()));
+
+ command_buffer_->SetOnConsoleMessageCallback(base::Bind(
+ &PPB_Graphics3D_Impl::OnConsoleMessage, weak_ptr_factory_.GetWeakPtr()));
return true;
}
-void PPB_Graphics3D_Impl::OnGpuControlErrorMessage(const char* message,
- int32_t id) {
+void PPB_Graphics3D_Impl::OnConsoleMessage(const std::string& message, int id) {
if (!bound_to_instance_)
return;
WebPluginContainer* container =
@@ -282,27 +279,6 @@
frame->addMessageToConsole(console_message);
}
-void PPB_Graphics3D_Impl::OnGpuControlLostContext() {
-#if DCHECK_IS_ON()
- // This should never occur more than once.
- DCHECK(!lost_context_);
- lost_context_ = true;
-#endif
-
- // Don't need to check for null from GetPluginInstance since when we're
- // bound, we know our instance is valid.
- if (bound_to_instance_) {
- HostGlobals::Get()->GetInstance(pp_instance())->BindGraphics(pp_instance(),
- 0);
- }
-
- // Send context lost to plugin. This may have been caused by a PPAPI call, so
- // avoid re-entering.
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&PPB_Graphics3D_Impl::SendContextLost,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
void PPB_Graphics3D_Impl::OnSwapBuffers() {
if (HasPendingSwap()) {
// If we're off-screen, no need to trigger and wait for compositing.
@@ -310,6 +286,21 @@
commit_pending_ = false;
SwapBuffersACK(PP_OK);
}
+}
+
+void PPB_Graphics3D_Impl::OnContextLost() {
+ // Don't need to check for NULL from GetPluginInstance since when we're
+ // bound, we know our instance is valid.
+ if (bound_to_instance_) {
+ HostGlobals::Get()->GetInstance(pp_instance())->BindGraphics(pp_instance(),
+ 0);
+ }
+
+ // Send context lost to plugin. This may have been caused by a PPAPI call, so
+ // avoid re-entering.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&PPB_Graphics3D_Impl::SendContextLost,
+ weak_ptr_factory_.GetWeakPtr()));
}
void PPB_Graphics3D_Impl::SendContextLost() {
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | gpu/blink/webgraphicscontext3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698