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_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 class CONTENT_EXPORT SynchronousCompositor { | 40 class CONTENT_EXPORT SynchronousCompositor { |
41 public: | 41 public: |
42 // Must be called once per WebContents instance. Will create the compositor | 42 // Must be called once per WebContents instance. Will create the compositor |
43 // instance as needed, but only if |client| is non-nullptr. | 43 // instance as needed, but only if |client| is non-nullptr. |
44 static void SetClientForWebContents(WebContents* contents, | 44 static void SetClientForWebContents(WebContents* contents, |
45 SynchronousCompositorClient* client); | 45 SynchronousCompositorClient* client); |
46 | 46 |
47 static void SetGpuService( | 47 static void SetGpuService( |
48 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); | 48 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); |
49 | 49 |
| 50 struct Frame { |
| 51 Frame(); |
| 52 ~Frame(); |
| 53 |
| 54 // Movable type. |
| 55 Frame(Frame&& rhs); |
| 56 Frame& operator=(Frame&& rhs); |
| 57 |
| 58 uint32_t output_surface_id; |
| 59 scoped_ptr<cc::CompositorFrame> frame; |
| 60 |
| 61 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(Frame); |
| 63 }; |
| 64 |
50 // "On demand" hardware draw. The content is first clipped to |damage_area|, | 65 // "On demand" hardware draw. The content is first clipped to |damage_area|, |
51 // then transformed through |transform|, and finally clipped to |view_size|. | 66 // then transformed through |transform|, and finally clipped to |view_size|. |
52 virtual scoped_ptr<cc::CompositorFrame> DemandDrawHw( | 67 virtual Frame DemandDrawHw( |
53 const gfx::Size& surface_size, | 68 const gfx::Size& surface_size, |
54 const gfx::Transform& transform, | 69 const gfx::Transform& transform, |
55 const gfx::Rect& viewport, | 70 const gfx::Rect& viewport, |
56 const gfx::Rect& clip, | 71 const gfx::Rect& clip, |
57 const gfx::Rect& viewport_rect_for_tile_priority, | 72 const gfx::Rect& viewport_rect_for_tile_priority, |
58 const gfx::Transform& transform_for_tile_priority) = 0; | 73 const gfx::Transform& transform_for_tile_priority) = 0; |
59 | 74 |
60 // For delegated rendering, return resources from parent compositor to this. | 75 // For delegated rendering, return resources from parent compositor to this. |
61 // Note that all resources must be returned before ReleaseHwDraw. | 76 // Note that all resources must be returned before ReleaseHwDraw. |
62 virtual void ReturnResources(const cc::CompositorFrameAck& frame_ack) = 0; | 77 virtual void ReturnResources(uint32_t output_surface_id, |
| 78 const cc::CompositorFrameAck& frame_ack) = 0; |
63 | 79 |
64 // "On demand" SW draw, into the supplied canvas (observing the transform | 80 // "On demand" SW draw, into the supplied canvas (observing the transform |
65 // and clip set there-in). | 81 // and clip set there-in). |
66 virtual bool DemandDrawSw(SkCanvas* canvas) = 0; | 82 virtual bool DemandDrawSw(SkCanvas* canvas) = 0; |
67 | 83 |
68 // Set the memory limit policy of this compositor. | 84 // Set the memory limit policy of this compositor. |
69 virtual void SetMemoryPolicy(size_t bytes_limit) = 0; | 85 virtual void SetMemoryPolicy(size_t bytes_limit) = 0; |
70 | 86 |
71 // Should be called by the embedder after the embedder had modified the | 87 // Should be called by the embedder after the embedder had modified the |
72 // scroll offset of the root layer. | 88 // scroll offset of the root layer. |
73 virtual void DidChangeRootLayerScrollOffset( | 89 virtual void DidChangeRootLayerScrollOffset( |
74 const gfx::ScrollOffset& root_offset) = 0; | 90 const gfx::ScrollOffset& root_offset) = 0; |
75 | 91 |
76 // Called by the embedder to notify that the compositor is active. The | 92 // Called by the embedder to notify that the compositor is active. The |
77 // compositor won't ask for vsyncs when it's inactive. NOTE: The compositor | 93 // compositor won't ask for vsyncs when it's inactive. NOTE: The compositor |
78 // starts off as inactive and needs a SetActive(true) call to begin. | 94 // starts off as inactive and needs a SetActive(true) call to begin. |
79 virtual void SetIsActive(bool is_active) = 0; | 95 virtual void SetIsActive(bool is_active) = 0; |
80 | 96 |
81 // Called by the embedder to notify that the OnComputeScroll step is happening | 97 // Called by the embedder to notify that the OnComputeScroll step is happening |
82 // and if any input animation is active, it should tick now. | 98 // and if any input animation is active, it should tick now. |
83 virtual void OnComputeScroll(base::TimeTicks animation_time) = 0; | 99 virtual void OnComputeScroll(base::TimeTicks animation_time) = 0; |
84 | 100 |
85 protected: | 101 protected: |
86 virtual ~SynchronousCompositor() {} | 102 virtual ~SynchronousCompositor() {} |
87 }; | 103 }; |
88 | 104 |
89 } // namespace content | 105 } // namespace content |
90 | 106 |
91 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 107 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
OLD | NEW |