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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_OUTPUT_SURFACE_H_ 5 #ifndef CC_OUTPUT_SURFACE_H_
6 #define CC_OUTPUT_SURFACE_H_ 6 #define CC_OUTPUT_SURFACE_H_
7 7
8 #define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this. 8 #define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this.
9 9
10 #include "base/memory/scoped_ptr.h"
10 #include "cc/cc_export.h" 11 #include "cc/cc_export.h"
12 #include "cc/software_output_device.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h"
12 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
13 namespace WebKit {
14 class WebGraphicsContext3D;
15 }
16 15
17 namespace cc { 16 namespace cc {
18 17
19 class CompositorFrame; 18 class CompositorFrame;
20 class OutputSurfaceClient; 19 class OutputSurfaceClient;
21 class SoftwareOutputDevice;
22 20
23 // Represents the output surface for a compositor. The compositor owns 21 // Represents the output surface for a compositor. The compositor owns
24 // and manages its destruction. Its lifetime is: 22 // and manages its destruction. Its lifetime is:
25 // 1. Created on the main thread by the LayerTreeHost through its client. 23 // 1. Created on the main thread by the LayerTreeHost through its client.
26 // 2. Passed to the compositor thread and bound to a client via BindToClient. 24 // 2. Passed to the compositor thread and bound to a client via BindToClient.
27 // From here on, it will only be used on the compositor thread. 25 // From here on, it will only be used on the compositor thread.
28 // 3. If the 3D context is lost, then the compositor will delete the output 26 // 3. If the 3D context is lost, then the compositor will delete the output
29 // surface (on the compositor thread) and go back to step 1. 27 // surface (on the compositor thread) and go back to step 1.
30 class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface { 28 class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface {
31 public: 29 public:
30 OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
31
32 OutputSurface(scoped_ptr<cc::SoftwareOutputDevice> software_device);
33
34 OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
35 scoped_ptr<cc::SoftwareOutputDevice> software_device);
36
32 virtual ~OutputSurface() {} 37 virtual ~OutputSurface() {}
33 38
34 // Called by the compositor on the compositor thread. This is a place where
35 // thread-specific data for the output surface can be initialized, since from
36 // this point on the output surface will only be used on the compositor
37 // thread.
38 virtual bool BindToClient(OutputSurfaceClient*) = 0;
39
40 struct Capabilities { 39 struct Capabilities {
41 Capabilities() 40 Capabilities()
42 : has_parent_compositor(false) {} 41 : has_parent_compositor(false) {}
43 42
44 bool has_parent_compositor; 43 bool has_parent_compositor;
45 }; 44 };
46 45
47 virtual const Capabilities& Capabilities() const = 0; 46 const Capabilities& Capabilities() const;
danakj 2013/01/24 02:03:06 make this inline and named capabilities() since it
48 47
49 // Obtain the 3d context or the software device associated with this output 48 // Obtain the 3d context or the software device associated with this output
50 // surface. Either of these may return a null pointer, but not both. 49 // surface. Either of these may return a null pointer, but not both.
51 // In the event of a lost context, the entire output surface should be 50 // In the event of a lost context, the entire output surface should be
52 // recreated. 51 // recreated.
53 virtual WebKit::WebGraphicsContext3D* Context3D() const = 0; 52 WebKit::WebGraphicsContext3D* Context3D() const;
danakj 2013/01/24 02:03:06 make this inline and named context3d() since not v
54 virtual SoftwareOutputDevice* SoftwareDevice() const = 0; 53 SoftwareOutputDevice* SoftwareDevice() const;
danakj 2013/01/24 02:03:06 inline software_device()
54
55 // Called by the compositor on the compositor thread. This is a place where
56 // thread-specific data for the output surface can be initialized, since from
57 // this point on the output surface will only be used on the compositor
58 // thread.
59 virtual bool BindToClient(OutputSurfaceClient*);
55 60
56 // Sends frame data to the parent compositor. This should only be called when 61 // Sends frame data to the parent compositor. This should only be called when
57 // capabilities().has_parent_compositor. The implementation may destroy or 62 // capabilities().has_parent_compositor. The implementation may destroy or
58 // steal the contents of the CompositorFrame passed in. 63 // steal the contents of the CompositorFrame passed in.
59 virtual void SendFrameToParentCompositor(CompositorFrame*) = 0; 64 virtual void SendFrameToParentCompositor(CompositorFrame*) {}
danakj 2013/01/24 02:03:06 Would NOTREACHED() be appropriate here?
65
66 protected:
67 OutputSurfaceClient* client_;
68 struct cc::OutputSurface::Capabilities capabilities_;
69 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
70 scoped_ptr<cc::SoftwareOutputDevice> software_device_;
60 }; 71 };
61 72
62 } // namespace cc 73 } // namespace cc
63 74
64 #endif // CC_OUTPUT_SURFACE_H_ 75 #endif // CC_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698