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::SimulateSwapOutACK( | 130 void RenderWidgetHelper::ResumeDeferredNavigation( |
131 const ViewMsg_SwapOut_Params& params) { | 131 const GlobalRequestID& request_id) { |
132 BrowserThread::PostTask( | 132 BrowserThread::PostTask( |
133 BrowserThread::IO, FROM_HERE, | 133 BrowserThread::IO, FROM_HERE, |
134 base::Bind(&RenderWidgetHelper::OnSimulateSwapOutACK, | 134 base::Bind(&RenderWidgetHelper::OnResumeDeferredNavigation, |
135 this, | 135 this, |
136 params)); | 136 request_id)); |
137 } | 137 } |
138 | 138 |
139 bool RenderWidgetHelper::WaitForBackingStoreMsg( | 139 bool RenderWidgetHelper::WaitForBackingStoreMsg( |
140 int render_widget_id, const base::TimeDelta& max_delay, IPC::Message* msg) { | 140 int render_widget_id, const base::TimeDelta& max_delay, IPC::Message* msg) { |
141 base::TimeTicks time_start = base::TimeTicks::Now(); | 141 base::TimeTicks time_start = base::TimeTicks::Now(); |
142 | 142 |
143 for (;;) { | 143 for (;;) { |
144 BackingStoreMsgProxy* proxy = NULL; | 144 BackingStoreMsgProxy* proxy = NULL; |
145 { | 145 { |
146 base::AutoLock lock(pending_paints_lock_); | 146 base::AutoLock lock(pending_paints_lock_); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void RenderWidgetHelper::OnDispatchBackingStoreMsg( | 233 void RenderWidgetHelper::OnDispatchBackingStoreMsg( |
234 BackingStoreMsgProxy* proxy) { | 234 BackingStoreMsgProxy* proxy) { |
235 OnDiscardBackingStoreMsg(proxy); | 235 OnDiscardBackingStoreMsg(proxy); |
236 | 236 |
237 // It is reasonable for the host to no longer exist. | 237 // It is reasonable for the host to no longer exist. |
238 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); | 238 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); |
239 if (host) | 239 if (host) |
240 host->OnMessageReceived(proxy->message()); | 240 host->OnMessageReceived(proxy->message()); |
241 } | 241 } |
242 | 242 |
243 void RenderWidgetHelper::OnSimulateSwapOutACK( | 243 void RenderWidgetHelper::OnResumeDeferredNavigation( |
244 const ViewMsg_SwapOut_Params& params) { | 244 const GlobalRequestID& request_id) { |
245 resource_dispatcher_host_->OnSimulateSwapOutACK(params); | 245 resource_dispatcher_host_->ResumeDeferredNavigation(request_id); |
246 } | 246 } |
247 | 247 |
248 void RenderWidgetHelper::CreateNewWindow( | 248 void RenderWidgetHelper::CreateNewWindow( |
249 const ViewHostMsg_CreateWindow_Params& params, | 249 const ViewHostMsg_CreateWindow_Params& params, |
250 bool no_javascript_access, | 250 bool no_javascript_access, |
251 base::ProcessHandle render_process, | 251 base::ProcessHandle render_process, |
252 int* route_id, | 252 int* route_id, |
253 int* main_frame_route_id, | 253 int* main_frame_route_id, |
254 int* surface_id, | 254 int* surface_id, |
255 SessionStorageNamespace* session_storage_namespace) { | 255 SessionStorageNamespace* session_storage_namespace) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { | 394 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { |
395 if (HANDLE_EINTR(close(i->second)) < 0) | 395 if (HANDLE_EINTR(close(i->second)) < 0) |
396 PLOG(ERROR) << "close: " << i->first; | 396 PLOG(ERROR) << "close: " << i->first; |
397 } | 397 } |
398 | 398 |
399 allocated_dibs_.clear(); | 399 allocated_dibs_.clear(); |
400 } | 400 } |
401 #endif | 401 #endif |
402 | 402 |
403 } // namespace content | 403 } // namespace content |
OLD | NEW |