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

Unified Diff: cc/output_surface.h

Issue 12041062: Have a common implementation of cc::OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 10 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/layer_tree_host_unittest.cc ('k') | cc/output_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output_surface.h
diff --git a/cc/output_surface.h b/cc/output_surface.h
index 4bc31802b23153e7bbfe80aa94660c2d56d43ec7..de075e2b7dff79ae1b65b3028b8dfd1533147e28 100644
--- a/cc/output_surface.h
+++ b/cc/output_surface.h
@@ -7,18 +7,16 @@
#define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this.
+#include "base/memory/scoped_ptr.h"
#include "cc/cc_export.h"
+#include "cc/software_output_device.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutputSurface.h"
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
+#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
namespace cc {
class CompositorFrame;
class OutputSurfaceClient;
-class SoftwareOutputDevice;
// Represents the output surface for a compositor. The compositor owns
// and manages its destruction. Its lifetime is:
@@ -29,13 +27,14 @@ class SoftwareOutputDevice;
// surface (on the compositor thread) and go back to step 1.
class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface {
public:
- virtual ~OutputSurface() {}
+ OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
- // Called by the compositor on the compositor thread. This is a place where
- // thread-specific data for the output surface can be initialized, since from
- // this point on the output surface will only be used on the compositor
- // thread.
- virtual bool BindToClient(OutputSurfaceClient*) = 0;
+ OutputSurface(scoped_ptr<cc::SoftwareOutputDevice> software_device);
+
+ OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
+ scoped_ptr<cc::SoftwareOutputDevice> software_device);
+
+ virtual ~OutputSurface();
struct Capabilities {
Capabilities()
@@ -44,23 +43,42 @@ class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface {
bool has_parent_compositor;
};
- virtual const Capabilities& Capabilities() const = 0;
+ const Capabilities& capabilities() const {
+ return capabilities_;
+ }
// Obtain the 3d context or the software device associated with this output
// surface. Either of these may return a null pointer, but not both.
// In the event of a lost context, the entire output surface should be
// recreated.
- virtual WebKit::WebGraphicsContext3D* Context3D() const = 0;
- virtual SoftwareOutputDevice* SoftwareDevice() const = 0;
+ WebKit::WebGraphicsContext3D* context3d() const {
+ return context3d_.get();
+ }
+
+ SoftwareOutputDevice* software_device() const {
+ return software_device_.get();
+ }
+
+ // Called by the compositor on the compositor thread. This is a place where
+ // thread-specific data for the output surface can be initialized, since from
+ // this point on the output surface will only be used on the compositor
+ // thread.
+ virtual bool BindToClient(OutputSurfaceClient*);
// Sends frame data to the parent compositor. This should only be called when
// capabilities().has_parent_compositor. The implementation may destroy or
// steal the contents of the CompositorFrame passed in.
- virtual void SendFrameToParentCompositor(CompositorFrame*) = 0;
+ virtual void SendFrameToParentCompositor(CompositorFrame*);
// Notifies frame-rate smoothness preference. If true, all non-critical
// processing should be stopped, or lowered in priority.
virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {}
+
+ protected:
+ OutputSurfaceClient* client_;
+ struct cc::OutputSurface::Capabilities capabilities_;
+ scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
+ scoped_ptr<cc::SoftwareOutputDevice> software_device_;
};
} // namespace cc
« no previous file with comments | « cc/layer_tree_host_unittest.cc ('k') | cc/output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698