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

Unified Diff: cc/output_surface.cc

Issue 12545018: Move context-related callbacks into OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 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: cc/output_surface.cc
diff --git a/cc/output_surface.cc b/cc/output_surface.cc
index d1da25c1a25e90dd39a7f05381de03ceff0781ee..bb471090089c1416100ca5ea3efb41ec4e938ca7 100644
--- a/cc/output_surface.cc
+++ b/cc/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_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");
+ callbacks_.reset(new OutputSurfaceCallbacks(client_));
+ context3d_->setSwapBuffersCompleteCallbackCHROMIUM(callbacks_.get());
+ context3d_->setContextLostCallback(callbacks_.get());
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698