Chromium Code Reviews| 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 #define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this. | 8 #define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this. |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "cc/cc_export.h" | 12 #include "cc/cc_export.h" |
| 13 #include "cc/software_output_device.h" | 13 #include "cc/software_output_device.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h" |
| 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Rect; | 18 class Rect; |
| 19 class Size; | 19 class Size; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 | 23 |
| 24 class CompositorFrame; | 24 class CompositorFrame; |
| 25 class OutputSurfaceClient; | 25 class OutputSurfaceClient; |
| 26 class OutputSurfaceCallbacks; | |
| 26 | 27 |
| 27 // Represents the output surface for a compositor. The compositor owns | 28 // Represents the output surface for a compositor. The compositor owns |
| 28 // and manages its destruction. Its lifetime is: | 29 // and manages its destruction. Its lifetime is: |
| 29 // 1. Created on the main thread by the LayerTreeHost through its client. | 30 // 1. Created on the main thread by the LayerTreeHost through its client. |
| 30 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 31 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
| 31 // From here on, it will only be used on the compositor thread. | 32 // From here on, it will only be used on the compositor thread. |
| 32 // 3. If the 3D context is lost, then the compositor will delete the output | 33 // 3. If the 3D context is lost, then the compositor will delete the output |
| 33 // surface (on the compositor thread) and go back to step 1. | 34 // surface (on the compositor thread) and go back to step 1. |
| 34 class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface { | 35 class CC_EXPORT OutputSurface : public WebKit::WebCompositorOutputSurface { |
| 35 public: | 36 public: |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 66 SoftwareOutputDevice* software_device() const { | 67 SoftwareOutputDevice* software_device() const { |
| 67 return software_device_.get(); | 68 return software_device_.get(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 // Called by the compositor on the compositor thread. This is a place where | 71 // Called by the compositor on the compositor thread. This is a place where |
| 71 // thread-specific data for the output surface can be initialized, since from | 72 // thread-specific data for the output surface can be initialized, since from |
| 72 // this point on the output surface will only be used on the compositor | 73 // this point on the output surface will only be used on the compositor |
| 73 // thread. | 74 // thread. |
| 74 virtual bool BindToClient(OutputSurfaceClient*); | 75 virtual bool BindToClient(OutputSurfaceClient*); |
| 75 | 76 |
| 77 // Registers for callbacks from the context/device. Should be called only | |
| 78 // after the context/device is fully initialized and cleared before | |
| 79 // destroying it. | |
| 80 void RegisterCallbacks(); | |
| 81 void ClearCallbacks(); | |
|
piman
2013/03/15 03:20:38
This isn't called anywhere (that I can see?)
| |
| 82 | |
| 76 // Sends frame data to the parent compositor. This should only be called when | 83 // Sends frame data to the parent compositor. This should only be called when |
| 77 // capabilities().has_parent_compositor. The implementation may destroy or | 84 // capabilities().has_parent_compositor. The implementation may destroy or |
| 78 // steal the contents of the CompositorFrame passed in. | 85 // steal the contents of the CompositorFrame passed in. |
| 79 virtual void SendFrameToParentCompositor(CompositorFrame*); | 86 virtual void SendFrameToParentCompositor(CompositorFrame*); |
| 80 | 87 |
| 81 virtual void EnsureBackbuffer(); | 88 virtual void EnsureBackbuffer(); |
| 82 virtual void DiscardBackbuffer(); | 89 virtual void DiscardBackbuffer(); |
| 83 | 90 |
| 84 virtual void Reshape(gfx::Size size); | 91 virtual void Reshape(gfx::Size size); |
| 85 | 92 |
| 86 virtual void BindFramebuffer(); | 93 virtual void BindFramebuffer(); |
| 87 | 94 |
| 88 virtual void PostSubBuffer(gfx::Rect rect); | 95 virtual void PostSubBuffer(gfx::Rect rect); |
| 89 virtual void SwapBuffers(); | 96 virtual void SwapBuffers(); |
| 90 | 97 |
| 91 // Notifies frame-rate smoothness preference. If true, all non-critical | 98 // Notifies frame-rate smoothness preference. If true, all non-critical |
| 92 // processing should be stopped, or lowered in priority. | 99 // processing should be stopped, or lowered in priority. |
| 93 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 100 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
| 94 | 101 |
| 95 protected: | 102 protected: |
| 96 OutputSurfaceClient* client_; | 103 OutputSurfaceClient* client_; |
| 97 struct cc::OutputSurface::Capabilities capabilities_; | 104 struct cc::OutputSurface::Capabilities capabilities_; |
| 98 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 105 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| 99 scoped_ptr<cc::SoftwareOutputDevice> software_device_; | 106 scoped_ptr<cc::SoftwareOutputDevice> software_device_; |
| 100 bool has_gl_discard_backbuffer_; | 107 bool has_gl_discard_backbuffer_; |
| 101 | 108 |
| 109 scoped_ptr<OutputSurfaceCallbacks> callbacks_; | |
| 110 | |
| 102 private: | 111 private: |
| 103 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 112 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 104 }; | 113 }; |
| 105 | 114 |
| 106 } // namespace cc | 115 } // namespace cc |
| 107 | 116 |
| 108 #endif // CC_OUTPUT_SURFACE_H_ | 117 #endif // CC_OUTPUT_SURFACE_H_ |
| OLD | NEW |