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

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

Issue 10809051: Fix regression of bug 205 where a plugin in a window shown with window.open may not have the correc… (Closed) Base URL: svn://chrome-svn/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 #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/eintr_wrapper.h" 9 #include "base/eintr_wrapper.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 void RenderWidgetHelper::CrossSiteSwapOutACK( 136 void RenderWidgetHelper::CrossSiteSwapOutACK(
137 const ViewMsg_SwapOut_Params& params) { 137 const ViewMsg_SwapOut_Params& params) {
138 BrowserThread::PostTask( 138 BrowserThread::PostTask(
139 BrowserThread::IO, FROM_HERE, 139 BrowserThread::IO, FROM_HERE,
140 base::Bind(&RenderWidgetHelper::OnCrossSiteSwapOutACK, 140 base::Bind(&RenderWidgetHelper::OnCrossSiteSwapOutACK,
141 this, 141 this,
142 params)); 142 params));
143 } 143 }
144 144
145 bool RenderWidgetHelper::WaitForBackingStoreMsg( 145 bool RenderWidgetHelper::WaitForBackingStoreMsg(
146 int render_widget_id, 146 int render_widget_id, const base::TimeDelta& max_delay, IPC::Message* msg) {
147 const base::TimeDelta& max_delay,
148 IPC::Message* msg) {
149 base::TimeTicks time_start = base::TimeTicks::Now(); 147 base::TimeTicks time_start = base::TimeTicks::Now();
150 148
151 for (;;) { 149 for (;;) {
152 BackingStoreMsgProxy* proxy = NULL; 150 BackingStoreMsgProxy* proxy = NULL;
153 { 151 {
154 base::AutoLock lock(pending_paints_lock_); 152 base::AutoLock lock(pending_paints_lock_);
155 153
156 BackingStoreMsgProxyMap::iterator it = 154 BackingStoreMsgProxyMap::iterator it =
157 pending_paints_.find(render_widget_id); 155 pending_paints_.find(render_widget_id);
158 if (it != pending_paints_.end()) { 156 if (it != pending_paints_.end()) {
(...skipping 23 matching lines...) Expand all
182 if (max_sleep_time <= base::TimeDelta::FromMilliseconds(0)) 180 if (max_sleep_time <= base::TimeDelta::FromMilliseconds(0))
183 break; 181 break;
184 182
185 base::ThreadRestrictions::ScopedAllowWait allow_wait; 183 base::ThreadRestrictions::ScopedAllowWait allow_wait;
186 event_.TimedWait(max_sleep_time); 184 event_.TimedWait(max_sleep_time);
187 } 185 }
188 186
189 return false; 187 return false;
190 } 188 }
191 189
190 void RenderWidgetHelper::ResumeRequestsForView(int route_id) {
191 // We only need to resume blocked requests if we used a valid route_id.
192 // See CreateNewWindow.
193 if (route_id != MSG_ROUTING_NONE) {
194 BrowserThread::PostTask(
195 BrowserThread::IO, FROM_HERE,
196 base::Bind(&RenderWidgetHelper::OnResumeRequestsForView,
197 this, route_id));
198 }
199 }
200
192 void RenderWidgetHelper::DidReceiveBackingStoreMsg(const IPC::Message& msg) { 201 void RenderWidgetHelper::DidReceiveBackingStoreMsg(const IPC::Message& msg) {
193 int render_widget_id = msg.routing_id(); 202 int render_widget_id = msg.routing_id();
194 203
195 BackingStoreMsgProxy* proxy = new BackingStoreMsgProxy(this, msg); 204 BackingStoreMsgProxy* proxy = new BackingStoreMsgProxy(this, msg);
196 { 205 {
197 base::AutoLock lock(pending_paints_lock_); 206 base::AutoLock lock(pending_paints_lock_);
198 207
199 pending_paints_[render_widget_id].push_back(proxy); 208 pending_paints_[render_widget_id].push_back(proxy);
200 } 209 }
201 210
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 290 }
282 291
283 void RenderWidgetHelper::OnCreateWindowOnUI( 292 void RenderWidgetHelper::OnCreateWindowOnUI(
284 const ViewHostMsg_CreateWindow_Params& params, 293 const ViewHostMsg_CreateWindow_Params& params,
285 int route_id, 294 int route_id,
286 SessionStorageNamespace* session_storage_namespace) { 295 SessionStorageNamespace* session_storage_namespace) {
287 RenderViewHostImpl* host = 296 RenderViewHostImpl* host =
288 RenderViewHostImpl::FromID(render_process_id_, params.opener_id); 297 RenderViewHostImpl::FromID(render_process_id_, params.opener_id);
289 if (host) 298 if (host)
290 host->CreateNewWindow(route_id, params, session_storage_namespace); 299 host->CreateNewWindow(route_id, params, session_storage_namespace);
291
292 // We only need to resume blocked requests if we used a valid route_id.
293 // See CreateNewWindow.
294 if (route_id != MSG_ROUTING_NONE) {
295 BrowserThread::PostTask(
296 BrowserThread::IO, FROM_HERE,
297 base::Bind(&RenderWidgetHelper::OnCreateWindowOnIO, this, route_id));
298 }
299 } 300 }
300 301
301 void RenderWidgetHelper::OnCreateWindowOnIO(int route_id) { 302 void RenderWidgetHelper::OnResumeRequestsForView(int route_id) {
302 resource_dispatcher_host_->ResumeBlockedRequestsForRoute( 303 resource_dispatcher_host_->ResumeBlockedRequestsForRoute(
303 render_process_id_, route_id); 304 render_process_id_, route_id);
304 } 305 }
305 306
306 void RenderWidgetHelper::CreateNewWidget(int opener_id, 307 void RenderWidgetHelper::CreateNewWidget(int opener_id,
307 WebKit::WebPopupType popup_type, 308 WebKit::WebPopupType popup_type,
308 int* route_id, 309 int* route_id,
309 int* surface_id) { 310 int* surface_id) {
310 *route_id = GetNextRoutingID(); 311 *route_id = GetNextRoutingID();
311 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( 312 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) { 398 i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) {
398 if (HANDLE_EINTR(close(i->second)) < 0) 399 if (HANDLE_EINTR(close(i->second)) < 0)
399 PLOG(ERROR) << "close: " << i->first; 400 PLOG(ERROR) << "close: " << i->first;
400 } 401 }
401 402
402 allocated_dibs_.clear(); 403 allocated_dibs_.clear();
403 } 404 }
404 #endif 405 #endif
405 406
406 } // namespace content 407 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698