Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 SynchronousCompositorOutputSurface( | 61 SynchronousCompositorOutputSurface( |
| 62 const scoped_refptr<cc::ContextProvider>& context_provider, | 62 const scoped_refptr<cc::ContextProvider>& context_provider, |
| 63 const scoped_refptr<cc::ContextProvider>& worker_context_provider, | 63 const scoped_refptr<cc::ContextProvider>& worker_context_provider, |
| 64 int routing_id, | 64 int routing_id, |
| 65 uint32_t output_surface_id, | 65 uint32_t output_surface_id, |
| 66 SynchronousCompositorRegistry* registry, | 66 SynchronousCompositorRegistry* registry, |
| 67 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue); | 67 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue); |
| 68 ~SynchronousCompositorOutputSurface() override; | 68 ~SynchronousCompositorOutputSurface() override; |
| 69 | 69 |
| 70 void SetSyncClient(SynchronousCompositorOutputSurfaceClient* compositor); | 70 void SetSyncClient(SynchronousCompositorOutputSurfaceClient* compositor); |
| 71 bool OnMessageReceived(const IPC::Message& message); | |
| 71 | 72 |
| 72 // OutputSurface. | 73 // OutputSurface. |
| 73 bool BindToClient(cc::OutputSurfaceClient* surface_client) override; | 74 bool BindToClient(cc::OutputSurfaceClient* surface_client) override; |
| 74 void DetachFromClient() override; | 75 void DetachFromClient() override; |
| 75 void Reshape(const gfx::Size& size, | 76 void Reshape(const gfx::Size& size, |
| 76 float scale_factor, | 77 float scale_factor, |
| 77 bool has_alpha) override; | 78 bool has_alpha) override; |
| 78 void SwapBuffers(cc::CompositorFrame* frame) override; | 79 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 79 void Invalidate() override; | 80 void Invalidate() override; |
| 80 | 81 |
| 81 // Partial SynchronousCompositor API implementation. | 82 // Partial SynchronousCompositor API implementation. |
| 82 void DemandDrawHw(const gfx::Size& surface_size, | 83 void DemandDrawHw(const gfx::Size& surface_size, |
| 83 const gfx::Transform& transform, | 84 const gfx::Transform& transform, |
| 84 const gfx::Rect& viewport, | 85 const gfx::Rect& viewport, |
| 85 const gfx::Rect& clip, | 86 const gfx::Rect& clip, |
| 86 const gfx::Rect& viewport_rect_for_tile_priority, | 87 const gfx::Rect& viewport_rect_for_tile_priority, |
| 87 const gfx::Transform& transform_for_tile_priority); | 88 const gfx::Transform& transform_for_tile_priority); |
| 88 void ReturnResources(uint32_t output_surface_id, | |
| 89 const cc::CompositorFrameAck& frame_ack); | |
| 90 void DemandDrawSw(SkCanvas* canvas); | 89 void DemandDrawSw(SkCanvas* canvas); |
| 91 void SetMemoryPolicy(size_t bytes_limit); | 90 void SetMemoryPolicy(size_t bytes_limit); |
| 92 void SetTreeActivationCallback(const base::Closure& callback); | 91 void SetTreeActivationCallback(const base::Closure& callback); |
| 93 void GetMessagesToDeliver( | 92 void GetMessagesToDeliver( |
| 94 std::vector<std::unique_ptr<IPC::Message>>* messages); | 93 std::vector<std::unique_ptr<IPC::Message>>* messages); |
| 95 | 94 |
| 96 size_t GetMemoryPolicy() const { | |
|
hush (inactive)
2016/05/09 23:52:10
so... this function is not used by anybody?
boliu
2016/05/10 00:00:45
nope
| |
| 97 return memory_policy_.bytes_limit_when_visible; | |
| 98 } | |
| 99 | |
| 100 private: | 95 private: |
| 101 class SoftwareDevice; | 96 class SoftwareDevice; |
| 102 friend class SoftwareDevice; | 97 friend class SoftwareDevice; |
| 103 | 98 |
| 104 void InvokeComposite(const gfx::Transform& transform, | 99 void InvokeComposite(const gfx::Transform& transform, |
| 105 const gfx::Rect& viewport, | 100 const gfx::Rect& viewport, |
| 106 const gfx::Rect& clip, | 101 const gfx::Rect& clip, |
| 107 bool hardware_draw); | 102 bool hardware_draw); |
| 108 bool CalledOnValidThread() const; | 103 bool CalledOnValidThread() const; |
| 109 | 104 |
| 110 void CancelFallbackTick(); | 105 void CancelFallbackTick(); |
| 111 void FallbackTickFired(); | 106 void FallbackTickFired(); |
| 112 | 107 |
| 108 // IPC handlers. | |
| 109 void OnReclaimResources(uint32_t output_surface_id, | |
| 110 const cc::CompositorFrameAck& ack); | |
| 111 | |
| 113 const int routing_id_; | 112 const int routing_id_; |
| 114 const uint32_t output_surface_id_; | 113 const uint32_t output_surface_id_; |
| 115 SynchronousCompositorRegistry* const registry_; // unowned | 114 SynchronousCompositorRegistry* const registry_; // unowned |
| 116 bool registered_; | 115 bool registered_; |
| 117 | 116 |
| 118 // Not owned. | 117 // Not owned. |
| 119 SynchronousCompositorOutputSurfaceClient* sync_client_; | 118 SynchronousCompositorOutputSurfaceClient* sync_client_; |
| 120 | 119 |
| 121 // Only valid (non-NULL) during a DemandDrawSw() call. | 120 // Only valid (non-NULL) during a DemandDrawSw() call. |
| 122 SkCanvas* current_sw_canvas_; | 121 SkCanvas* current_sw_canvas_; |
| 123 | 122 |
| 124 cc::ManagedMemoryPolicy memory_policy_; | 123 cc::ManagedMemoryPolicy memory_policy_; |
| 125 bool did_swap_; | 124 bool did_swap_; |
| 126 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 125 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
| 127 | 126 |
| 128 base::CancelableClosure fallback_tick_; | 127 base::CancelableClosure fallback_tick_; |
| 129 bool fallback_tick_pending_; | 128 bool fallback_tick_pending_; |
| 130 bool fallback_tick_running_; | 129 bool fallback_tick_running_; |
| 131 | 130 |
| 132 base::ThreadChecker thread_checker_; | 131 base::ThreadChecker thread_checker_; |
| 133 | 132 |
| 134 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); | 133 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); |
| 135 }; | 134 }; |
| 136 | 135 |
| 137 } // namespace content | 136 } // namespace content |
| 138 | 137 |
| 139 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ | 138 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |