| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params); | 112 void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params); |
| 113 bool WaitForUpdateMsg(int render_widget_id, | 113 bool WaitForUpdateMsg(int render_widget_id, |
| 114 const base::TimeDelta& max_delay, | 114 const base::TimeDelta& max_delay, |
| 115 IPC::Message* msg); | 115 IPC::Message* msg); |
| 116 | 116 |
| 117 #if defined(OS_MACOSX) | 117 #if defined(OS_MACOSX) |
| 118 // Given the id of a transport DIB, return a mapping to it or NULL on error. | 118 // Given the id of a transport DIB, return a mapping to it or NULL on error. |
| 119 TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); | 119 TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); |
| 120 #endif | 120 #endif |
| 121 | 121 |
| 122 // Set a mapping from a RenderWidgetHost to a compositing surface. Pass a null | |
| 123 // handle to remove the mapping. | |
| 124 void SetCompositingSurface(int render_widget_id, | |
| 125 gfx::PluginWindowHandle compositing_surface); | |
| 126 | |
| 127 // IO THREAD ONLY ----------------------------------------------------------- | 122 // IO THREAD ONLY ----------------------------------------------------------- |
| 128 | 123 |
| 129 // Called on the IO thread when a UpdateRect message is received. | 124 // Called on the IO thread when a UpdateRect message is received. |
| 130 void DidReceiveUpdateMsg(const IPC::Message& msg); | 125 void DidReceiveUpdateMsg(const IPC::Message& msg); |
| 131 | 126 |
| 132 void CreateNewWindow(const ViewHostMsg_CreateWindow_Params& params, | 127 void CreateNewWindow(const ViewHostMsg_CreateWindow_Params& params, |
| 133 base::ProcessHandle render_process, | 128 base::ProcessHandle render_process, |
| 134 int* route_id); | 129 int* route_id, |
| 130 int* surface_id); |
| 135 void CreateNewWidget(int opener_id, | 131 void CreateNewWidget(int opener_id, |
| 136 WebKit::WebPopupType popup_type, | 132 WebKit::WebPopupType popup_type, |
| 137 int* route_id); | 133 int* route_id, |
| 138 void CreateNewFullscreenWidget(int opener_id, int* route_id); | 134 int* surface_id); |
| 135 void CreateNewFullscreenWidget(int opener_id, int* route_id, int* surface_id); |
| 139 | 136 |
| 140 #if defined(OS_MACOSX) | 137 #if defined(OS_MACOSX) |
| 141 // Called on the IO thread to handle the allocation of a TransportDIB. If | 138 // Called on the IO thread to handle the allocation of a TransportDIB. If |
| 142 // |cache_in_browser| is |true|, then a copy of the shmem is kept by the | 139 // |cache_in_browser| is |true|, then a copy of the shmem is kept by the |
| 143 // browser, and it is the caller's repsonsibility to call | 140 // browser, and it is the caller's repsonsibility to call |
| 144 // FreeTransportDIB(). In all cases, the caller is responsible for deleting | 141 // FreeTransportDIB(). In all cases, the caller is responsible for deleting |
| 145 // the resulting TransportDIB. | 142 // the resulting TransportDIB. |
| 146 void AllocTransportDIB(size_t size, | 143 void AllocTransportDIB(size_t size, |
| 147 bool cache_in_browser, | 144 bool cache_in_browser, |
| 148 TransportDIB::Handle* result); | 145 TransportDIB::Handle* result); |
| 149 | 146 |
| 150 // Called on the IO thread to handle the freeing of a transport DIB | 147 // Called on the IO thread to handle the freeing of a transport DIB |
| 151 void FreeTransportDIB(TransportDIB::Id dib_id); | 148 void FreeTransportDIB(TransportDIB::Id dib_id); |
| 152 #endif | 149 #endif |
| 153 | 150 |
| 154 // Lookup the compositing surface corresponding to a widget ID. | |
| 155 gfx::PluginWindowHandle LookupCompositingSurface(int render_widget_id); | |
| 156 | |
| 157 private: | 151 private: |
| 158 // A class used to proxy a paint message. PaintMsgProxy objects are created | 152 // A class used to proxy a paint message. PaintMsgProxy objects are created |
| 159 // on the IO thread and destroyed on the UI thread. | 153 // on the IO thread and destroyed on the UI thread. |
| 160 class UpdateMsgProxy; | 154 class UpdateMsgProxy; |
| 161 friend class UpdateMsgProxy; | 155 friend class UpdateMsgProxy; |
| 162 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; | 156 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; |
| 163 | 157 |
| 164 typedef std::deque<UpdateMsgProxy*> UpdateMsgProxyQueue; | 158 typedef std::deque<UpdateMsgProxy*> UpdateMsgProxyQueue; |
| 165 // Map from render_widget_id to a queue of live PaintMsgProxy instances. | 159 // Map from render_widget_id to a queue of live PaintMsgProxy instances. |
| 166 typedef base::hash_map<int, UpdateMsgProxyQueue > UpdateMsgProxyMap; | 160 typedef base::hash_map<int, UpdateMsgProxyQueue > UpdateMsgProxyMap; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 base::Lock allocated_dibs_lock_; | 197 base::Lock allocated_dibs_lock_; |
| 204 std::map<TransportDIB::Id, int> allocated_dibs_; | 198 std::map<TransportDIB::Id, int> allocated_dibs_; |
| 205 #endif | 199 #endif |
| 206 | 200 |
| 207 // A map of live paint messages. Must hold pending_paints_lock_ to access. | 201 // A map of live paint messages. Must hold pending_paints_lock_ to access. |
| 208 // The UpdateMsgProxy objects are not owned by this map. (See UpdateMsgProxy | 202 // The UpdateMsgProxy objects are not owned by this map. (See UpdateMsgProxy |
| 209 // for details about how the lifetime of instances are managed.) | 203 // for details about how the lifetime of instances are managed.) |
| 210 UpdateMsgProxyMap pending_paints_; | 204 UpdateMsgProxyMap pending_paints_; |
| 211 base::Lock pending_paints_lock_; | 205 base::Lock pending_paints_lock_; |
| 212 | 206 |
| 213 // Maps from view ID to compositing surface. | |
| 214 typedef std::map<int, gfx::PluginWindowHandle> ViewCompositingSurfaceMap; | |
| 215 ViewCompositingSurfaceMap view_compositing_surface_map_; | |
| 216 base::Lock view_compositing_surface_map_lock_; | |
| 217 | |
| 218 int render_process_id_; | 207 int render_process_id_; |
| 219 | 208 |
| 220 // Event used to implement WaitForUpdateMsg. | 209 // Event used to implement WaitForUpdateMsg. |
| 221 base::WaitableEvent event_; | 210 base::WaitableEvent event_; |
| 222 | 211 |
| 223 // The next routing id to use. | 212 // The next routing id to use. |
| 224 base::AtomicSequenceNumber next_routing_id_; | 213 base::AtomicSequenceNumber next_routing_id_; |
| 225 | 214 |
| 226 ResourceDispatcherHost* resource_dispatcher_host_; | 215 ResourceDispatcherHost* resource_dispatcher_host_; |
| 227 | 216 |
| 228 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); | 217 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); |
| 229 }; | 218 }; |
| 230 | 219 |
| 231 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 220 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| OLD | NEW |