| 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 "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput
Surface.h" |
| 9 | 11 |
| 10 namespace WebKit { | 12 namespace WebKit { |
| 11 class WebGraphicsContext3D; | 13 class WebGraphicsContext3D; |
| 12 } | 14 } |
| 13 | 15 |
| 14 namespace cc { | 16 namespace cc { |
| 15 | 17 |
| 16 // TODO(danakj): Move WebCompositorOutputSurface implementation to here. | 18 class CompositorFrame; |
| 17 typedef WebKit::WebCompositorOutputSurface OutputSurface; | 19 class OutputSurfaceClient; |
| 20 class SoftwareOutputDevice; |
| 21 |
| 22 // Represents the output surface for a compositor. The compositor owns |
| 23 // and manages its destruction. Its lifetime is: |
| 24 // 1. Created on the main thread by the LayerTreeHost through its client. |
| 25 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
| 26 // From here on, it will only be used on the compositor thread. |
| 27 // 3. If the 3D context is lost, then the compositor will delete the output |
| 28 // surface (on the compositor thread) and go back to step 1. |
| 29 class OutputSurface : public WebKit::WebCompositorOutputSurface { |
| 30 public: |
| 31 virtual ~OutputSurface() {} |
| 32 |
| 33 // Called by the compositor on the compositor thread. This is a place where |
| 34 // thread-specific data for the output surface can be initialized, since from |
| 35 // this point on the output surface will only be used on the compositor |
| 36 // thread. |
| 37 virtual bool BindToClient(OutputSurfaceClient*) = 0; |
| 38 |
| 39 struct Capabilities { |
| 40 Capabilities() |
| 41 : has_parent_compositor(false) {} |
| 42 |
| 43 bool has_parent_compositor; |
| 44 }; |
| 45 |
| 46 virtual const Capabilities& Capabilities() const = 0; |
| 47 |
| 48 // Obtain the 3d context or the software device associated with this output |
| 49 // surface. Either of these may return a null pointer, but not both. |
| 50 // In the event of a lost context, the entire output surface should be |
| 51 // recreated. |
| 52 virtual WebKit::WebGraphicsContext3D* Context3D() const = 0; |
| 53 virtual SoftwareOutputDevice* SoftwareDevice() const = 0; |
| 54 |
| 55 // Sends frame data to the parent compositor. This should only be called when |
| 56 // capabilities().has_parent_compositor. |
| 57 virtual void SendFrameToParentCompositor(const CompositorFrame&) {} |
| 58 }; |
| 18 | 59 |
| 19 } // namespace cc | 60 } // namespace cc |
| 20 | 61 |
| 21 #endif // CC_OUTPUT_SURFACE_H_ | 62 #endif // CC_OUTPUT_SURFACE_H_ |
| OLD | NEW |