Chromium Code Reviews| 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; |
| } |