| 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_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ | 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 namespace content { | 42 namespace content { |
| 43 | 43 |
| 44 class FrameSwapMessageQueue; | 44 class FrameSwapMessageQueue; |
| 45 class SynchronousCompositorRegistry; | 45 class SynchronousCompositorRegistry; |
| 46 class WebGraphicsContext3DCommandBufferImpl; | 46 class WebGraphicsContext3DCommandBufferImpl; |
| 47 | 47 |
| 48 class SynchronousCompositorFrameSinkClient { | 48 class SynchronousCompositorFrameSinkClient { |
| 49 public: | 49 public: |
| 50 virtual void DidActivatePendingTree() = 0; | 50 virtual void DidActivatePendingTree() = 0; |
| 51 virtual void Invalidate() = 0; | 51 virtual void Invalidate() = 0; |
| 52 virtual void SwapBuffers(uint32_t compositor_frame_sink_id, | 52 virtual void SubmitCompositorFrame(uint32_t compositor_frame_sink_id, |
| 53 cc::CompositorFrame frame) = 0; | 53 cc::CompositorFrame frame) = 0; |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 virtual ~SynchronousCompositorFrameSinkClient() {} | 56 virtual ~SynchronousCompositorFrameSinkClient() {} |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Specialization of the output surface that adapts it to implement the | 59 // Specialization of the output surface that adapts it to implement the |
| 60 // content::SynchronousCompositor public API. This class effects an "inversion | 60 // content::SynchronousCompositor public API. This class effects an "inversion |
| 61 // of control" - enabling drawing to be orchestrated by the embedding | 61 // of control" - enabling drawing to be orchestrated by the embedding |
| 62 // layer, instead of driven by the compositor internals - hence it holds two | 62 // layer, instead of driven by the compositor internals - hence it holds two |
| 63 // 'client' pointers (|client_| in the CompositorFrameSink baseclass and | 63 // 'client' pointers (|client_| in the CompositorFrameSink baseclass and |
| (...skipping 13 matching lines...) Expand all Loading... |
| 77 SynchronousCompositorRegistry* registry, | 77 SynchronousCompositorRegistry* registry, |
| 78 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue); | 78 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue); |
| 79 ~SynchronousCompositorFrameSink() override; | 79 ~SynchronousCompositorFrameSink() override; |
| 80 | 80 |
| 81 void SetSyncClient(SynchronousCompositorFrameSinkClient* compositor); | 81 void SetSyncClient(SynchronousCompositorFrameSinkClient* compositor); |
| 82 bool OnMessageReceived(const IPC::Message& message); | 82 bool OnMessageReceived(const IPC::Message& message); |
| 83 | 83 |
| 84 // cc::CompositorFrameSink implementation. | 84 // cc::CompositorFrameSink implementation. |
| 85 bool BindToClient(cc::CompositorFrameSinkClient* sink_client) override; | 85 bool BindToClient(cc::CompositorFrameSinkClient* sink_client) override; |
| 86 void DetachFromClient() override; | 86 void DetachFromClient() override; |
| 87 void SwapBuffers(cc::CompositorFrame frame) override; | 87 void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| 88 void Invalidate() override; | 88 void Invalidate() override; |
| 89 | 89 |
| 90 // Partial SynchronousCompositor API implementation. | 90 // Partial SynchronousCompositor API implementation. |
| 91 void DemandDrawHw(const gfx::Size& viewport_size, | 91 void DemandDrawHw(const gfx::Size& viewport_size, |
| 92 const gfx::Rect& viewport_rect_for_tile_priority, | 92 const gfx::Rect& viewport_rect_for_tile_priority, |
| 93 const gfx::Transform& transform_for_tile_priority); | 93 const gfx::Transform& transform_for_tile_priority); |
| 94 void DemandDrawSw(SkCanvas* canvas); | 94 void DemandDrawSw(SkCanvas* canvas); |
| 95 | 95 |
| 96 // SurfaceFactoryClient implementation. | 96 // SurfaceFactoryClient implementation. |
| 97 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 97 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 121 IPC::Sender* const sender_; // Not owned. | 121 IPC::Sender* const sender_; // Not owned. |
| 122 | 122 |
| 123 // Not owned. | 123 // Not owned. |
| 124 SynchronousCompositorFrameSinkClient* sync_client_ = nullptr; | 124 SynchronousCompositorFrameSinkClient* sync_client_ = nullptr; |
| 125 | 125 |
| 126 // Only valid (non-NULL) during a DemandDrawSw() call. | 126 // Only valid (non-NULL) during a DemandDrawSw() call. |
| 127 SkCanvas* current_sw_canvas_ = nullptr; | 127 SkCanvas* current_sw_canvas_ = nullptr; |
| 128 | 128 |
| 129 cc::ManagedMemoryPolicy memory_policy_; | 129 cc::ManagedMemoryPolicy memory_policy_; |
| 130 bool in_software_draw_ = false; | 130 bool in_software_draw_ = false; |
| 131 bool did_swap_ = false; | 131 bool did_submit_frame_ = false; |
| 132 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 132 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
| 133 | 133 |
| 134 base::CancelableClosure fallback_tick_; | 134 base::CancelableClosure fallback_tick_; |
| 135 bool fallback_tick_pending_ = false; | 135 bool fallback_tick_pending_ = false; |
| 136 bool fallback_tick_running_ = false; | 136 bool fallback_tick_running_ = false; |
| 137 | 137 |
| 138 class StubDisplayClient : public cc::DisplayClient { | 138 class StubDisplayClient : public cc::DisplayClient { |
| 139 void DisplayOutputSurfaceLost() override {} | 139 void DisplayOutputSurfaceLost() override {} |
| 140 void DisplayWillDrawAndSwap( | 140 void DisplayWillDrawAndSwap( |
| 141 bool will_draw_and_swap, | 141 bool will_draw_and_swap, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 161 gfx::Rect sw_viewport_for_current_draw_; | 161 gfx::Rect sw_viewport_for_current_draw_; |
| 162 | 162 |
| 163 base::ThreadChecker thread_checker_; | 163 base::ThreadChecker thread_checker_; |
| 164 | 164 |
| 165 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorFrameSink); | 165 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorFrameSink); |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 } // namespace content | 168 } // namespace content |
| 169 | 169 |
| 170 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ | 170 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |