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

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: Created 7 years, 11 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.h
diff --git a/cc/output_surface.h b/cc/output_surface.h
index 4906ec3e069134a8f54525da85634e0b5adcd536..165ea4c65df915a513fee63e588aa5d5aa0c855c 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,19 +43,31 @@ class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface {
bool has_parent_compositor;
};
- virtual const Capabilities& Capabilities() const = 0;
+ const Capabilities& Capabilities() const;
danakj 2013/01/24 02:03:06 make this inline and named capabilities() since it
// 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;
danakj 2013/01/24 02:03:06 make this inline and named context3d() since not v
+ SoftwareOutputDevice* SoftwareDevice() const;
danakj 2013/01/24 02:03:06 inline software_device()
+
+ // 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*) {}
danakj 2013/01/24 02:03:06 Would NOTREACHED() be appropriate here?
+
+ protected:
+ OutputSurfaceClient* client_;
+ struct cc::OutputSurface::Capabilities capabilities_;
+ scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
+ scoped_ptr<cc::SoftwareOutputDevice> software_device_;
};
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698