| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "content/browser/renderer_host/render_widget_helper.h" | 5 #include "content/browser/renderer_host/render_widget_helper.h" |
| 6 | 6 |
| 7 #include "base/eintr_wrapper.h" | 7 #include "base/eintr_wrapper.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
| 10 #include "content/browser/renderer_host/render_process_host.h" | 10 #include "content/browser/renderer_host/render_process_host.h" |
| 11 #include "content/browser/renderer_host/render_view_host.h" | 11 #include "content/browser/renderer_host/render_view_host.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (render_process_id_ == -1) | 78 if (render_process_id_ == -1) |
| 79 return; | 79 return; |
| 80 | 80 |
| 81 BrowserThread::PostTask( | 81 BrowserThread::PostTask( |
| 82 BrowserThread::IO, FROM_HERE, | 82 BrowserThread::IO, FROM_HERE, |
| 83 NewRunnableMethod(this, | 83 NewRunnableMethod(this, |
| 84 &RenderWidgetHelper::OnCancelResourceRequests, | 84 &RenderWidgetHelper::OnCancelResourceRequests, |
| 85 render_widget_id)); | 85 render_widget_id)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void RenderWidgetHelper::CrossSiteClosePageACK( | 88 void RenderWidgetHelper::CrossSiteSwapOutACK( |
| 89 const ViewMsg_ClosePage_Params& params) { | 89 const ViewMsg_SwapOut_Params& params) { |
| 90 BrowserThread::PostTask( | 90 BrowserThread::PostTask( |
| 91 BrowserThread::IO, FROM_HERE, | 91 BrowserThread::IO, FROM_HERE, |
| 92 NewRunnableMethod(this, | 92 NewRunnableMethod(this, |
| 93 &RenderWidgetHelper::OnCrossSiteClosePageACK, | 93 &RenderWidgetHelper::OnCrossSiteSwapOutACK, |
| 94 params)); | 94 params)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool RenderWidgetHelper::WaitForUpdateMsg(int render_widget_id, | 97 bool RenderWidgetHelper::WaitForUpdateMsg(int render_widget_id, |
| 98 const base::TimeDelta& max_delay, | 98 const base::TimeDelta& max_delay, |
| 99 IPC::Message* msg) { | 99 IPC::Message* msg) { |
| 100 base::TimeTicks time_start = base::TimeTicks::Now(); | 100 base::TimeTicks time_start = base::TimeTicks::Now(); |
| 101 | 101 |
| 102 for (;;) { | 102 for (;;) { |
| 103 UpdateMsgProxy* proxy = NULL; | 103 UpdateMsgProxy* proxy = NULL; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 if (host) | 195 if (host) |
| 196 host->OnMessageReceived(proxy->message); | 196 host->OnMessageReceived(proxy->message); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void RenderWidgetHelper::OnCancelResourceRequests( | 199 void RenderWidgetHelper::OnCancelResourceRequests( |
| 200 int render_widget_id) { | 200 int render_widget_id) { |
| 201 resource_dispatcher_host_->CancelRequestsForRoute( | 201 resource_dispatcher_host_->CancelRequestsForRoute( |
| 202 render_process_id_, render_widget_id); | 202 render_process_id_, render_widget_id); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void RenderWidgetHelper::OnCrossSiteClosePageACK( | 205 void RenderWidgetHelper::OnCrossSiteSwapOutACK( |
| 206 const ViewMsg_ClosePage_Params& params) { | 206 const ViewMsg_SwapOut_Params& params) { |
| 207 resource_dispatcher_host_->OnClosePageACK(params); | 207 resource_dispatcher_host_->OnSwapOutACK(params); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void RenderWidgetHelper::CreateNewWindow( | 210 void RenderWidgetHelper::CreateNewWindow( |
| 211 const ViewHostMsg_CreateWindow_Params& params, | 211 const ViewHostMsg_CreateWindow_Params& params, |
| 212 base::ProcessHandle render_process, | 212 base::ProcessHandle render_process, |
| 213 int* route_id) { | 213 int* route_id) { |
| 214 *route_id = GetNextRoutingID(); | 214 *route_id = GetNextRoutingID(); |
| 215 // Block resource requests until the view is created, since the HWND might be | 215 // Block resource requests until the view is created, since the HWND might be |
| 216 // needed if a response ends up creating a plugin. | 216 // needed if a response ends up creating a plugin. |
| 217 resource_dispatcher_host_->BlockRequestsForRoute( | 217 resource_dispatcher_host_->BlockRequestsForRoute( |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 void RenderWidgetHelper::ClearAllocatedDIBs() { | 326 void RenderWidgetHelper::ClearAllocatedDIBs() { |
| 327 for (std::map<TransportDIB::Id, int>::iterator | 327 for (std::map<TransportDIB::Id, int>::iterator |
| 328 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { | 328 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { |
| 329 if (HANDLE_EINTR(close(i->second)) < 0) | 329 if (HANDLE_EINTR(close(i->second)) < 0) |
| 330 PLOG(ERROR) << "close: " << i->first; | 330 PLOG(ERROR) << "close: " << i->first; |
| 331 } | 331 } |
| 332 | 332 |
| 333 allocated_dibs_.clear(); | 333 allocated_dibs_.clear(); |
| 334 } | 334 } |
| 335 #endif | 335 #endif |
| OLD | NEW |