Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: content/browser/renderer_host/render_widget_helper.h

Issue 10804031: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11 matching lines...) Expand all
22 #include "ui/surface/transport_dib.h" 22 #include "ui/surface/transport_dib.h"
23 23
24 namespace IPC { 24 namespace IPC {
25 class Message; 25 class Message;
26 } 26 }
27 27
28 namespace base { 28 namespace base {
29 class TimeDelta; 29 class TimeDelta;
30 } 30 }
31 31
32 namespace content {
33 class ResourceDispatcherHostImpl;
34 class SessionStorageNamespace;
35 }
36
37 struct ViewHostMsg_CreateWindow_Params; 32 struct ViewHostMsg_CreateWindow_Params;
38 struct ViewMsg_SwapOut_Params; 33 struct ViewMsg_SwapOut_Params;
39 34
35 namespace content {
36 class ResourceDispatcherHostImpl;
37 class SessionStorageNamespace;
40 38
41 // Instantiated per RenderProcessHost to provide various optimizations on 39 // Instantiated per RenderProcessHost to provide various optimizations on
42 // behalf of a RenderWidgetHost. This class bridges between the IO thread 40 // behalf of a RenderWidgetHost. This class bridges between the IO thread
43 // where the RenderProcessHost's MessageFilter lives and the UI thread where 41 // where the RenderProcessHost's MessageFilter lives and the UI thread where
44 // the RenderWidgetHost lives. 42 // the RenderWidgetHost lives.
45 // 43 //
46 // 44 //
47 // OPTIMIZED RESIZE 45 // OPTIMIZED RESIZE
48 // 46 //
49 // RenderWidgetHelper is used to implement optimized resize. When the 47 // RenderWidgetHelper is used to implement optimized resize. When the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // TRANSPORT DIB CREATION 95 // TRANSPORT DIB CREATION
98 // 96 //
99 // On some platforms (currently the Mac) the renderer cannot create transport 97 // On some platforms (currently the Mac) the renderer cannot create transport
100 // DIBs because of sandbox limitations. Thus, it has to make synchronous IPCs 98 // DIBs because of sandbox limitations. Thus, it has to make synchronous IPCs
101 // to the browser for them. Since these requests are synchronous, they cannot 99 // to the browser for them. Since these requests are synchronous, they cannot
102 // terminate on the UI thread. Thus, in this case, this object performs the 100 // terminate on the UI thread. Thus, in this case, this object performs the
103 // allocation and maintains the set of allocated transport DIBs which the 101 // allocation and maintains the set of allocated transport DIBs which the
104 // renderers can refer to. 102 // renderers can refer to.
105 // 103 //
106 class RenderWidgetHelper 104 class RenderWidgetHelper
107 : public base::RefCountedThreadSafe< 105 : public base::RefCountedThreadSafe<RenderWidgetHelper,
108 RenderWidgetHelper, content::BrowserThread::DeleteOnIOThread> { 106 BrowserThread::DeleteOnIOThread> {
109 public: 107 public:
110 RenderWidgetHelper(); 108 RenderWidgetHelper();
111 109
112 void Init(int render_process_id, 110 void Init(int render_process_id,
113 content::ResourceDispatcherHostImpl* resource_dispatcher_host); 111 ResourceDispatcherHostImpl* resource_dispatcher_host);
114 112
115 // Gets the next available routing id. This is thread safe. 113 // Gets the next available routing id. This is thread safe.
116 int GetNextRoutingID(); 114 int GetNextRoutingID();
117 115
118 // IO THREAD ONLY ----------------------------------------------------------- 116 // IO THREAD ONLY -----------------------------------------------------------
119 117
120 // Lookup the RenderWidgetHelper from the render_process_host_id. Returns NULL 118 // Lookup the RenderWidgetHelper from the render_process_host_id. Returns NULL
121 // if not found. NOTE: The raw pointer is for temporary use only. To retain, 119 // if not found. NOTE: The raw pointer is for temporary use only. To retain,
122 // store in a scoped_refptr. 120 // store in a scoped_refptr.
123 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id); 121 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id);
(...skipping 18 matching lines...) Expand all
142 140
143 // Called on the IO thread when a BackingStore message is received. 141 // Called on the IO thread when a BackingStore message is received.
144 void DidReceiveBackingStoreMsg(const IPC::Message& msg); 142 void DidReceiveBackingStoreMsg(const IPC::Message& msg);
145 143
146 void CreateNewWindow( 144 void CreateNewWindow(
147 const ViewHostMsg_CreateWindow_Params& params, 145 const ViewHostMsg_CreateWindow_Params& params,
148 bool no_javascript_access, 146 bool no_javascript_access,
149 base::ProcessHandle render_process, 147 base::ProcessHandle render_process,
150 int* route_id, 148 int* route_id,
151 int* surface_id, 149 int* surface_id,
152 content::SessionStorageNamespace* session_storage_namespace); 150 SessionStorageNamespace* session_storage_namespace);
153 void CreateNewWidget(int opener_id, 151 void CreateNewWidget(int opener_id,
154 WebKit::WebPopupType popup_type, 152 WebKit::WebPopupType popup_type,
155 int* route_id, 153 int* route_id,
156 int* surface_id); 154 int* surface_id);
157 void CreateNewFullscreenWidget(int opener_id, int* route_id, int* surface_id); 155 void CreateNewFullscreenWidget(int opener_id, int* route_id, int* surface_id);
158 156
159 #if defined(OS_MACOSX) 157 #if defined(OS_MACOSX)
160 // Called on the IO thread to handle the allocation of a TransportDIB. If 158 // Called on the IO thread to handle the allocation of a TransportDIB. If
161 // |cache_in_browser| is |true|, then a copy of the shmem is kept by the 159 // |cache_in_browser| is |true|, then a copy of the shmem is kept by the
162 // browser, and it is the caller's repsonsibility to call 160 // browser, and it is the caller's repsonsibility to call
163 // FreeTransportDIB(). In all cases, the caller is responsible for deleting 161 // FreeTransportDIB(). In all cases, the caller is responsible for deleting
164 // the resulting TransportDIB. 162 // the resulting TransportDIB.
165 void AllocTransportDIB(size_t size, 163 void AllocTransportDIB(size_t size,
166 bool cache_in_browser, 164 bool cache_in_browser,
167 TransportDIB::Handle* result); 165 TransportDIB::Handle* result);
168 166
169 // Called on the IO thread to handle the freeing of a transport DIB 167 // Called on the IO thread to handle the freeing of a transport DIB
170 void FreeTransportDIB(TransportDIB::Id dib_id); 168 void FreeTransportDIB(TransportDIB::Id dib_id);
171 #endif 169 #endif
172 170
173 private: 171 private:
174 // A class used to proxy a paint message. PaintMsgProxy objects are created 172 // A class used to proxy a paint message. PaintMsgProxy objects are created
175 // on the IO thread and destroyed on the UI thread. 173 // on the IO thread and destroyed on the UI thread.
176 class BackingStoreMsgProxy; 174 class BackingStoreMsgProxy;
177 friend class BackingStoreMsgProxy; 175 friend class BackingStoreMsgProxy;
178 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; 176 friend class base::RefCountedThreadSafe<RenderWidgetHelper>;
179 friend struct content::BrowserThread::DeleteOnThread< 177 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
180 content::BrowserThread::IO>;
181 friend class base::DeleteHelper<RenderWidgetHelper>; 178 friend class base::DeleteHelper<RenderWidgetHelper>;
182 179
183 typedef std::deque<BackingStoreMsgProxy*> BackingStoreMsgProxyQueue; 180 typedef std::deque<BackingStoreMsgProxy*> BackingStoreMsgProxyQueue;
184 // Map from render_widget_id to a queue of live PaintMsgProxy instances. 181 // Map from render_widget_id to a queue of live PaintMsgProxy instances.
185 typedef base::hash_map<int, BackingStoreMsgProxyQueue > 182 typedef base::hash_map<int, BackingStoreMsgProxyQueue >
186 BackingStoreMsgProxyMap; 183 BackingStoreMsgProxyMap;
187 184
188 ~RenderWidgetHelper(); 185 ~RenderWidgetHelper();
189 186
190 // Called on the UI thread to discard a paint message. 187 // Called on the UI thread to discard a paint message.
191 void OnDiscardBackingStoreMsg(BackingStoreMsgProxy* proxy); 188 void OnDiscardBackingStoreMsg(BackingStoreMsgProxy* proxy);
192 189
193 // Called on the UI thread to dispatch a paint message if necessary. 190 // Called on the UI thread to dispatch a paint message if necessary.
194 void OnDispatchBackingStoreMsg(BackingStoreMsgProxy* proxy); 191 void OnDispatchBackingStoreMsg(BackingStoreMsgProxy* proxy);
195 192
196 // Called on the UI thread to finish creating a window. 193 // Called on the UI thread to finish creating a window.
197 void OnCreateWindowOnUI( 194 void OnCreateWindowOnUI(
198 const ViewHostMsg_CreateWindow_Params& params, 195 const ViewHostMsg_CreateWindow_Params& params,
199 int route_id, 196 int route_id,
200 content::SessionStorageNamespace* session_storage_namespace); 197 SessionStorageNamespace* session_storage_namespace);
201 198
202 // Called on the IO thread after a window was created on the UI thread. 199 // Called on the IO thread after a window was created on the UI thread.
203 void OnCreateWindowOnIO(int route_id); 200 void OnCreateWindowOnIO(int route_id);
204 201
205 // Called on the UI thread to finish creating a widget. 202 // Called on the UI thread to finish creating a widget.
206 void OnCreateWidgetOnUI(int opener_id, 203 void OnCreateWidgetOnUI(int opener_id,
207 int route_id, 204 int route_id,
208 WebKit::WebPopupType popup_type); 205 WebKit::WebPopupType popup_type);
209 206
210 // Called on the UI thread to create a fullscreen widget. 207 // Called on the UI thread to create a fullscreen widget.
(...skipping 23 matching lines...) Expand all
234 base::Lock pending_paints_lock_; 231 base::Lock pending_paints_lock_;
235 232
236 int render_process_id_; 233 int render_process_id_;
237 234
238 // Event used to implement WaitForBackingStoreMsg. 235 // Event used to implement WaitForBackingStoreMsg.
239 base::WaitableEvent event_; 236 base::WaitableEvent event_;
240 237
241 // The next routing id to use. 238 // The next routing id to use.
242 base::AtomicSequenceNumber next_routing_id_; 239 base::AtomicSequenceNumber next_routing_id_;
243 240
244 content::ResourceDispatcherHostImpl* resource_dispatcher_host_; 241 ResourceDispatcherHostImpl* resource_dispatcher_host_;
245 242
246 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); 243 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper);
247 }; 244 };
248 245
246 } // namespace content
247
249 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ 248 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/browser/renderer_host/render_widget_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698