| 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 class Rect; | 40 class Rect; |
| 41 class Size; | 41 class Size; |
| 42 } | 42 } |
| 43 | 43 |
| 44 struct FrameHostMsg_CompositorFrameSwappedACK_Params; | 44 struct FrameHostMsg_CompositorFrameSwappedACK_Params; |
| 45 struct FrameHostMsg_BuffersSwappedACK_Params; | 45 struct FrameHostMsg_BuffersSwappedACK_Params; |
| 46 struct FrameHostMsg_ReclaimCompositorResources_Params; | 46 struct FrameHostMsg_ReclaimCompositorResources_Params; |
| 47 | 47 |
| 48 namespace content { | 48 namespace content { |
| 49 | 49 |
| 50 class BrowserPlugin; |
| 50 class BrowserPluginManager; | 51 class BrowserPluginManager; |
| 51 class RenderFrameImpl; | 52 class RenderFrameImpl; |
| 52 | 53 |
| 53 class CONTENT_EXPORT ChildFrameCompositingHelper | 54 class CONTENT_EXPORT ChildFrameCompositingHelper |
| 54 : public base::RefCounted<ChildFrameCompositingHelper>, | 55 : public base::RefCounted<ChildFrameCompositingHelper>, |
| 55 public cc::DelegatedFrameResourceCollectionClient { | 56 public cc::DelegatedFrameResourceCollectionClient { |
| 56 public: | 57 public: |
| 57 static ChildFrameCompositingHelper* CreateCompositingHelperForBrowserPlugin( | 58 static ChildFrameCompositingHelper* CreateCompositingHelperForBrowserPlugin( |
| 58 blink::WebPluginContainer* container, | 59 const base::WeakPtr<BrowserPlugin>& browser_plugin); |
| 59 BrowserPluginManager* manager, | |
| 60 int instance_id, | |
| 61 int host_routing_id); | |
| 62 static ChildFrameCompositingHelper* CreateCompositingHelperForRenderFrame( | 60 static ChildFrameCompositingHelper* CreateCompositingHelperForRenderFrame( |
| 63 blink::WebFrame* frame, | 61 blink::WebFrame* frame, |
| 64 RenderFrameImpl* render_frame, | 62 RenderFrameImpl* render_frame, |
| 65 int host_routing_id); | 63 int host_routing_id); |
| 66 | 64 |
| 67 void CopyFromCompositingSurface(int request_id, | 65 void CopyFromCompositingSurface(int request_id, |
| 68 gfx::Rect source_rect, | 66 gfx::Rect source_rect, |
| 69 gfx::Size dest_size); | 67 gfx::Size dest_size); |
| 70 void DidCommitCompositorFrame(); | 68 void DidCommitCompositorFrame(); |
| 71 void EnableCompositing(bool); | 69 void EnableCompositing(bool); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 84 | 82 |
| 85 // cc::DelegatedFrameProviderClient implementation. | 83 // cc::DelegatedFrameProviderClient implementation. |
| 86 virtual void UnusedResourcesAreAvailable() OVERRIDE; | 84 virtual void UnusedResourcesAreAvailable() OVERRIDE; |
| 87 void SetContentsOpaque(bool); | 85 void SetContentsOpaque(bool); |
| 88 | 86 |
| 89 protected: | 87 protected: |
| 90 // Friend RefCounted so that the dtor can be non-public. | 88 // Friend RefCounted so that the dtor can be non-public. |
| 91 friend class base::RefCounted<ChildFrameCompositingHelper>; | 89 friend class base::RefCounted<ChildFrameCompositingHelper>; |
| 92 | 90 |
| 93 private: | 91 private: |
| 94 ChildFrameCompositingHelper(blink::WebPluginContainer* container, | 92 ChildFrameCompositingHelper( |
| 95 blink::WebFrame* frame, | 93 const base::WeakPtr<BrowserPlugin>& browser_plugin, |
| 96 BrowserPluginManager* manager, | 94 blink::WebFrame* frame, |
| 97 RenderFrameImpl* render_frame, | 95 RenderFrameImpl* render_frame, |
| 98 int instance_id, | 96 int host_routing_id); |
| 99 int host_routing_id); | |
| 100 | 97 |
| 101 enum SwapBuffersType { | 98 enum SwapBuffersType { |
| 102 TEXTURE_IMAGE_TRANSPORT, | 99 TEXTURE_IMAGE_TRANSPORT, |
| 103 GL_COMPOSITOR_FRAME, | 100 GL_COMPOSITOR_FRAME, |
| 104 SOFTWARE_COMPOSITOR_FRAME, | 101 SOFTWARE_COMPOSITOR_FRAME, |
| 105 }; | 102 }; |
| 106 struct SwapBuffersInfo { | 103 struct SwapBuffersInfo { |
| 107 SwapBuffersInfo(); | 104 SwapBuffersInfo(); |
| 108 | 105 |
| 109 gpu::Mailbox name; | 106 gpu::Mailbox name; |
| 110 SwapBuffersType type; | 107 SwapBuffersType type; |
| 111 gfx::Size size; | 108 gfx::Size size; |
| 112 int route_id; | 109 int route_id; |
| 113 uint32 output_surface_id; | 110 uint32 output_surface_id; |
| 114 int host_id; | 111 int host_id; |
| 115 unsigned software_frame_id; | 112 unsigned software_frame_id; |
| 116 base::SharedMemory* shared_memory; | 113 base::SharedMemory* shared_memory; |
| 117 }; | 114 }; |
| 118 virtual ~ChildFrameCompositingHelper(); | 115 virtual ~ChildFrameCompositingHelper(); |
| 116 |
| 117 BrowserPluginManager* GetBrowserPluginManager(); |
| 118 blink::WebPluginContainer* GetContainer(); |
| 119 int GetInstanceID(); |
| 120 |
| 119 void SendCompositorFrameSwappedACKToBrowser( | 121 void SendCompositorFrameSwappedACKToBrowser( |
| 120 FrameHostMsg_CompositorFrameSwappedACK_Params& params); | 122 FrameHostMsg_CompositorFrameSwappedACK_Params& params); |
| 121 void SendBuffersSwappedACKToBrowser( | 123 void SendBuffersSwappedACKToBrowser( |
| 122 FrameHostMsg_BuffersSwappedACK_Params& params); | 124 FrameHostMsg_BuffersSwappedACK_Params& params); |
| 123 void SendReclaimCompositorResourcesToBrowser( | 125 void SendReclaimCompositorResourcesToBrowser( |
| 124 FrameHostMsg_ReclaimCompositorResources_Params& params); | 126 FrameHostMsg_ReclaimCompositorResources_Params& params); |
| 125 void CheckSizeAndAdjustLayerProperties(const gfx::Size& new_size, | 127 void CheckSizeAndAdjustLayerProperties(const gfx::Size& new_size, |
| 126 float device_scale_factor, | 128 float device_scale_factor, |
| 127 cc::Layer* layer); | 129 cc::Layer* layer); |
| 128 void OnBuffersSwappedPrivate(const SwapBuffersInfo& mailbox, | 130 void OnBuffersSwappedPrivate(const SwapBuffersInfo& mailbox, |
| 129 unsigned sync_point, | 131 unsigned sync_point, |
| 130 float device_scale_factor); | 132 float device_scale_factor); |
| 131 void MailboxReleased(SwapBuffersInfo mailbox, | 133 void MailboxReleased(SwapBuffersInfo mailbox, |
| 132 unsigned sync_point, | 134 unsigned sync_point, |
| 133 bool lost_resource); | 135 bool lost_resource); |
| 134 void SendReturnedDelegatedResources(); | 136 void SendReturnedDelegatedResources(); |
| 135 void CopyFromCompositingSurfaceHasResult( | 137 void CopyFromCompositingSurfaceHasResult( |
| 136 int request_id, | 138 int request_id, |
| 137 gfx::Size dest_size, | 139 gfx::Size dest_size, |
| 138 scoped_ptr<cc::CopyOutputResult> result); | 140 scoped_ptr<cc::CopyOutputResult> result); |
| 139 | 141 |
| 140 int instance_id_; | |
| 141 int host_routing_id_; | 142 int host_routing_id_; |
| 142 int last_route_id_; | 143 int last_route_id_; |
| 143 uint32 last_output_surface_id_; | 144 uint32 last_output_surface_id_; |
| 144 int last_host_id_; | 145 int last_host_id_; |
| 145 bool last_mailbox_valid_; | 146 bool last_mailbox_valid_; |
| 146 bool ack_pending_; | 147 bool ack_pending_; |
| 147 bool software_ack_pending_; | 148 bool software_ack_pending_; |
| 148 bool opaque_; | 149 bool opaque_; |
| 149 std::vector<unsigned> unacked_software_frames_; | 150 std::vector<unsigned> unacked_software_frames_; |
| 150 | 151 |
| 151 gfx::Size buffer_size_; | 152 gfx::Size buffer_size_; |
| 152 | 153 |
| 153 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; | 154 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
| 154 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; | 155 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
| 155 | 156 |
| 156 scoped_refptr<cc::SolidColorLayer> background_layer_; | 157 scoped_refptr<cc::SolidColorLayer> background_layer_; |
| 157 scoped_refptr<cc::TextureLayer> texture_layer_; | 158 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 158 scoped_refptr<cc::DelegatedRendererLayer> delegated_layer_; | 159 scoped_refptr<cc::DelegatedRendererLayer> delegated_layer_; |
| 159 scoped_ptr<blink::WebLayer> web_layer_; | 160 scoped_ptr<blink::WebLayer> web_layer_; |
| 160 blink::WebPluginContainer* container_; | |
| 161 blink::WebFrame* frame_; | 161 blink::WebFrame* frame_; |
| 162 | 162 |
| 163 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 163 base::WeakPtr<BrowserPlugin> browser_plugin_; |
| 164 RenderFrameImpl* render_frame_; | 164 RenderFrameImpl* render_frame_; |
| 165 | 165 |
| 166 DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper); | 166 DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper); |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace content | 169 } // namespace content |
| 170 | 170 |
| 171 #endif // CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_ | 171 #endif // CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_ |
| OLD | NEW |