| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ | 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class ContextProvider; | 23 class ContextProvider; |
| 24 class CompositorFrameMetadata; | 24 class CompositorFrameMetadata; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace IPC { | 27 namespace IPC { |
| 28 class Message; | 28 class Message; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace content { | 31 namespace content { |
| 32 | 32 |
| 33 class FrameSwapMessageQueue; | 33 class FrameUpdateMessageQueue; |
| 34 class SynchronousCompositorClient; | 34 class SynchronousCompositorClient; |
| 35 class SynchronousCompositorImpl; | 35 class SynchronousCompositorImpl; |
| 36 class SynchronousCompositorOutputSurface; | 36 class SynchronousCompositorOutputSurface; |
| 37 class WebGraphicsContext3DCommandBufferImpl; | 37 class WebGraphicsContext3DCommandBufferImpl; |
| 38 | 38 |
| 39 // Specialization of the output surface that adapts it to implement the | 39 // Specialization of the output surface that adapts it to implement the |
| 40 // content::SynchronousCompositor public API. This class effects an "inversion | 40 // content::SynchronousCompositor public API. This class effects an "inversion |
| 41 // of control" - enabling drawing to be orchestrated by the embedding | 41 // of control" - enabling drawing to be orchestrated by the embedding |
| 42 // layer, instead of driven by the compositor internals - hence it holds two | 42 // layer, instead of driven by the compositor internals - hence it holds two |
| 43 // 'client' pointers (|client_| in the OutputSurface baseclass and | 43 // 'client' pointers (|client_| in the OutputSurface baseclass and |
| 44 // |delegate_|) which represent the consumers of the two roles in plays. | 44 // |delegate_|) which represent the consumers of the two roles in plays. |
| 45 // This class can be created only on the main thread, but then becomes pinned | 45 // This class can be created only on the main thread, but then becomes pinned |
| 46 // to a fixed thread when BindToClient is called. | 46 // to a fixed thread when BindToClient is called. |
| 47 class SynchronousCompositorOutputSurface | 47 class SynchronousCompositorOutputSurface |
| 48 : NON_EXPORTED_BASE(public cc::OutputSurface) { | 48 : NON_EXPORTED_BASE(public cc::OutputSurface) { |
| 49 public: | 49 public: |
| 50 SynchronousCompositorOutputSurface( | 50 SynchronousCompositorOutputSurface( |
| 51 const scoped_refptr<cc::ContextProvider>& context_provider, | 51 const scoped_refptr<cc::ContextProvider>& context_provider, |
| 52 const scoped_refptr<cc::ContextProvider>& worker_context_provider, | 52 const scoped_refptr<cc::ContextProvider>& worker_context_provider, |
| 53 int routing_id, | 53 int routing_id, |
| 54 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue); | 54 scoped_refptr<FrameUpdateMessageQueue> frame_update_message_queue); |
| 55 ~SynchronousCompositorOutputSurface() override; | 55 ~SynchronousCompositorOutputSurface() override; |
| 56 | 56 |
| 57 void SetCompositor(SynchronousCompositorImpl* compositor); | 57 void SetCompositor(SynchronousCompositorImpl* compositor); |
| 58 | 58 |
| 59 // OutputSurface. | 59 // OutputSurface. |
| 60 bool BindToClient(cc::OutputSurfaceClient* surface_client) override; | 60 bool BindToClient(cc::OutputSurfaceClient* surface_client) override; |
| 61 void Reshape(const gfx::Size& size, float scale_factor) override; | 61 void Reshape(const gfx::Size& size, float scale_factor) override; |
| 62 void SwapBuffers(cc::CompositorFrame* frame) override; | 62 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 63 void Invalidate() override; | 63 void Invalidate() override; |
| 64 | 64 |
| 65 // Partial SynchronousCompositor API implementation. | 65 // Partial SynchronousCompositor API implementation. |
| 66 scoped_ptr<cc::CompositorFrame> DemandDrawHw( | 66 scoped_ptr<cc::CompositorFrame> DemandDrawHw( |
| 67 gfx::Size surface_size, | 67 gfx::Size surface_size, |
| 68 const gfx::Transform& transform, | 68 const gfx::Transform& transform, |
| 69 gfx::Rect viewport, | 69 gfx::Rect viewport, |
| 70 gfx::Rect clip, | 70 gfx::Rect clip, |
| 71 gfx::Rect viewport_rect_for_tile_priority, | 71 gfx::Rect viewport_rect_for_tile_priority, |
| 72 const gfx::Transform& transform_for_tile_priority); | 72 const gfx::Transform& transform_for_tile_priority); |
| 73 void ReturnResources(const cc::CompositorFrameAck& frame_ack); | 73 void ReturnResources(const cc::CompositorFrameAck& frame_ack); |
| 74 scoped_ptr<cc::CompositorFrame> DemandDrawSw(SkCanvas* canvas); | 74 scoped_ptr<cc::CompositorFrame> DemandDrawSw(SkCanvas* canvas); |
| 75 void SetMemoryPolicy(size_t bytes_limit); | 75 void SetMemoryPolicy(size_t bytes_limit); |
| 76 void SetTreeActivationCallback(const base::Closure& callback); | 76 void SetTreeActivationCallback(const base::Closure& callback); |
| 77 void GetMessagesToDeliver(ScopedVector<IPC::Message>* messages); | 77 void GetSwapMessagesToDeliver(ScopedVector<IPC::Message>* messages); |
| 78 | 78 |
| 79 size_t GetMemoryPolicy() const { | 79 size_t GetMemoryPolicy() const { |
| 80 return memory_policy_.bytes_limit_when_visible; | 80 return memory_policy_.bytes_limit_when_visible; |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 class SoftwareDevice; | 84 class SoftwareDevice; |
| 85 friend class SoftwareDevice; | 85 friend class SoftwareDevice; |
| 86 | 86 |
| 87 void InvokeComposite(const gfx::Transform& transform, | 87 void InvokeComposite(const gfx::Transform& transform, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 104 gfx::Rect cached_hw_viewport_rect_for_tile_priority_; | 104 gfx::Rect cached_hw_viewport_rect_for_tile_priority_; |
| 105 gfx::Transform cached_hw_transform_for_tile_priority_; | 105 gfx::Transform cached_hw_transform_for_tile_priority_; |
| 106 | 106 |
| 107 // Only valid (non-NULL) during a DemandDrawSw() call. | 107 // Only valid (non-NULL) during a DemandDrawSw() call. |
| 108 SkCanvas* current_sw_canvas_; | 108 SkCanvas* current_sw_canvas_; |
| 109 | 109 |
| 110 cc::ManagedMemoryPolicy memory_policy_; | 110 cc::ManagedMemoryPolicy memory_policy_; |
| 111 | 111 |
| 112 scoped_ptr<cc::CompositorFrame> frame_holder_; | 112 scoped_ptr<cc::CompositorFrame> frame_holder_; |
| 113 | 113 |
| 114 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 114 scoped_refptr<FrameUpdateMessageQueue> frame_update_message_queue_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); | 116 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 } // namespace content | 119 } // namespace content |
| 120 | 120 |
| 121 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF
ACE_H_ | 121 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF
ACE_H_ |
| OLD | NEW |