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

Unified Diff: cc/output/output_surface.cc

Issue 12545018: Move context-related callbacks into OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unit test Created 7 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 | « cc/output/output_surface.h ('k') | cc/output/output_surface_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/output_surface.cc
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 416440283d4bdfca847494ea0ca9e5c3b6f6d44d..83127900acd331bfafeba1867114b38740d2c30c 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/strings/string_split.h"
+#include "cc/output/output_surface_client.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
@@ -23,6 +24,27 @@ using std::vector;
namespace cc {
+class OutputSurfaceCallbacks :
+ public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM,
+ public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
+ public:
+ explicit OutputSurfaceCallbacks(OutputSurfaceClient* client)
+ : client_(client) {}
+
+ // WK:WGC3D::WGSwapBuffersCompleteCallbackCHROMIUM implementation.
+ virtual void onSwapBuffersComplete() {
+ client_->OnSwapBuffersComplete();
+ }
+
+ // WK:WGC3D::WGContextLostCallback implementation.
+ virtual void onContextLost() {
+ client_->DidLoseOutputSurface();
+ }
+
+ private:
+ OutputSurfaceClient* client_;
+};
+
OutputSurface::OutputSurface(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d)
: client_(NULL),
@@ -66,6 +88,10 @@ bool OutputSurface::BindToClient(
has_gl_discard_backbuffer_ =
extensions.count("GL_CHROMIUM_discard_backbuffer") > 0;
+ callbacks_.reset(new OutputSurfaceCallbacks(client_));
+ context3d_->setSwapBuffersCompleteCallbackCHROMIUM(callbacks_.get());
+ context3d_->setContextLostCallback(callbacks_.get());
+
return true;
}
« no previous file with comments | « cc/output/output_surface.h ('k') | cc/output/output_surface_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698