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 #include "content/browser/renderer_host/render_widget_helper.h" | 5 #include "content/browser/renderer_host/render_widget_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // static | 121 // static |
122 RenderWidgetHelper* RenderWidgetHelper::FromProcessHostID( | 122 RenderWidgetHelper* RenderWidgetHelper::FromProcessHostID( |
123 int render_process_host_id) { | 123 int render_process_host_id) { |
124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
125 WidgetHelperMap::const_iterator ci = g_widget_helpers.Get().find( | 125 WidgetHelperMap::const_iterator ci = g_widget_helpers.Get().find( |
126 render_process_host_id); | 126 render_process_host_id); |
127 return (ci == g_widget_helpers.Get().end())? NULL : ci->second; | 127 return (ci == g_widget_helpers.Get().end())? NULL : ci->second; |
128 } | 128 } |
129 | 129 |
130 void RenderWidgetHelper::CancelResourceRequests(int render_widget_id) { | |
131 if (render_process_id_ == -1) | |
132 return; | |
133 | |
134 BrowserThread::PostTask( | |
135 BrowserThread::IO, FROM_HERE, | |
136 base::Bind(&RenderWidgetHelper::OnCancelResourceRequests, | |
137 this, | |
138 render_widget_id)); | |
139 } | |
140 | |
141 void RenderWidgetHelper::SimulateSwapOutACK( | 130 void RenderWidgetHelper::SimulateSwapOutACK( |
142 const ViewMsg_SwapOut_Params& params) { | 131 const ViewMsg_SwapOut_Params& params) { |
143 BrowserThread::PostTask( | 132 BrowserThread::PostTask( |
144 BrowserThread::IO, FROM_HERE, | 133 BrowserThread::IO, FROM_HERE, |
145 base::Bind(&RenderWidgetHelper::OnSimulateSwapOutACK, | 134 base::Bind(&RenderWidgetHelper::OnSimulateSwapOutACK, |
146 this, | 135 this, |
147 params)); | 136 params)); |
148 } | 137 } |
149 | 138 |
150 bool RenderWidgetHelper::WaitForBackingStoreMsg( | 139 bool RenderWidgetHelper::WaitForBackingStoreMsg( |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 void RenderWidgetHelper::OnDispatchBackingStoreMsg( | 233 void RenderWidgetHelper::OnDispatchBackingStoreMsg( |
245 BackingStoreMsgProxy* proxy) { | 234 BackingStoreMsgProxy* proxy) { |
246 OnDiscardBackingStoreMsg(proxy); | 235 OnDiscardBackingStoreMsg(proxy); |
247 | 236 |
248 // It is reasonable for the host to no longer exist. | 237 // It is reasonable for the host to no longer exist. |
249 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); | 238 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); |
250 if (host) | 239 if (host) |
251 host->OnMessageReceived(proxy->message()); | 240 host->OnMessageReceived(proxy->message()); |
252 } | 241 } |
253 | 242 |
254 void RenderWidgetHelper::OnCancelResourceRequests( | |
255 int render_widget_id) { | |
256 resource_dispatcher_host_->CancelRequestsForRoute( | |
257 render_process_id_, render_widget_id); | |
258 } | |
259 | |
260 void RenderWidgetHelper::OnSimulateSwapOutACK( | 243 void RenderWidgetHelper::OnSimulateSwapOutACK( |
261 const ViewMsg_SwapOut_Params& params) { | 244 const ViewMsg_SwapOut_Params& params) { |
262 resource_dispatcher_host_->OnSimulateSwapOutACK(params); | 245 resource_dispatcher_host_->OnSimulateSwapOutACK(params); |
263 } | 246 } |
264 | 247 |
265 void RenderWidgetHelper::CreateNewWindow( | 248 void RenderWidgetHelper::CreateNewWindow( |
266 const ViewHostMsg_CreateWindow_Params& params, | 249 const ViewHostMsg_CreateWindow_Params& params, |
267 bool no_javascript_access, | 250 bool no_javascript_access, |
268 base::ProcessHandle render_process, | 251 base::ProcessHandle render_process, |
269 int* route_id, | 252 int* route_id, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { | 386 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { |
404 if (HANDLE_EINTR(close(i->second)) < 0) | 387 if (HANDLE_EINTR(close(i->second)) < 0) |
405 PLOG(ERROR) << "close: " << i->first; | 388 PLOG(ERROR) << "close: " << i->first; |
406 } | 389 } |
407 | 390 |
408 allocated_dibs_.clear(); | 391 allocated_dibs_.clear(); |
409 } | 392 } |
410 #endif | 393 #endif |
411 | 394 |
412 } // namespace content | 395 } // namespace content |
OLD | NEW |