| 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_RENDERER_H_ | 5 #ifndef CC_OUTPUT_RENDERER_H_ |
| 6 #define CC_OUTPUT_RENDERER_H_ | 6 #define CC_OUTPUT_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| 11 #include "cc/resources/managed_memory_policy.h" | 11 #include "cc/resources/managed_memory_policy.h" |
| 12 #include "cc/trees/layer_tree_host.h" | 12 #include "cc/trees/layer_tree_host.h" |
| 13 #include "ui/base/latency_info.h" | |
| 14 | 13 |
| 15 namespace cc { | 14 namespace cc { |
| 16 | 15 |
| 17 class CompositorFrameAck; | 16 class CompositorFrameAck; |
| 18 class CompositorFrameMetadata; | 17 class CompositorFrameMetadata; |
| 19 class ScopedResource; | 18 class ScopedResource; |
| 20 | 19 |
| 21 class CC_EXPORT RendererClient { | 20 class CC_EXPORT RendererClient { |
| 22 public: | 21 public: |
| 23 // Draw viewport in non-y-flipped window space. Note that while a draw is in | 22 // Draw viewport in non-y-flipped window space. Note that while a draw is in |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 | 41 |
| 43 class CC_EXPORT Renderer { | 42 class CC_EXPORT Renderer { |
| 44 public: | 43 public: |
| 45 virtual ~Renderer() {} | 44 virtual ~Renderer() {} |
| 46 | 45 |
| 47 virtual const RendererCapabilities& Capabilities() const = 0; | 46 virtual const RendererCapabilities& Capabilities() const = 0; |
| 48 | 47 |
| 49 const LayerTreeSettings& Settings() const { return client_->Settings(); } | 48 const LayerTreeSettings& Settings() const { return client_->Settings(); } |
| 50 | 49 |
| 51 virtual void ViewportChanged() {} | 50 virtual void ViewportChanged() {} |
| 52 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {} | |
| 53 | 51 |
| 54 virtual bool CanReadPixels() const = 0; | 52 virtual bool CanReadPixels() const = 0; |
| 55 | 53 |
| 56 virtual void DecideRenderPassAllocationsForFrame( | 54 virtual void DecideRenderPassAllocationsForFrame( |
| 57 const RenderPassList& render_passes_in_draw_order) {} | 55 const RenderPassList& render_passes_in_draw_order) {} |
| 58 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const; | 56 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const; |
| 59 | 57 |
| 60 // This passes ownership of the render passes to the renderer. It should | 58 // This passes ownership of the render passes to the renderer. It should |
| 61 // consume them, and empty the list. | 59 // consume them, and empty the list. |
| 62 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) = 0; | 60 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) = 0; |
| 63 | 61 |
| 64 // Waits for rendering to finish. | 62 // Waits for rendering to finish. |
| 65 virtual void Finish() = 0; | 63 virtual void Finish() = 0; |
| 66 | 64 |
| 67 virtual void DoNoOp() {} | 65 virtual void DoNoOp() {} |
| 68 | 66 |
| 69 // Puts backbuffer onscreen. | 67 // Puts backbuffer onscreen. |
| 70 virtual void SwapBuffers(const ui::LatencyInfo& latency_info) = 0; | 68 virtual void SwapBuffers() = 0; |
| 69 virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {} |
| 71 | 70 |
| 72 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) = 0; | 71 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) = 0; |
| 73 | 72 |
| 74 virtual bool IsContextLost(); | 73 virtual bool IsContextLost(); |
| 75 | 74 |
| 76 virtual void SetVisible(bool visible) = 0; | 75 virtual void SetVisible(bool visible) = 0; |
| 77 | 76 |
| 78 virtual void SendManagedMemoryStats(size_t bytes_visible, | 77 virtual void SendManagedMemoryStats(size_t bytes_visible, |
| 79 size_t bytes_visible_and_nearby, | 78 size_t bytes_visible_and_nearby, |
| 80 size_t bytes_allocated) = 0; | 79 size_t bytes_allocated) = 0; |
| 81 | 80 |
| 82 protected: | 81 protected: |
| 83 explicit Renderer(RendererClient* client) | 82 explicit Renderer(RendererClient* client) |
| 84 : client_(client) {} | 83 : client_(client) {} |
| 85 | 84 |
| 86 RendererClient* client_; | 85 RendererClient* client_; |
| 87 | 86 |
| 88 DISALLOW_COPY_AND_ASSIGN(Renderer); | 87 DISALLOW_COPY_AND_ASSIGN(Renderer); |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 } // namespace cc | 90 } // namespace cc |
| 92 | 91 |
| 93 #endif // CC_OUTPUT_RENDERER_H_ | 92 #endif // CC_OUTPUT_RENDERER_H_ |
| OLD | NEW |