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

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: 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
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..fbcdab3d474c04bc40b4d84fff966f879ed01696 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;
if (offscreen) {
surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1));
} else {
- surface_ = gfx::GLSurface::CreateViewGLSurface(widget_);
+ scoped_refptr<GLSurfaceAdapterMus> s =
Fady Samuel 2016/04/01 23:24:42 nit: better variable name than s please?
rjkroege 2016/04/01 23:58:44 Done. I may have been corrupted by viewing the pla
+ new GLSurfaceAdapterMus(gfx::GLSurface::CreateViewGLSurface(widget_));
+ s->SetGpuCompletedSwapBuffersCallback(
+ base::Bind(&CommandBufferDriver::OnGpuCompletedSwapBuffers,
+ weak_factory_.GetWeakPtr()));
+ surface_ = s;
+
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

Powered by Google App Engine
This is Rietveld 408576698