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