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_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ |
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ | 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE
_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "cc/output/compositor_frame.h" |
12 #include "cc/output/managed_memory_policy.h" | 13 #include "cc/output/managed_memory_policy.h" |
13 #include "cc/output/output_surface.h" | 14 #include "cc/output/output_surface.h" |
14 #include "content/public/browser/android/synchronous_compositor.h" | 15 #include "content/public/browser/android/synchronous_compositor.h" |
15 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 class ContextProvider; | 19 class ContextProvider; |
19 class CompositorFrameMetadata; | 20 class CompositorFrameMetadata; |
20 } | 21 } |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 class SynchronousCompositorClient; | 25 class SynchronousCompositorClient; |
25 class SynchronousCompositorOutputSurface; | 26 class SynchronousCompositorOutputSurface; |
26 class WebGraphicsContext3DCommandBufferImpl; | 27 class WebGraphicsContext3DCommandBufferImpl; |
27 | 28 |
28 class SynchronousCompositorOutputSurfaceDelegate { | 29 class SynchronousCompositorOutputSurfaceDelegate { |
29 public: | 30 public: |
30 virtual void DidBindOutputSurface( | 31 virtual void DidBindOutputSurface( |
31 SynchronousCompositorOutputSurface* output_surface) = 0; | 32 SynchronousCompositorOutputSurface* output_surface) = 0; |
32 virtual void DidDestroySynchronousOutputSurface( | 33 virtual void DidDestroySynchronousOutputSurface( |
33 SynchronousCompositorOutputSurface* output_surface) = 0; | 34 SynchronousCompositorOutputSurface* output_surface) = 0; |
34 virtual void SetContinuousInvalidate(bool enable) = 0; | 35 virtual void SetContinuousInvalidate(bool enable) = 0; |
35 virtual void UpdateFrameMetaData( | |
36 const cc::CompositorFrameMetadata& frame_metadata) = 0; | |
37 virtual void DidActivatePendingTree() = 0; | 36 virtual void DidActivatePendingTree() = 0; |
38 | 37 |
39 protected: | 38 protected: |
40 SynchronousCompositorOutputSurfaceDelegate() {} | 39 SynchronousCompositorOutputSurfaceDelegate() {} |
41 virtual ~SynchronousCompositorOutputSurfaceDelegate() {} | 40 virtual ~SynchronousCompositorOutputSurfaceDelegate() {} |
42 }; | 41 }; |
43 | 42 |
44 // Specialization of the output surface that adapts it to implement the | 43 // Specialization of the output surface that adapts it to implement the |
45 // content::SynchronousCompositor public API. This class effects an "inversion | 44 // content::SynchronousCompositor public API. This class effects an "inversion |
46 // of control" - enabling drawing to be orchestrated by the embedding | 45 // of control" - enabling drawing to be orchestrated by the embedding |
(...skipping 16 matching lines...) Expand all Loading... |
63 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; | 62 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; |
64 | 63 |
65 // Partial SynchronousCompositor API implementation. | 64 // Partial SynchronousCompositor API implementation. |
66 bool InitializeHwDraw( | 65 bool InitializeHwDraw( |
67 scoped_refptr<cc::ContextProvider> onscreen_context_provider); | 66 scoped_refptr<cc::ContextProvider> onscreen_context_provider); |
68 void ReleaseHwDraw(); | 67 void ReleaseHwDraw(); |
69 bool DemandDrawHw(gfx::Size surface_size, | 68 bool DemandDrawHw(gfx::Size surface_size, |
70 const gfx::Transform& transform, | 69 const gfx::Transform& transform, |
71 gfx::Rect viewport, | 70 gfx::Rect viewport, |
72 gfx::Rect clip, | 71 gfx::Rect clip, |
73 bool stencil_enabled); | 72 bool stencil_enabled, |
74 bool DemandDrawSw(SkCanvas* canvas); | 73 cc::CompositorFrame* frame); |
| 74 void ReturnResources(const cc::CompositorFrameAck& frame_ack); |
| 75 bool DemandDrawSw(SkCanvas* canvas, cc::CompositorFrame* frame); |
75 void SetMemoryPolicy(const SynchronousCompositorMemoryPolicy& policy); | 76 void SetMemoryPolicy(const SynchronousCompositorMemoryPolicy& policy); |
76 | 77 |
77 private: | 78 private: |
78 class SoftwareDevice; | 79 class SoftwareDevice; |
79 friend class SoftwareDevice; | 80 friend class SoftwareDevice; |
80 | 81 |
81 void InvokeComposite(const gfx::Transform& transform, | 82 void InvokeComposite(const gfx::Transform& transform, |
82 gfx::Rect viewport, | 83 gfx::Rect viewport, |
83 gfx::Rect clip, | 84 gfx::Rect clip, |
84 bool valid_for_tile_management); | 85 bool valid_for_tile_management); |
85 bool CalledOnValidThread() const; | 86 bool CalledOnValidThread() const; |
86 SynchronousCompositorOutputSurfaceDelegate* GetDelegate(); | 87 SynchronousCompositorOutputSurfaceDelegate* GetDelegate(); |
87 void UpdateFrameMetaData(const cc::CompositorFrameMetadata& frame_info); | |
88 | 88 |
89 int routing_id_; | 89 int routing_id_; |
90 bool needs_begin_frame_; | 90 bool needs_begin_frame_; |
91 bool invoking_composite_; | 91 bool invoking_composite_; |
92 bool did_swap_buffer_; | 92 bool did_swap_buffer_; |
93 | 93 |
94 gfx::Transform cached_hw_transform_; | 94 gfx::Transform cached_hw_transform_; |
95 gfx::Rect cached_hw_viewport_; | 95 gfx::Rect cached_hw_viewport_; |
96 gfx::Rect cached_hw_clip_; | 96 gfx::Rect cached_hw_clip_; |
97 | 97 |
98 // Only valid (non-NULL) during a DemandDrawSw() call. | 98 // Only valid (non-NULL) during a DemandDrawSw() call. |
99 SkCanvas* current_sw_canvas_; | 99 SkCanvas* current_sw_canvas_; |
100 | 100 |
101 cc::ManagedMemoryPolicy memory_policy_; | 101 cc::ManagedMemoryPolicy memory_policy_; |
102 | 102 |
103 cc::OutputSurfaceClient* output_surface_client_; | 103 cc::OutputSurfaceClient* output_surface_client_; |
104 | 104 cc::CompositorFrame* frame_; |
105 base::WeakPtrFactory<SynchronousCompositorOutputSurface> weak_ptr_factory_; | |
106 | 105 |
107 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); | 106 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); |
108 }; | 107 }; |
109 | 108 |
110 } // namespace content | 109 } // namespace content |
111 | 110 |
112 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF
ACE_H_ | 111 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF
ACE_H_ |
OLD | NEW |