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

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: suppress lost context notification before renderer initialized 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/output_surface.cc
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 34ba8d0ed717d3410f2b33df76edd2ef02453ddb..60010850d21ff76953aeb4afa247c67af682b2a8 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,
enne (OOO) 2013/03/25 18:29:19 style nit: 80 col. ;)
+ public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
+ public:
+ explicit OutputSurfaceCallbacks(OutputSurfaceClient* client)
+ : client_(client) {}
enne (OOO) 2013/03/25 18:29:19 style nit: four space indent.
+
+ // 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