OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHILD_FRAME_COMPOSITING_HELPER_H_ | 5 #ifndef CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_ |
6 #define CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_ | 6 #define CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
14 #include "cc/layers/delegated_frame_resource_collection.h" | 14 #include "cc/layers/delegated_frame_resource_collection.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class SharedMemory; | 19 class SharedMemory; |
20 } | 20 } |
21 | 21 |
22 namespace cc { | 22 namespace cc { |
| 23 struct SurfaceId; |
| 24 struct SurfaceSequence; |
| 25 |
23 class CompositorFrame; | 26 class CompositorFrame; |
24 class Layer; | 27 class Layer; |
25 class SolidColorLayer; | 28 class SolidColorLayer; |
| 29 class SurfaceLayer; |
26 class DelegatedFrameProvider; | 30 class DelegatedFrameProvider; |
27 class DelegatedFrameResourceCollection; | 31 class DelegatedFrameResourceCollection; |
28 class DelegatedRendererLayer; | 32 class DelegatedRendererLayer; |
29 } | 33 } |
30 | 34 |
31 namespace blink { | 35 namespace blink { |
32 class WebFrame; | 36 class WebFrame; |
33 class WebPluginContainer; | 37 class WebPluginContainer; |
34 class WebLayer; | 38 class WebLayer; |
35 } | 39 } |
(...skipping 23 matching lines...) Expand all Loading... |
59 RenderFrameProxy* render_frame_proxy); | 63 RenderFrameProxy* render_frame_proxy); |
60 | 64 |
61 void DidCommitCompositorFrame(); | 65 void DidCommitCompositorFrame(); |
62 void EnableCompositing(bool); | 66 void EnableCompositing(bool); |
63 void OnContainerDestroy(); | 67 void OnContainerDestroy(); |
64 void OnCompositorFrameSwapped(scoped_ptr<cc::CompositorFrame> frame, | 68 void OnCompositorFrameSwapped(scoped_ptr<cc::CompositorFrame> frame, |
65 int route_id, | 69 int route_id, |
66 uint32 output_surface_id, | 70 uint32 output_surface_id, |
67 int host_id, | 71 int host_id, |
68 base::SharedMemoryHandle handle); | 72 base::SharedMemoryHandle handle); |
| 73 void OnSetSurface(const cc::SurfaceId& surface_id, |
| 74 const gfx::Size& frame_size, |
| 75 float scale_factor, |
| 76 const cc::SurfaceSequence& sequence); |
69 void UpdateVisibility(bool); | 77 void UpdateVisibility(bool); |
70 void ChildFrameGone(); | 78 void ChildFrameGone(); |
71 | 79 |
72 // cc::DelegatedFrameProviderClient implementation. | 80 // cc::DelegatedFrameProviderClient implementation. |
73 void UnusedResourcesAreAvailable() override; | 81 void UnusedResourcesAreAvailable() override; |
74 void SetContentsOpaque(bool); | 82 void SetContentsOpaque(bool); |
75 | 83 |
76 protected: | 84 protected: |
77 // Friend RefCounted so that the dtor can be non-public. | 85 // Friend RefCounted so that the dtor can be non-public. |
78 friend class base::RefCounted<ChildFrameCompositingHelper>; | 86 friend class base::RefCounted<ChildFrameCompositingHelper>; |
(...skipping 12 matching lines...) Expand all Loading... |
91 int GetInstanceID(); | 99 int GetInstanceID(); |
92 | 100 |
93 void SendCompositorFrameSwappedACKToBrowser( | 101 void SendCompositorFrameSwappedACKToBrowser( |
94 FrameHostMsg_CompositorFrameSwappedACK_Params& params); | 102 FrameHostMsg_CompositorFrameSwappedACK_Params& params); |
95 void SendReclaimCompositorResourcesToBrowser( | 103 void SendReclaimCompositorResourcesToBrowser( |
96 FrameHostMsg_ReclaimCompositorResources_Params& params); | 104 FrameHostMsg_ReclaimCompositorResources_Params& params); |
97 void CheckSizeAndAdjustLayerProperties(const gfx::Size& new_size, | 105 void CheckSizeAndAdjustLayerProperties(const gfx::Size& new_size, |
98 float device_scale_factor, | 106 float device_scale_factor, |
99 cc::Layer* layer); | 107 cc::Layer* layer); |
100 void SendReturnedDelegatedResources(); | 108 void SendReturnedDelegatedResources(); |
| 109 static void SatisfyCallback(ChildFrameCompositingHelper* helper, |
| 110 cc::SurfaceSequence sequence); |
| 111 static void RequireCallback(ChildFrameCompositingHelper* helper, |
| 112 cc::SurfaceId id, |
| 113 cc::SurfaceSequence sequence); |
101 | 114 |
102 int host_routing_id_; | 115 int host_routing_id_; |
103 int last_route_id_; | 116 int last_route_id_; |
104 uint32 last_output_surface_id_; | 117 uint32 last_output_surface_id_; |
105 int last_host_id_; | 118 int last_host_id_; |
106 bool ack_pending_; | 119 bool ack_pending_; |
107 bool opaque_; | 120 bool opaque_; |
108 | 121 |
109 gfx::Size buffer_size_; | 122 gfx::Size buffer_size_; |
110 | 123 |
111 // The lifetime of this weak pointer should be greater than the lifetime of | 124 // The lifetime of this weak pointer should be greater than the lifetime of |
112 // other member objects, as they may access this pointer during their | 125 // other member objects, as they may access this pointer during their |
113 // destruction. | 126 // destruction. |
114 base::WeakPtr<BrowserPlugin> browser_plugin_; | 127 base::WeakPtr<BrowserPlugin> browser_plugin_; |
115 RenderFrameProxy* render_frame_proxy_; | 128 RenderFrameProxy* render_frame_proxy_; |
116 | 129 |
117 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; | 130 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
118 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; | 131 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
119 | 132 |
| 133 // For cc::Surface support. |
| 134 scoped_refptr<cc::SurfaceLayer> surface_layer_; |
| 135 |
120 scoped_refptr<cc::SolidColorLayer> background_layer_; | 136 scoped_refptr<cc::SolidColorLayer> background_layer_; |
121 scoped_refptr<cc::DelegatedRendererLayer> delegated_layer_; | 137 scoped_refptr<cc::DelegatedRendererLayer> delegated_layer_; |
122 scoped_ptr<blink::WebLayer> web_layer_; | 138 scoped_ptr<blink::WebLayer> web_layer_; |
123 blink::WebFrame* frame_; | 139 blink::WebFrame* frame_; |
124 | 140 |
125 DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper); | 141 DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper); |
126 }; | 142 }; |
127 | 143 |
128 } // namespace content | 144 } // namespace content |
129 | 145 |
130 #endif // CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_ | 146 #endif // CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_ |
OLD | NEW |