| 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_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/output/software_output_device.h" | 11 #include "cc/output/software_output_device.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 class Size; | 16 class Size; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class CompositorFrame; | 21 class CompositorFrame; |
| 22 class OutputSurfaceClient; | 22 class OutputSurfaceClient; |
| 23 struct LatencyInfo; |
| 23 | 24 |
| 24 // Represents the output surface for a compositor. The compositor owns | 25 // Represents the output surface for a compositor. The compositor owns |
| 25 // and manages its destruction. Its lifetime is: | 26 // and manages its destruction. Its lifetime is: |
| 26 // 1. Created on the main thread by the LayerTreeHost through its client. | 27 // 1. Created on the main thread by the LayerTreeHost through its client. |
| 27 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 28 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
| 28 // From here on, it will only be used on the compositor thread. | 29 // From here on, it will only be used on the compositor thread. |
| 29 // 3. If the 3D context is lost, then the compositor will delete the output | 30 // 3. If the 3D context is lost, then the compositor will delete the output |
| 30 // surface (on the compositor thread) and go back to step 1. | 31 // surface (on the compositor thread) and go back to step 1. |
| 31 class CC_EXPORT OutputSurface { | 32 class CC_EXPORT OutputSurface { |
| 32 public: | 33 public: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // steal the contents of the CompositorFrame passed in. | 76 // steal the contents of the CompositorFrame passed in. |
| 76 virtual void SendFrameToParentCompositor(CompositorFrame* frame); | 77 virtual void SendFrameToParentCompositor(CompositorFrame* frame); |
| 77 | 78 |
| 78 virtual void EnsureBackbuffer(); | 79 virtual void EnsureBackbuffer(); |
| 79 virtual void DiscardBackbuffer(); | 80 virtual void DiscardBackbuffer(); |
| 80 | 81 |
| 81 virtual void Reshape(gfx::Size size); | 82 virtual void Reshape(gfx::Size size); |
| 82 | 83 |
| 83 virtual void BindFramebuffer(); | 84 virtual void BindFramebuffer(); |
| 84 | 85 |
| 85 virtual void PostSubBuffer(gfx::Rect rect); | 86 virtual void PostSubBuffer(gfx::Rect rect, const LatencyInfo&); |
| 86 virtual void SwapBuffers(); | 87 virtual void SwapBuffers(const LatencyInfo&); |
| 87 | 88 |
| 88 // Notifies frame-rate smoothness preference. If true, all non-critical | 89 // Notifies frame-rate smoothness preference. If true, all non-critical |
| 89 // processing should be stopped, or lowered in priority. | 90 // processing should be stopped, or lowered in priority. |
| 90 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 91 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
| 91 | 92 |
| 92 // Requests a vsync notification from the output surface. The notification | 93 // Requests a vsync notification from the output surface. The notification |
| 93 // will be delivered by calling OutputSurfaceClient::DidVSync for all future | 94 // will be delivered by calling OutputSurfaceClient::DidVSync for all future |
| 94 // vsync events until the callback is disabled. | 95 // vsync events until the callback is disabled. |
| 95 virtual void EnableVSyncNotification(bool enable_vsync) {} | 96 virtual void EnableVSyncNotification(bool enable_vsync) {} |
| 96 | 97 |
| 97 protected: | 98 protected: |
| 98 OutputSurfaceClient* client_; | 99 OutputSurfaceClient* client_; |
| 99 struct cc::OutputSurface::Capabilities capabilities_; | 100 struct cc::OutputSurface::Capabilities capabilities_; |
| 100 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 101 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| 101 scoped_ptr<cc::SoftwareOutputDevice> software_device_; | 102 scoped_ptr<cc::SoftwareOutputDevice> software_device_; |
| 102 bool has_gl_discard_backbuffer_; | 103 bool has_gl_discard_backbuffer_; |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 106 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 } // namespace cc | 109 } // namespace cc |
| 109 | 110 |
| 110 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 111 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |