| 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> |
| 11 #include <vector> | |
| 12 | 11 |
| 13 #include "base/callback.h" | 12 #include "base/callback.h" |
| 14 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
| 15 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" | 15 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 18 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 19 #include "cc/output/compositor_frame.h" | 18 #include "cc/output/compositor_frame.h" |
| 20 #include "cc/output/managed_memory_policy.h" | 19 #include "cc/output/managed_memory_policy.h" |
| 21 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 } | 32 } |
| 34 | 33 |
| 35 namespace content { | 34 namespace content { |
| 36 | 35 |
| 37 class FrameSwapMessageQueue; | 36 class FrameSwapMessageQueue; |
| 38 class SynchronousCompositorRegistry; | 37 class SynchronousCompositorRegistry; |
| 39 class WebGraphicsContext3DCommandBufferImpl; | 38 class WebGraphicsContext3DCommandBufferImpl; |
| 40 | 39 |
| 41 class SynchronousCompositorOutputSurfaceClient { | 40 class SynchronousCompositorOutputSurfaceClient { |
| 42 public: | 41 public: |
| 42 virtual void DidActivatePendingTree() = 0; |
| 43 virtual void Invalidate() = 0; | 43 virtual void Invalidate() = 0; |
| 44 virtual void SwapBuffers(uint32_t output_surface_id, | 44 virtual void SwapBuffers(uint32_t output_surface_id, |
| 45 cc::CompositorFrame* frame) = 0; | 45 cc::CompositorFrame* frame) = 0; |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 virtual ~SynchronousCompositorOutputSurfaceClient() {} | 48 virtual ~SynchronousCompositorOutputSurfaceClient() {} |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Specialization of the output surface that adapts it to implement the | 51 // Specialization of the output surface that adapts it to implement the |
| 52 // content::SynchronousCompositor public API. This class effects an "inversion | 52 // content::SynchronousCompositor public API. This class effects an "inversion |
| (...skipping 28 matching lines...) Expand all Loading... |
| 81 void Invalidate() override; | 81 void Invalidate() override; |
| 82 | 82 |
| 83 // Partial SynchronousCompositor API implementation. | 83 // Partial SynchronousCompositor API implementation. |
| 84 void DemandDrawHw(const gfx::Size& surface_size, | 84 void DemandDrawHw(const gfx::Size& surface_size, |
| 85 const gfx::Transform& transform, | 85 const gfx::Transform& transform, |
| 86 const gfx::Rect& viewport, | 86 const gfx::Rect& viewport, |
| 87 const gfx::Rect& clip, | 87 const gfx::Rect& clip, |
| 88 const gfx::Rect& viewport_rect_for_tile_priority, | 88 const gfx::Rect& viewport_rect_for_tile_priority, |
| 89 const gfx::Transform& transform_for_tile_priority); | 89 const gfx::Transform& transform_for_tile_priority); |
| 90 void DemandDrawSw(SkCanvas* canvas); | 90 void DemandDrawSw(SkCanvas* canvas); |
| 91 void SetTreeActivationCallback(const base::Closure& callback); | |
| 92 void GetMessagesToDeliver( | |
| 93 std::vector<std::unique_ptr<IPC::Message>>* messages); | |
| 94 | 91 |
| 95 private: | 92 private: |
| 96 class SoftwareDevice; | 93 class SoftwareDevice; |
| 97 friend class SoftwareDevice; | 94 friend class SoftwareDevice; |
| 98 | 95 |
| 99 void InvokeComposite(const gfx::Transform& transform, | 96 void InvokeComposite(const gfx::Transform& transform, |
| 100 const gfx::Rect& viewport, | 97 const gfx::Rect& viewport, |
| 101 const gfx::Rect& clip, | 98 const gfx::Rect& clip, |
| 102 bool hardware_draw); | 99 bool hardware_draw); |
| 103 bool Send(IPC::Message* message); | 100 bool Send(IPC::Message* message); |
| 101 void DidActivatePendingTree(); |
| 102 void DeliverMessages(); |
| 104 bool CalledOnValidThread() const; | 103 bool CalledOnValidThread() const; |
| 105 | 104 |
| 106 void CancelFallbackTick(); | 105 void CancelFallbackTick(); |
| 107 void FallbackTickFired(); | 106 void FallbackTickFired(); |
| 108 | 107 |
| 109 // IPC handlers. | 108 // IPC handlers. |
| 110 void SetMemoryPolicy(size_t bytes_limit); | 109 void SetMemoryPolicy(size_t bytes_limit); |
| 111 void OnReclaimResources(uint32_t output_surface_id, | 110 void OnReclaimResources(uint32_t output_surface_id, |
| 112 const cc::CompositorFrameAck& ack); | 111 const cc::CompositorFrameAck& ack); |
| 113 | 112 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 132 bool fallback_tick_running_; | 131 bool fallback_tick_running_; |
| 133 | 132 |
| 134 base::ThreadChecker thread_checker_; | 133 base::ThreadChecker thread_checker_; |
| 135 | 134 |
| 136 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); | 135 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 } // namespace content | 138 } // namespace content |
| 140 | 139 |
| 141 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ | 140 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |