| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/surface/transport_dib.h" | 23 #include "ui/surface/transport_dib.h" |
| 24 | 24 |
| 25 namespace IPC { | 25 namespace IPC { |
| 26 class Message; | 26 class Message; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace base { | 29 namespace base { |
| 30 class TimeDelta; | 30 class TimeDelta; |
| 31 } | 31 } |
| 32 | 32 |
| 33 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 33 struct ViewHostMsg_CompositorSurfaceBuffersSwapped_Params; |
| 34 struct ViewHostMsg_CreateWindow_Params; | 34 struct ViewHostMsg_CreateWindow_Params; |
| 35 struct ViewMsg_SwapOut_Params; | 35 struct ViewMsg_SwapOut_Params; |
| 36 | 36 |
| 37 namespace content { | 37 namespace content { |
| 38 class GpuProcessHost; | 38 class GpuProcessHost; |
| 39 class ResourceDispatcherHostImpl; | 39 class ResourceDispatcherHostImpl; |
| 40 class SessionStorageNamespace; | 40 class SessionStorageNamespace; |
| 41 | 41 |
| 42 // Instantiated per RenderProcessHost to provide various optimizations on | 42 // Instantiated per RenderProcessHost to provide various optimizations on |
| 43 // behalf of a RenderWidgetHost. This class bridges between the IO thread | 43 // behalf of a RenderWidgetHost. This class bridges between the IO thread |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // for documentation. | 130 // for documentation. |
| 131 void ResumeDeferredNavigation(const GlobalRequestID& request_id); | 131 void ResumeDeferredNavigation(const GlobalRequestID& request_id); |
| 132 void ResumeResponseDeferredAtStart(const GlobalRequestID& request_id); | 132 void ResumeResponseDeferredAtStart(const GlobalRequestID& request_id); |
| 133 bool WaitForBackingStoreMsg(int render_widget_id, | 133 bool WaitForBackingStoreMsg(int render_widget_id, |
| 134 const base::TimeDelta& max_delay, | 134 const base::TimeDelta& max_delay, |
| 135 IPC::Message* msg); | 135 IPC::Message* msg); |
| 136 // Called to resume the requests for a view after it's ready. The view was | 136 // Called to resume the requests for a view after it's ready. The view was |
| 137 // created by CreateNewWindow which initially blocked the requests. | 137 // created by CreateNewWindow which initially blocked the requests. |
| 138 void ResumeRequestsForView(int route_id); | 138 void ResumeRequestsForView(int route_id); |
| 139 | 139 |
| 140 #if defined(OS_MACOSX) |
| 141 // Associate an NSView with a render process and widget, so that browser |
| 142 // compositor swaps can come through during resize. |
| 143 static void SetRenderWidgetIDForWidget(gfx::AcceleratedWidget native_widget, |
| 144 int render_process_id, |
| 145 int render_widget_id); |
| 146 static void ResetRenderWidgetIDForWidget( |
| 147 gfx::AcceleratedWidget native_widget); |
| 148 |
| 149 // Display a new frame to an NSView. |
| 150 static void OnNativeSurfaceBuffersSwappedOnUIThread( |
| 151 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params); |
| 152 #endif |
| 153 |
| 140 // IO THREAD ONLY ----------------------------------------------------------- | 154 // IO THREAD ONLY ----------------------------------------------------------- |
| 141 | 155 |
| 142 // Called on the IO thread when a BackingStore message is received. | 156 // Called on the IO thread when a BackingStore message is received. |
| 143 void DidReceiveBackingStoreMsg(const IPC::Message& msg); | 157 void DidReceiveBackingStoreMsg(const IPC::Message& msg); |
| 144 | 158 |
| 145 void CreateNewWindow( | 159 void CreateNewWindow( |
| 146 const ViewHostMsg_CreateWindow_Params& params, | 160 const ViewHostMsg_CreateWindow_Params& params, |
| 147 bool no_javascript_access, | 161 bool no_javascript_access, |
| 148 base::ProcessHandle render_process, | 162 base::ProcessHandle render_process, |
| 149 int* route_id, | 163 int* route_id, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 164 // the resulting TransportDIB. | 178 // the resulting TransportDIB. |
| 165 void AllocTransportDIB(uint32 size, | 179 void AllocTransportDIB(uint32 size, |
| 166 bool cache_in_browser, | 180 bool cache_in_browser, |
| 167 TransportDIB::Handle* result); | 181 TransportDIB::Handle* result); |
| 168 | 182 |
| 169 // Called on the IO thread to handle the freeing of a transport DIB | 183 // Called on the IO thread to handle the freeing of a transport DIB |
| 170 void FreeTransportDIB(TransportDIB::Id dib_id); | 184 void FreeTransportDIB(TransportDIB::Id dib_id); |
| 171 #endif | 185 #endif |
| 172 | 186 |
| 173 #if defined(OS_MACOSX) | 187 #if defined(OS_MACOSX) |
| 174 static void OnNativeSurfaceBuffersSwappedOnIOThread( | 188 // Retrieve the render process and widget that was associated with an NSView. |
| 175 GpuProcessHost* gpu_process_host, | 189 static bool GetRenderWidgetIDForWidget(gfx::AcceleratedWidget native_widget, |
| 176 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 190 int* render_process_id, |
| 191 int* render_widget_id); |
| 177 #endif | 192 #endif |
| 178 | 193 |
| 179 private: | 194 private: |
| 180 // A class used to proxy a paint message. PaintMsgProxy objects are created | 195 // A class used to proxy a paint message. PaintMsgProxy objects are created |
| 181 // on the IO thread and destroyed on the UI thread. | 196 // on the IO thread and destroyed on the UI thread. |
| 182 class BackingStoreMsgProxy; | 197 class BackingStoreMsgProxy; |
| 183 friend class BackingStoreMsgProxy; | 198 friend class BackingStoreMsgProxy; |
| 184 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; | 199 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; |
| 185 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 200 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 186 friend class base::DeleteHelper<RenderWidgetHelper>; | 201 friend class base::DeleteHelper<RenderWidgetHelper>; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 base::AtomicSequenceNumber next_routing_id_; | 265 base::AtomicSequenceNumber next_routing_id_; |
| 251 | 266 |
| 252 ResourceDispatcherHostImpl* resource_dispatcher_host_; | 267 ResourceDispatcherHostImpl* resource_dispatcher_host_; |
| 253 | 268 |
| 254 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); | 269 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); |
| 255 }; | 270 }; |
| 256 | 271 |
| 257 } // namespace content | 272 } // namespace content |
| 258 | 273 |
| 259 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 274 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
| OLD | NEW |