 Chromium Code Reviews
 Chromium Code Reviews Issue 7136001:
  GPU compositing surface handle is no longer sent to renderer process.  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/
    
  
    Issue 7136001:
  GPU compositing surface handle is no longer sent to renderer process.  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/| 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 <map> | 9 #include <map> | 
| 10 | 10 | 
| 11 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" | 
| 12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" | 
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" | 
| 14 #include "base/process.h" | 14 #include "base/process.h" | 
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" | 
| 16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" | 
| 17 #include "content/browser/browser_thread.h" | |
| 
jam
2011/06/21 21:49:03
nit: doesn't look like this is needed
 | |
| 17 #include "content/common/window_container_type.h" | 18 #include "content/common/window_container_type.h" | 
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 
| 20 #include "ui/gfx/native_widget_types.h" | |
| 19 #include "ui/gfx/surface/transport_dib.h" | 21 #include "ui/gfx/surface/transport_dib.h" | 
| 20 | 22 | 
| 21 namespace IPC { | 23 namespace IPC { | 
| 22 class Message; | 24 class Message; | 
| 23 } | 25 } | 
| 24 | 26 | 
| 25 namespace base { | 27 namespace base { | 
| 26 class TimeDelta; | 28 class TimeDelta; | 
| 27 } | 29 } | 
| 28 | 30 | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params); | 112 void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params); | 
| 111 bool WaitForUpdateMsg(int render_widget_id, | 113 bool WaitForUpdateMsg(int render_widget_id, | 
| 112 const base::TimeDelta& max_delay, | 114 const base::TimeDelta& max_delay, | 
| 113 IPC::Message* msg); | 115 IPC::Message* msg); | 
| 114 | 116 | 
| 115 #if defined(OS_MACOSX) | 117 #if defined(OS_MACOSX) | 
| 116 // 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. | 
| 117 TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); | 119 TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); | 
| 118 #endif | 120 #endif | 
| 119 | 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); | |
| 120 | 126 | 
| 121 // IO THREAD ONLY ----------------------------------------------------------- | 127 // IO THREAD ONLY ----------------------------------------------------------- | 
| 122 | 128 | 
| 123 // Called on the IO thread when a UpdateRect message is received. | 129 // Called on the IO thread when a UpdateRect message is received. | 
| 124 void DidReceiveUpdateMsg(const IPC::Message& msg); | 130 void DidReceiveUpdateMsg(const IPC::Message& msg); | 
| 125 | 131 | 
| 126 void CreateNewWindow(const ViewHostMsg_CreateWindow_Params& params, | 132 void CreateNewWindow(const ViewHostMsg_CreateWindow_Params& params, | 
| 127 base::ProcessHandle render_process, | 133 base::ProcessHandle render_process, | 
| 128 int* route_id); | 134 int* route_id); | 
| 129 void CreateNewWidget(int opener_id, | 135 void CreateNewWidget(int opener_id, | 
| 130 WebKit::WebPopupType popup_type, | 136 WebKit::WebPopupType popup_type, | 
| 131 int* route_id); | 137 int* route_id); | 
| 132 void CreateNewFullscreenWidget(int opener_id, int* route_id); | 138 void CreateNewFullscreenWidget(int opener_id, int* route_id); | 
| 133 | 139 | 
| 134 #if defined(OS_MACOSX) | 140 #if defined(OS_MACOSX) | 
| 135 // Called on the IO thread to handle the allocation of a TransportDIB. If | 141 // Called on the IO thread to handle the allocation of a TransportDIB. If | 
| 136 // |cache_in_browser| is |true|, then a copy of the shmem is kept by the | 142 // |cache_in_browser| is |true|, then a copy of the shmem is kept by the | 
| 137 // browser, and it is the caller's repsonsibility to call | 143 // browser, and it is the caller's repsonsibility to call | 
| 138 // FreeTransportDIB(). In all cases, the caller is responsible for deleting | 144 // FreeTransportDIB(). In all cases, the caller is responsible for deleting | 
| 139 // the resulting TransportDIB. | 145 // the resulting TransportDIB. | 
| 140 void AllocTransportDIB(size_t size, | 146 void AllocTransportDIB(size_t size, | 
| 141 bool cache_in_browser, | 147 bool cache_in_browser, | 
| 142 TransportDIB::Handle* result); | 148 TransportDIB::Handle* result); | 
| 143 | 149 | 
| 144 // Called on the IO thread to handle the freeing of a transport DIB | 150 // Called on the IO thread to handle the freeing of a transport DIB | 
| 145 void FreeTransportDIB(TransportDIB::Id dib_id); | 151 void FreeTransportDIB(TransportDIB::Id dib_id); | 
| 146 #endif | 152 #endif | 
| 147 | 153 | 
| 154 // Lookup the compositing surface corresponding to a widget ID. | |
| 155 gfx::PluginWindowHandle LookupCompositingSurface(int render_widget_id); | |
| 156 | |
| 148 private: | 157 private: | 
| 149 // A class used to proxy a paint message. PaintMsgProxy objects are created | 158 // A class used to proxy a paint message. PaintMsgProxy objects are created | 
| 150 // on the IO thread and destroyed on the UI thread. | 159 // on the IO thread and destroyed on the UI thread. | 
| 151 class UpdateMsgProxy; | 160 class UpdateMsgProxy; | 
| 152 friend class UpdateMsgProxy; | 161 friend class UpdateMsgProxy; | 
| 153 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; | 162 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; | 
| 154 | 163 | 
| 155 // Map from render_widget_id to live PaintMsgProxy instance. | 164 // Map from render_widget_id to live PaintMsgProxy instance. | 
| 156 typedef base::hash_map<int, UpdateMsgProxy*> UpdateMsgProxyMap; | 165 typedef base::hash_map<int, UpdateMsgProxy*> UpdateMsgProxyMap; | 
| 157 | 166 | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 base::Lock allocated_dibs_lock_; | 202 base::Lock allocated_dibs_lock_; | 
| 194 std::map<TransportDIB::Id, int> allocated_dibs_; | 203 std::map<TransportDIB::Id, int> allocated_dibs_; | 
| 195 #endif | 204 #endif | 
| 196 | 205 | 
| 197 // A map of live paint messages. Must hold pending_paints_lock_ to access. | 206 // A map of live paint messages. Must hold pending_paints_lock_ to access. | 
| 198 // The UpdateMsgProxy objects are not owned by this map. (See UpdateMsgProxy | 207 // The UpdateMsgProxy objects are not owned by this map. (See UpdateMsgProxy | 
| 199 // for details about how the lifetime of instances are managed.) | 208 // for details about how the lifetime of instances are managed.) | 
| 200 UpdateMsgProxyMap pending_paints_; | 209 UpdateMsgProxyMap pending_paints_; | 
| 201 base::Lock pending_paints_lock_; | 210 base::Lock pending_paints_lock_; | 
| 202 | 211 | 
| 212 // Maps from view ID to compositing surface. | |
| 213 typedef std::map<int, gfx::PluginWindowHandle> ViewCompositingSurfaceMap; | |
| 214 ViewCompositingSurfaceMap view_compositing_surface_map_; | |
| 215 base::Lock view_compositing_surface_map_lock_; | |
| 216 | |
| 203 int render_process_id_; | 217 int render_process_id_; | 
| 204 | 218 | 
| 205 // Event used to implement WaitForUpdateMsg. | 219 // Event used to implement WaitForUpdateMsg. | 
| 206 base::WaitableEvent event_; | 220 base::WaitableEvent event_; | 
| 207 | 221 | 
| 208 // The next routing id to use. | 222 // The next routing id to use. | 
| 209 base::AtomicSequenceNumber next_routing_id_; | 223 base::AtomicSequenceNumber next_routing_id_; | 
| 210 | 224 | 
| 211 ResourceDispatcherHost* resource_dispatcher_host_; | 225 ResourceDispatcherHost* resource_dispatcher_host_; | 
| 212 | 226 | 
| 213 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); | 227 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); | 
| 214 }; | 228 }; | 
| 215 | 229 | 
| 216 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 230 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 
| OLD | NEW |