summaryrefslogtreecommitdiffstats
path: root/cc/output_surface.h
diff options
context:
space:
mode:
Diffstat (limited to 'cc/output_surface.h')
-rw-r--r--cc/output_surface.h48
1 files changed, 33 insertions, 15 deletions
diff --git a/cc/output_surface.h b/cc/output_surface.h
index 4bc3180..de075e2 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