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

Unified Diff: components/mus/gles2/command_buffer_driver.cc

Issue 1854953002: Plumb GpuSwapBuffers completion from Mus GPU thread to WS thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review nits Created 4 years, 9 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 | « components/mus/gles2/command_buffer_driver.h ('k') | components/mus/gles2/command_buffer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/gles2/command_buffer_driver.cc
diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc
index 06639e608c34915e9cfef371c865a4bfaa3c0464..9fba1fa23ad3e27b91b44ed8d2777c0f891afee1 100644
--- a/components/mus/gles2/command_buffer_driver.cc
+++ b/components/mus/gles2/command_buffer_driver.cc
@@ -11,6 +11,7 @@
#include "base/memory/shared_memory.h"
#include "base/thread_task_runner_handle.h"
#include "build/build_config.h"
+#include "components/mus/gles2/gl_surface_adapter.h"
#include "components/mus/gles2/gpu_memory_tracker.h"
#include "components/mus/gles2/gpu_state.h"
#include "components/mus/gles2/mojo_buffer_backing.h"
@@ -81,10 +82,17 @@ bool CommandBufferDriver::Initialize(
return false;
const bool offscreen = widget_ == gfx::kNullAcceleratedWidget;
+ static scoped_refptr<gfx::GLSurface> underlying_surface;
brucedawson 2016/04/12 00:40:36 What is this line for? underlying_surface is never
if (offscreen) {
surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1));
} else {
- surface_ = gfx::GLSurface::CreateViewGLSurface(widget_);
+ scoped_refptr<GLSurfaceAdapterMus> surface_adapter =
+ new GLSurfaceAdapterMus(gfx::GLSurface::CreateViewGLSurface(widget_));
+ surface_adapter->SetGpuCompletedSwapBuffersCallback(
+ base::Bind(&CommandBufferDriver::OnGpuCompletedSwapBuffers,
+ weak_factory_.GetWeakPtr()));
+ surface_ = surface_adapter;
+
gfx::VSyncProvider* vsync_provider =
surface_ ? surface_->GetVSyncProvider() : nullptr;
if (vsync_provider) {
@@ -496,4 +504,11 @@ void CommandBufferDriver::SignalQuery(uint32_t query_id,
callback.Run();
}
+void CommandBufferDriver::OnGpuCompletedSwapBuffers(gfx::SwapResult result) {
+ DCHECK(CalledOnValidThread());
+ if (client_) {
+ client_->OnGpuCompletedSwapBuffers(result);
+ }
+}
+
} // namespace mus
« no previous file with comments | « components/mus/gles2/command_buffer_driver.h ('k') | components/mus/gles2/command_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698