| 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_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
| 23 #include "ui/gfx/transform.h" | 23 #include "ui/gfx/transform.h" |
| 24 | 24 |
| 25 namespace cc { | 25 namespace cc { |
| 26 class ContextProvider; | 26 class ContextProvider; |
| 27 class CompositorFrameMetadata; | 27 class CompositorFrameMetadata; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace IPC { | 30 namespace IPC { |
| 31 class Message; | 31 class Message; |
| 32 class Sender; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace content { | 35 namespace content { |
| 35 | 36 |
| 36 class FrameSwapMessageQueue; | 37 class FrameSwapMessageQueue; |
| 37 class SynchronousCompositorRegistry; | 38 class SynchronousCompositorRegistry; |
| 38 class WebGraphicsContext3DCommandBufferImpl; | 39 class WebGraphicsContext3DCommandBufferImpl; |
| 39 | 40 |
| 40 class SynchronousCompositorOutputSurfaceClient { | 41 class SynchronousCompositorOutputSurfaceClient { |
| 41 public: | 42 public: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void Invalidate() override; | 81 void Invalidate() override; |
| 81 | 82 |
| 82 // Partial SynchronousCompositor API implementation. | 83 // Partial SynchronousCompositor API implementation. |
| 83 void DemandDrawHw(const gfx::Size& surface_size, | 84 void DemandDrawHw(const gfx::Size& surface_size, |
| 84 const gfx::Transform& transform, | 85 const gfx::Transform& transform, |
| 85 const gfx::Rect& viewport, | 86 const gfx::Rect& viewport, |
| 86 const gfx::Rect& clip, | 87 const gfx::Rect& clip, |
| 87 const gfx::Rect& viewport_rect_for_tile_priority, | 88 const gfx::Rect& viewport_rect_for_tile_priority, |
| 88 const gfx::Transform& transform_for_tile_priority); | 89 const gfx::Transform& transform_for_tile_priority); |
| 89 void DemandDrawSw(SkCanvas* canvas); | 90 void DemandDrawSw(SkCanvas* canvas); |
| 90 void SetMemoryPolicy(size_t bytes_limit); | |
| 91 void SetTreeActivationCallback(const base::Closure& callback); | 91 void SetTreeActivationCallback(const base::Closure& callback); |
| 92 void GetMessagesToDeliver( | 92 void GetMessagesToDeliver( |
| 93 std::vector<std::unique_ptr<IPC::Message>>* messages); | 93 std::vector<std::unique_ptr<IPC::Message>>* messages); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 class SoftwareDevice; | 96 class SoftwareDevice; |
| 97 friend class SoftwareDevice; | 97 friend class SoftwareDevice; |
| 98 | 98 |
| 99 void InvokeComposite(const gfx::Transform& transform, | 99 void InvokeComposite(const gfx::Transform& transform, |
| 100 const gfx::Rect& viewport, | 100 const gfx::Rect& viewport, |
| 101 const gfx::Rect& clip, | 101 const gfx::Rect& clip, |
| 102 bool hardware_draw); | 102 bool hardware_draw); |
| 103 bool Send(IPC::Message* message); |
| 103 bool CalledOnValidThread() const; | 104 bool CalledOnValidThread() const; |
| 104 | 105 |
| 105 void CancelFallbackTick(); | 106 void CancelFallbackTick(); |
| 106 void FallbackTickFired(); | 107 void FallbackTickFired(); |
| 107 | 108 |
| 108 // IPC handlers. | 109 // IPC handlers. |
| 110 void SetMemoryPolicy(size_t bytes_limit); |
| 109 void OnReclaimResources(uint32_t output_surface_id, | 111 void OnReclaimResources(uint32_t output_surface_id, |
| 110 const cc::CompositorFrameAck& ack); | 112 const cc::CompositorFrameAck& ack); |
| 111 | 113 |
| 112 const int routing_id_; | 114 const int routing_id_; |
| 113 const uint32_t output_surface_id_; | 115 const uint32_t output_surface_id_; |
| 114 SynchronousCompositorRegistry* const registry_; // unowned | 116 SynchronousCompositorRegistry* const registry_; // Not owned. |
| 117 IPC::Sender* const sender_; // Not owned. |
| 115 bool registered_; | 118 bool registered_; |
| 116 | 119 |
| 117 // Not owned. | 120 // Not owned. |
| 118 SynchronousCompositorOutputSurfaceClient* sync_client_; | 121 SynchronousCompositorOutputSurfaceClient* sync_client_; |
| 119 | 122 |
| 120 // Only valid (non-NULL) during a DemandDrawSw() call. | 123 // Only valid (non-NULL) during a DemandDrawSw() call. |
| 121 SkCanvas* current_sw_canvas_; | 124 SkCanvas* current_sw_canvas_; |
| 122 | 125 |
| 123 cc::ManagedMemoryPolicy memory_policy_; | 126 cc::ManagedMemoryPolicy memory_policy_; |
| 124 bool did_swap_; | 127 bool did_swap_; |
| 125 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 128 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
| 126 | 129 |
| 127 base::CancelableClosure fallback_tick_; | 130 base::CancelableClosure fallback_tick_; |
| 128 bool fallback_tick_pending_; | 131 bool fallback_tick_pending_; |
| 129 bool fallback_tick_running_; | 132 bool fallback_tick_running_; |
| 130 | 133 |
| 131 base::ThreadChecker thread_checker_; | 134 base::ThreadChecker thread_checker_; |
| 132 | 135 |
| 133 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); | 136 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 } // namespace content | 139 } // namespace content |
| 137 | 140 |
| 138 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ | 141 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |