OLD | NEW |
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 #include <public/WebCompositorOutputSurface.h> | 8 #define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this. |
| 9 |
| 10 #include "cc/cc_export.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput
Surface.h" |
9 | 12 |
10 namespace WebKit { | 13 namespace WebKit { |
11 class WebGraphicsContext3D; | 14 class WebGraphicsContext3D; |
12 } | 15 } |
13 | 16 |
14 namespace cc { | 17 namespace cc { |
15 | 18 |
16 // TODO(danakj): Move WebCompositorOutputSurface implementation to here. | 19 class CompositorFrame; |
17 typedef WebKit::WebCompositorOutputSurface OutputSurface; | 20 class OutputSurfaceClient; |
| 21 class SoftwareOutputDevice; |
| 22 |
| 23 // Represents the output surface for a compositor. The compositor owns |
| 24 // and manages its destruction. Its lifetime is: |
| 25 // 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. |
| 27 // 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 |
| 29 // surface (on the compositor thread) and go back to step 1. |
| 30 class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface { |
| 31 public: |
| 32 virtual ~OutputSurface() {} |
| 33 |
| 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 { |
| 41 Capabilities() |
| 42 : has_parent_compositor(false) {} |
| 43 |
| 44 bool has_parent_compositor; |
| 45 }; |
| 46 |
| 47 virtual const Capabilities& Capabilities() const = 0; |
| 48 |
| 49 // 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. |
| 51 // In the event of a lost context, the entire output surface should be |
| 52 // recreated. |
| 53 virtual WebKit::WebGraphicsContext3D* Context3D() const = 0; |
| 54 virtual SoftwareOutputDevice* SoftwareDevice() const = 0; |
| 55 |
| 56 // Sends frame data to the parent compositor. This should only be called when |
| 57 // capabilities().has_parent_compositor. |
| 58 virtual void SendFrameToParentCompositor(const CompositorFrame&) {} |
| 59 }; |
18 | 60 |
19 } // namespace cc | 61 } // namespace cc |
20 | 62 |
21 #endif // CC_OUTPUT_SURFACE_H_ | 63 #endif // CC_OUTPUT_SURFACE_H_ |
OLD | NEW |