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

Side by Side Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 42366: Fix single-process ui test failures from my previous change. The problem was... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 IPC::Message* sync_result) { 257 IPC::Message* sync_result) {
258 BeginRequest(request_id, request_data, sync_result, 0); 258 BeginRequest(request_id, request_data, sync_result, 0);
259 } 259 }
260 260
261 void ResourceDispatcherHost::BeginRequest( 261 void ResourceDispatcherHost::BeginRequest(
262 int request_id, 262 int request_id,
263 const ViewHostMsg_Resource_Request& request_data, 263 const ViewHostMsg_Resource_Request& request_data,
264 IPC::Message* sync_result, // only valid for sync 264 IPC::Message* sync_result, // only valid for sync
265 int route_id) { 265 int route_id) {
266 ChildProcessInfo::ProcessType process_type = receiver_->type(); 266 ChildProcessInfo::ProcessType process_type = receiver_->type();
267 int process_id = receiver_->pid(); 267 int process_id = receiver_->GetProcessId();
268 URLRequestContext* context = 268 URLRequestContext* context =
269 receiver_->GetRequestContext(request_id, request_data); 269 receiver_->GetRequestContext(request_id, request_data);
270 if (!context) 270 if (!context)
271 context = Profile::GetDefaultRequestContext(); 271 context = Profile::GetDefaultRequestContext();
272 272
273 if (is_shutdown_ || 273 if (is_shutdown_ ||
274 !ShouldServiceRequest(process_type, process_id, request_data)) { 274 !ShouldServiceRequest(process_type, process_id, request_data)) {
275 // Tell the renderer that this request was disallowed. 275 // Tell the renderer that this request was disallowed.
276 receiver_->Send(new ViewMsg_Resource_RequestComplete( 276 receiver_->Send(new ViewMsg_Resource_RequestComplete(
277 route_id, 277 route_id,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 request_data.main_frame_origin, 377 request_data.main_frame_origin,
378 request_data.resource_type, 378 request_data.resource_type,
379 upload_size); 379 upload_size);
380 extra_info->allow_download = ResourceType::IsFrame(request_data.resource_type) ; 380 extra_info->allow_download = ResourceType::IsFrame(request_data.resource_type) ;
381 request->set_user_data(extra_info); // takes pointer ownership 381 request->set_user_data(extra_info); // takes pointer ownership
382 382
383 BeginRequestInternal(request); 383 BeginRequestInternal(request);
384 } 384 }
385 385
386 void ResourceDispatcherHost::OnDataReceivedACK(int request_id) { 386 void ResourceDispatcherHost::OnDataReceivedACK(int request_id) {
387 DataReceivedACK(receiver_->pid(), request_id); 387 DataReceivedACK(receiver_->GetProcessId(), request_id);
388 } 388 }
389 389
390 void ResourceDispatcherHost::DataReceivedACK(int process_id, int request_id) { 390 void ResourceDispatcherHost::DataReceivedACK(int process_id, int request_id) {
391 PendingRequestList::iterator i = pending_requests_.find( 391 PendingRequestList::iterator i = pending_requests_.find(
392 GlobalRequestID(process_id, request_id)); 392 GlobalRequestID(process_id, request_id));
393 if (i == pending_requests_.end()) 393 if (i == pending_requests_.end())
394 return; 394 return;
395 395
396 ExtraRequestInfo* info = ExtraInfoForRequest(i->second); 396 ExtraRequestInfo* info = ExtraInfoForRequest(i->second);
397 397
398 // Decrement the number of pending data messages. 398 // Decrement the number of pending data messages.
399 info->pending_data_count--; 399 info->pending_data_count--;
400 400
401 // If the pending data count was higher than the max, resume the request. 401 // If the pending data count was higher than the max, resume the request.
402 if (info->pending_data_count == kMaxPendingDataMessages) { 402 if (info->pending_data_count == kMaxPendingDataMessages) {
403 // Decrement the pending data count one more time because we also 403 // Decrement the pending data count one more time because we also
404 // incremented it before pausing the request. 404 // incremented it before pausing the request.
405 info->pending_data_count--; 405 info->pending_data_count--;
406 406
407 // Resume the request. 407 // Resume the request.
408 PauseRequest(process_id, request_id, false); 408 PauseRequest(process_id, request_id, false);
409 } 409 }
410 } 410 }
411 411
412 void ResourceDispatcherHost::OnDownloadProgressACK(int request_id) { 412 void ResourceDispatcherHost::OnDownloadProgressACK(int request_id) {
413 // TODO(hclam): do something to help rate limiting the message. 413 // TODO(hclam): do something to help rate limiting the message.
414 } 414 }
415 415
416 void ResourceDispatcherHost::OnUploadProgressACK(int request_id) { 416 void ResourceDispatcherHost::OnUploadProgressACK(int request_id) {
417 int process_id = receiver_->pid(); 417 int process_id = receiver_->GetProcessId();
418 PendingRequestList::iterator i = pending_requests_.find( 418 PendingRequestList::iterator i = pending_requests_.find(
419 GlobalRequestID(process_id, request_id)); 419 GlobalRequestID(process_id, request_id));
420 if (i == pending_requests_.end()) 420 if (i == pending_requests_.end())
421 return; 421 return;
422 422
423 ExtraRequestInfo* info = ExtraInfoForRequest(i->second); 423 ExtraRequestInfo* info = ExtraInfoForRequest(i->second);
424 info->waiting_for_upload_progress_ack = false; 424 info->waiting_for_upload_progress_ack = false;
425 } 425 }
426 426
427 void ResourceDispatcherHost::OnCancelRequest(int request_id) { 427 void ResourceDispatcherHost::OnCancelRequest(int request_id) {
428 CancelRequest(receiver_->pid(), request_id, true, true); 428 CancelRequest(receiver_->GetProcessId(), request_id, true, true);
429 } 429 }
430 430
431 void ResourceDispatcherHost::OnClosePageACK(int new_render_process_host_id, 431 void ResourceDispatcherHost::OnClosePageACK(int new_render_process_host_id,
432 int new_request_id) { 432 int new_request_id) {
433 GlobalRequestID global_id(new_render_process_host_id, new_request_id); 433 GlobalRequestID global_id(new_render_process_host_id, new_request_id);
434 PendingRequestList::iterator i = pending_requests_.find(global_id); 434 PendingRequestList::iterator i = pending_requests_.find(global_id);
435 if (i == pending_requests_.end()) { 435 if (i == pending_requests_.end()) {
436 // If there are no matching pending requests, then this is not a 436 // If there are no matching pending requests, then this is not a
437 // cross-site navigation and we are just closing the tab/browser. 437 // cross-site navigation and we are just closing the tab/browser.
438 ui_loop_->PostTask(FROM_HERE, NewRunnableFunction( 438 ui_loop_->PostTask(FROM_HERE, NewRunnableFunction(
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 case ViewHostMsg_UploadProgress_ACK::ID: 1525 case ViewHostMsg_UploadProgress_ACK::ID:
1526 case ViewHostMsg_SyncLoad::ID: 1526 case ViewHostMsg_SyncLoad::ID:
1527 return true; 1527 return true;
1528 1528
1529 default: 1529 default:
1530 break; 1530 break;
1531 } 1531 }
1532 1532
1533 return false; 1533 return false;
1534 } 1534 }
OLDNEW
« no previous file with comments | « chrome/browser/memory_details.cc ('k') | chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698