OLD | NEW |
---|---|
1 // Copyright (c) 2011 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 // 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 "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 allow_cross_origin_auth_prompt_(false) { | 305 allow_cross_origin_auth_prompt_(false) { |
306 resource_queue_.Initialize(resource_queue_delegates); | 306 resource_queue_.Initialize(resource_queue_delegates); |
307 | 307 |
308 ANNOTATE_BENIGN_RACE( | 308 ANNOTATE_BENIGN_RACE( |
309 &last_user_gesture_time_, | 309 &last_user_gesture_time_, |
310 "We don't care about the precise value, see http://crbug.com/92889"); | 310 "We don't care about the precise value, see http://crbug.com/92889"); |
311 } | 311 } |
312 | 312 |
313 ResourceDispatcherHost::~ResourceDispatcherHost() { | 313 ResourceDispatcherHost::~ResourceDispatcherHost() { |
314 AsyncResourceHandler::GlobalCleanup(); | 314 AsyncResourceHandler::GlobalCleanup(); |
315 for (PendingRequestList::const_iterator i = pending_requests_.begin(); | |
316 i != pending_requests_.end(); ++i) { | |
317 transferred_navigations_.erase(i->first); | |
318 } | |
315 STLDeleteValues(&pending_requests_); | 319 STLDeleteValues(&pending_requests_); |
320 DCHECK(transferred_navigations_.empty()); | |
316 } | 321 } |
317 | 322 |
318 void ResourceDispatcherHost::Initialize() { | 323 void ResourceDispatcherHost::Initialize() { |
319 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 324 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
320 BrowserThread::PostTask( | 325 BrowserThread::PostTask( |
321 BrowserThread::IO, FROM_HERE, | 326 BrowserThread::IO, FROM_HERE, |
322 base::Bind(&appcache::AppCacheInterceptor::EnsureRegistered)); | 327 base::Bind(&appcache::AppCacheInterceptor::EnsureRegistered)); |
323 } | 328 } |
324 | 329 |
325 void ResourceDispatcherHost::Shutdown() { | 330 void ResourceDispatcherHost::Shutdown() { |
326 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 331 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
327 BrowserThread::PostTask(BrowserThread::IO, | 332 BrowserThread::PostTask(BrowserThread::IO, |
328 FROM_HERE, | 333 FROM_HERE, |
329 base::Bind(&ResourceDispatcherHost::OnShutdown, | 334 base::Bind(&ResourceDispatcherHost::OnShutdown, |
330 base::Unretained(this))); | 335 base::Unretained(this))); |
331 } | 336 } |
332 | 337 |
333 void ResourceDispatcherHost::SetRequestInfo( | 338 void ResourceDispatcherHost::SetRequestInfo( |
334 net::URLRequest* request, | 339 net::URLRequest* request, |
335 ResourceDispatcherHostRequestInfo* info) { | 340 ResourceDispatcherHostRequestInfo* info) { |
336 request->SetUserData(NULL, info); | 341 request->SetUserData(NULL, info); |
337 } | 342 } |
338 | 343 |
339 void ResourceDispatcherHost::OnShutdown() { | 344 void ResourceDispatcherHost::OnShutdown() { |
340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
341 is_shutdown_ = true; | 346 is_shutdown_ = true; |
342 resource_queue_.Shutdown(); | 347 resource_queue_.Shutdown(); |
348 for (PendingRequestList::const_iterator i = pending_requests_.begin(); | |
349 i != pending_requests_.end(); ++i) { | |
350 transferred_navigations_.erase(i->first); | |
351 } | |
343 STLDeleteValues(&pending_requests_); | 352 STLDeleteValues(&pending_requests_); |
344 // Make sure we shutdown the timer now, otherwise by the time our destructor | 353 // Make sure we shutdown the timer now, otherwise by the time our destructor |
345 // runs if the timer is still running the Task is deleted twice (once by | 354 // runs if the timer is still running the Task is deleted twice (once by |
346 // the MessageLoop and the second time by RepeatingTimer). | 355 // the MessageLoop and the second time by RepeatingTimer). |
347 update_load_states_timer_.Stop(); | 356 update_load_states_timer_.Stop(); |
348 | 357 |
349 // Clear blocked requests if any left. | 358 // Clear blocked requests if any left. |
350 // Note that we have to do this in 2 passes as we cannot call | 359 // Note that we have to do this in 2 passes as we cannot call |
351 // CancelBlockedRequestsForRoute while iterating over | 360 // CancelBlockedRequestsForRoute while iterating over |
352 // blocked_requests_map_, as it modifies it. | 361 // blocked_requests_map_, as it modifies it. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 int route_id) { | 459 int route_id) { |
451 content::ProcessType process_type = filter_->process_type(); | 460 content::ProcessType process_type = filter_->process_type(); |
452 int child_id = filter_->child_id(); | 461 int child_id = filter_->child_id(); |
453 | 462 |
454 // If we crash here, figure out what URL the renderer was requesting. | 463 // If we crash here, figure out what URL the renderer was requesting. |
455 // http://crbug.com/91398 | 464 // http://crbug.com/91398 |
456 char url_buf[128]; | 465 char url_buf[128]; |
457 base::strlcpy(url_buf, request_data.url.spec().c_str(), arraysize(url_buf)); | 466 base::strlcpy(url_buf, request_data.url.spec().c_str(), arraysize(url_buf)); |
458 base::debug::Alias(url_buf); | 467 base::debug::Alias(url_buf); |
459 | 468 |
469 // TODO(mpcomplete): Step 3. (See steps 1-2 below). | |
Charlie Reis
2011/12/02 22:38:11
This comment needs updating and should probably ha
Matt Perry
2011/12/03 00:14:24
Done.
| |
470 // If the request that's coming in is a cross-process transferring, then we | |
471 // want to reuse and resume the old request rather than start a new one. | |
472 // I'm not entirely sure how much of the BeginRequest code should run. We | |
473 // definitely want to create new ResourceHandlers and ExtraInfo, since those | |
474 // are tied to the process. | |
475 // Also, I'm not clear what should happen if any of the early returns are hit | |
476 // before we actually resume the request via FollowDeferredRedirect. I think | |
477 // we're then left with an orphaned request that will never be deleted. We | |
478 // probably want to cancel it in those cases. | |
479 // It's probably best to split apart BeginRequest into 2 methods, 1 for | |
480 // regular requests and one for transferred ones - probably with some shared | |
481 // code, but not all. | |
482 net::URLRequest* deferred_request = NULL; | |
483 | |
484 GlobalRequestID old_request_id(request_data.transferred_request_child_id, | |
485 request_data.transferred_request_request_id); | |
486 TransferredNavigations::iterator iter = | |
487 transferred_navigations_.find(old_request_id); | |
488 if (iter != transferred_navigations_.end()) { | |
489 deferred_request = iter->second; | |
490 pending_requests_.erase(old_request_id); | |
491 transferred_navigations_.erase(iter); | |
492 } | |
493 | |
460 const content::ResourceContext& resource_context = | 494 const content::ResourceContext& resource_context = |
461 filter_->resource_context(); | 495 filter_->resource_context(); |
462 | 496 |
463 // Might need to resolve the blob references in the upload data. | 497 // Might need to resolve the blob references in the upload data. |
464 if (request_data.upload_data) { | 498 if (request_data.upload_data) { |
465 resource_context.blob_storage_context()->controller()-> | 499 resource_context.blob_storage_context()->controller()-> |
466 ResolveBlobReferencesInUploadData(request_data.upload_data.get()); | 500 ResolveBlobReferencesInUploadData(request_data.upload_data.get()); |
467 } | 501 } |
468 | 502 |
469 if (is_shutdown_ || | 503 if (is_shutdown_ || |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 handler = new RedirectToFileResourceHandler(handler, child_id, this); | 535 handler = new RedirectToFileResourceHandler(handler, child_id, this); |
502 | 536 |
503 if (HandleExternalProtocol(request_id, child_id, route_id, | 537 if (HandleExternalProtocol(request_id, child_id, route_id, |
504 request_data.url, request_data.resource_type, | 538 request_data.url, request_data.resource_type, |
505 *resource_context.request_context()->job_factory(), | 539 *resource_context.request_context()->job_factory(), |
506 handler)) { | 540 handler)) { |
507 return; | 541 return; |
508 } | 542 } |
509 | 543 |
510 // Construct the request. | 544 // Construct the request. |
511 net::URLRequest* request = new net::URLRequest(request_data.url, this); | 545 net::URLRequest* request; |
512 request->set_method(request_data.method); | 546 if (deferred_request) { |
513 request->set_first_party_for_cookies(request_data.first_party_for_cookies); | 547 request = deferred_request; |
514 request->set_referrer(referrer.spec()); | 548 } else { |
515 net::HttpRequestHeaders headers; | 549 request = new net::URLRequest(request_data.url, this); |
516 headers.AddHeadersFromString(request_data.headers); | 550 request->set_method(request_data.method); |
517 request->SetExtraRequestHeaders(headers); | 551 request->set_first_party_for_cookies(request_data.first_party_for_cookies); |
552 request->set_referrer(referrer.spec()); | |
553 net::HttpRequestHeaders headers; | |
554 headers.AddHeadersFromString(request_data.headers); | |
555 request->SetExtraRequestHeaders(headers); | |
556 } | |
518 | 557 |
519 int load_flags = request_data.load_flags; | 558 int load_flags = request_data.load_flags; |
520 // Although EV status is irrelevant to sub-frames and sub-resources, we have | 559 // Although EV status is irrelevant to sub-frames and sub-resources, we have |
521 // to perform EV certificate verification on all resources because an HTTP | 560 // to perform EV certificate verification on all resources because an HTTP |
522 // keep-alive connection created to load a sub-frame or a sub-resource could | 561 // keep-alive connection created to load a sub-frame or a sub-resource could |
523 // be reused to load a main frame. | 562 // be reused to load a main frame. |
524 load_flags |= net::LOAD_VERIFY_EV_CERT; | 563 load_flags |= net::LOAD_VERIFY_EV_CERT; |
525 if (request_data.resource_type == ResourceType::MAIN_FRAME) { | 564 if (request_data.resource_type == ResourceType::MAIN_FRAME) { |
526 load_flags |= net::LOAD_MAIN_FRAME; | 565 load_flags |= net::LOAD_MAIN_FRAME; |
527 } else if (request_data.resource_type == ResourceType::SUB_FRAME) { | 566 } else if (request_data.resource_type == ResourceType::SUB_FRAME) { |
528 load_flags |= net::LOAD_SUB_FRAME; | 567 load_flags |= net::LOAD_SUB_FRAME; |
529 } else if (request_data.resource_type == ResourceType::PREFETCH) { | 568 } else if (request_data.resource_type == ResourceType::PREFETCH) { |
530 load_flags |= (net::LOAD_PREFETCH | net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); | 569 load_flags |= (net::LOAD_PREFETCH | net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); |
531 } else if (request_data.resource_type == ResourceType::FAVICON) { | 570 } else if (request_data.resource_type == ResourceType::FAVICON) { |
532 load_flags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN; | 571 load_flags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN; |
533 } | 572 } |
534 | 573 |
535 if (sync_result) | 574 if (sync_result) |
536 load_flags |= net::LOAD_IGNORE_LIMITS; | 575 load_flags |= net::LOAD_IGNORE_LIMITS; |
537 | 576 |
538 ChildProcessSecurityPolicy* policy = | 577 ChildProcessSecurityPolicy* policy = |
539 ChildProcessSecurityPolicy::GetInstance(); | 578 ChildProcessSecurityPolicy::GetInstance(); |
540 if (!policy->CanUseCookiesForOrigin(child_id, request_data.url)) { | 579 if (!policy->CanUseCookiesForOrigin(child_id, request_data.url)) { |
541 load_flags |= (net::LOAD_DO_NOT_SEND_COOKIES | | 580 load_flags |= (net::LOAD_DO_NOT_SEND_COOKIES | |
542 net::LOAD_DO_NOT_SEND_AUTH_DATA | | 581 net::LOAD_DO_NOT_SEND_AUTH_DATA | |
543 net::LOAD_DO_NOT_SAVE_COOKIES); | 582 net::LOAD_DO_NOT_SAVE_COOKIES); |
544 } | 583 } |
545 | 584 |
546 // Raw headers are sensitive, as they inclide Cookie/Set-Cookie, so only | 585 // Raw headers are sensitive, as they include Cookie/Set-Cookie, so only |
547 // allow requesting them if requestor has ReadRawCookies permission. | 586 // allow requesting them if requester has ReadRawCookies permission. |
548 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 587 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
549 && !policy->CanReadRawCookies(child_id)) { | 588 && !policy->CanReadRawCookies(child_id)) { |
550 VLOG(1) << "Denied unathorized request for raw headers"; | 589 VLOG(1) << "Denied unauthorized request for raw headers"; |
551 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 590 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
552 } | 591 } |
553 | 592 |
554 request->set_load_flags(load_flags); | 593 request->set_load_flags(load_flags); |
594 | |
555 request->set_context( | 595 request->set_context( |
556 filter_->GetURLRequestContext(request_data.resource_type)); | 596 filter_->GetURLRequestContext(request_data.resource_type)); |
557 request->set_priority(DetermineRequestPriority(request_data.resource_type)); | 597 request->set_priority(DetermineRequestPriority(request_data.resource_type)); |
558 | 598 |
559 // Set upload data. | 599 // Set upload data. |
560 uint64 upload_size = 0; | 600 uint64 upload_size = 0; |
561 if (request_data.upload_data) { | 601 if (request_data.upload_data) { |
562 request->set_upload(request_data.upload_data); | 602 request->set_upload(request_data.upload_data); |
563 upload_size = request_data.upload_data->GetContentLength(); | 603 upload_size = request_data.upload_data->GetContentLength(); |
564 } | 604 } |
(...skipping 12 matching lines...) Expand all Loading... | |
577 child_id, | 617 child_id, |
578 route_id, | 618 route_id, |
579 this); | 619 this); |
580 } | 620 } |
581 | 621 |
582 // Insert a buffered event handler before the actual one. | 622 // Insert a buffered event handler before the actual one. |
583 handler = new BufferedResourceHandler(handler, this, request); | 623 handler = new BufferedResourceHandler(handler, this, request); |
584 | 624 |
585 if (delegate_) { | 625 if (delegate_) { |
586 bool sub = request_data.resource_type != ResourceType::MAIN_FRAME; | 626 bool sub = request_data.resource_type != ResourceType::MAIN_FRAME; |
587 handler = delegate_->RequestBeginning(handler, request, resource_context, | 627 bool is_continuation_of_transferred_request = |
588 sub, child_id, route_id); | 628 (deferred_request != NULL); |
629 handler = delegate_->RequestBeginning( | |
630 handler, request, resource_context, sub, child_id, route_id, | |
631 is_continuation_of_transferred_request); | |
589 } | 632 } |
590 | 633 |
591 // Make extra info and read footer (contains request ID). | 634 // Make extra info and read footer (contains request ID). |
592 ResourceDispatcherHostRequestInfo* extra_info = | 635 ResourceDispatcherHostRequestInfo* extra_info = |
593 new ResourceDispatcherHostRequestInfo( | 636 new ResourceDispatcherHostRequestInfo( |
594 handler, | 637 handler, |
595 process_type, | 638 process_type, |
596 child_id, | 639 child_id, |
597 route_id, | 640 route_id, |
598 request_data.origin_pid, | 641 request_data.origin_pid, |
(...skipping 18 matching lines...) Expand all Loading... | |
617 resource_context.blob_storage_context()->controller(); | 660 resource_context.blob_storage_context()->controller(); |
618 extra_info->set_requested_blob_data( | 661 extra_info->set_requested_blob_data( |
619 controller->GetBlobDataFromUrl(request->url())); | 662 controller->GetBlobDataFromUrl(request->url())); |
620 } | 663 } |
621 | 664 |
622 // Have the appcache associate its extra info with the request. | 665 // Have the appcache associate its extra info with the request. |
623 appcache::AppCacheInterceptor::SetExtraRequestInfo( | 666 appcache::AppCacheInterceptor::SetExtraRequestInfo( |
624 request, resource_context.appcache_service(), child_id, | 667 request, resource_context.appcache_service(), child_id, |
625 request_data.appcache_host_id, request_data.resource_type); | 668 request_data.appcache_host_id, request_data.resource_type); |
626 | 669 |
627 BeginRequestInternal(request); | 670 if (deferred_request) { |
671 GlobalRequestID global_id(extra_info->child_id(), extra_info->request_id()); | |
672 pending_requests_[global_id] = request; | |
673 request->FollowDeferredRedirect(); | |
674 } else { | |
675 BeginRequestInternal(request); | |
676 } | |
628 } | 677 } |
629 | 678 |
630 void ResourceDispatcherHost::OnReleaseDownloadedFile(int request_id) { | 679 void ResourceDispatcherHost::OnReleaseDownloadedFile(int request_id) { |
631 DCHECK(pending_requests_.end() == | 680 DCHECK(pending_requests_.end() == |
632 pending_requests_.find( | 681 pending_requests_.find( |
633 GlobalRequestID(filter_->child_id(), request_id))); | 682 GlobalRequestID(filter_->child_id(), request_id))); |
634 UnregisterDownloadedTempFile(filter_->child_id(), request_id); | 683 UnregisterDownloadedTempFile(filter_->child_id(), request_id); |
635 } | 684 } |
636 | 685 |
637 void ResourceDispatcherHost::OnDataReceivedACK(int request_id) { | 686 void ResourceDispatcherHost::OnDataReceivedACK(int request_id) { |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1179 NOTREACHED() << "Trying to remove a request that's not here"; | 1228 NOTREACHED() << "Trying to remove a request that's not here"; |
1180 return; | 1229 return; |
1181 } | 1230 } |
1182 RemovePendingRequest(i); | 1231 RemovePendingRequest(i); |
1183 } | 1232 } |
1184 | 1233 |
1185 void ResourceDispatcherHost::RemovePendingRequest( | 1234 void ResourceDispatcherHost::RemovePendingRequest( |
1186 const PendingRequestList::iterator& iter) { | 1235 const PendingRequestList::iterator& iter) { |
1187 ResourceDispatcherHostRequestInfo* info = InfoForRequest(iter->second); | 1236 ResourceDispatcherHostRequestInfo* info = InfoForRequest(iter->second); |
1188 | 1237 |
1238 // This is called via CancelRequestsForRoute to remove all requests for a | |
1239 // closing tab. We don't want to remove requests that are being transferred | |
1240 // to a new tab. | |
Charlie Reis
2011/12/02 22:38:11
When would a request be transferred from one tab t
Matt Perry
2011/12/03 00:14:24
I moved this block to a more isolated location, an
| |
1241 GlobalRequestID id(info->child_id(), info->request_id()); | |
1242 if (transferred_navigations_.find(id) != transferred_navigations_.end()) | |
1243 return; | |
1244 | |
1189 // Remove the memory credit that we added when pushing the request onto | 1245 // Remove the memory credit that we added when pushing the request onto |
1190 // the pending list. | 1246 // the pending list. |
1191 IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost(), | 1247 IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost(), |
1192 info->child_id()); | 1248 info->child_id()); |
1193 | 1249 |
1194 // Notify interested parties that the request object is going away. | 1250 // Notify interested parties that the request object is going away. |
1195 if (info->login_delegate()) | 1251 if (info->login_delegate()) |
1196 info->login_delegate()->OnRequestCancelled(); | 1252 info->login_delegate()->OnRequestCancelled(); |
1197 if (info->ssl_client_auth_handler()) | 1253 if (info->ssl_client_auth_handler()) |
1198 info->ssl_client_auth_handler()->OnRequestCancelled(); | 1254 info->ssl_client_auth_handler()->OnRequestCancelled(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1411 | 1467 |
1412 NotifyResponseStarted(request, info->child_id()); | 1468 NotifyResponseStarted(request, info->child_id()); |
1413 info->set_called_on_response_started(true); | 1469 info->set_called_on_response_started(true); |
1414 return info->resource_handler()->OnResponseStarted(info->request_id(), | 1470 return info->resource_handler()->OnResponseStarted(info->request_id(), |
1415 response.get()); | 1471 response.get()); |
1416 } | 1472 } |
1417 | 1473 |
1418 void ResourceDispatcherHost::CancelRequest(int child_id, | 1474 void ResourceDispatcherHost::CancelRequest(int child_id, |
1419 int request_id, | 1475 int request_id, |
1420 bool from_renderer) { | 1476 bool from_renderer) { |
1421 PendingRequestList::iterator i = pending_requests_.find( | 1477 GlobalRequestID id(child_id, request_id); |
1422 GlobalRequestID(child_id, request_id)); | 1478 if (from_renderer) { |
1479 // When the old renderer dies, it sends a message to us to cancel its | |
1480 // requests. | |
1481 if (transferred_navigations_.find(id) != transferred_navigations_.end()) | |
1482 return; | |
1483 } | |
1484 | |
1485 PendingRequestList::iterator i = pending_requests_.find(id); | |
1423 if (i == pending_requests_.end()) { | 1486 if (i == pending_requests_.end()) { |
1424 // We probably want to remove this warning eventually, but I wanted to be | 1487 // We probably want to remove this warning eventually, but I wanted to be |
1425 // able to notice when this happens during initial development since it | 1488 // able to notice when this happens during initial development since it |
1426 // should be rare and may indicate a bug. | 1489 // should be rare and may indicate a bug. |
1427 DLOG(WARNING) << "Canceling a request that wasn't found"; | 1490 DLOG(WARNING) << "Canceling a request that wasn't found"; |
1428 return; | 1491 return; |
1429 } | 1492 } |
1430 net::URLRequest* request = i->second; | 1493 net::URLRequest* request = i->second; |
1431 const bool started_before_cancel = request->is_pending(); | 1494 const bool started_before_cancel = request->is_pending(); |
1432 | 1495 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1474 OutstandingRequestsMemoryCostMap::iterator prev_entry = | 1537 OutstandingRequestsMemoryCostMap::iterator prev_entry = |
1475 outstanding_requests_memory_cost_map_.find(child_id); | 1538 outstanding_requests_memory_cost_map_.find(child_id); |
1476 int new_cost = 0; | 1539 int new_cost = 0; |
1477 if (prev_entry != outstanding_requests_memory_cost_map_.end()) | 1540 if (prev_entry != outstanding_requests_memory_cost_map_.end()) |
1478 new_cost = prev_entry->second; | 1541 new_cost = prev_entry->second; |
1479 | 1542 |
1480 // Insert/update the total; delete entries when their value reaches 0. | 1543 // Insert/update the total; delete entries when their value reaches 0. |
1481 new_cost += cost; | 1544 new_cost += cost; |
1482 CHECK(new_cost >= 0); | 1545 CHECK(new_cost >= 0); |
1483 if (new_cost == 0) | 1546 if (new_cost == 0) |
1484 outstanding_requests_memory_cost_map_.erase(prev_entry); | 1547 outstanding_requests_memory_cost_map_.erase(child_id); |
1485 else | 1548 else |
1486 outstanding_requests_memory_cost_map_[child_id] = new_cost; | 1549 outstanding_requests_memory_cost_map_[child_id] = new_cost; |
1487 | 1550 |
1488 return new_cost; | 1551 return new_cost; |
1489 } | 1552 } |
1490 | 1553 |
1491 // static | 1554 // static |
1492 int ResourceDispatcherHost::CalculateApproximateMemoryCost( | 1555 int ResourceDispatcherHost::CalculateApproximateMemoryCost( |
1493 net::URLRequest* request) { | 1556 net::URLRequest* request) { |
1494 // The following fields should be a minor size contribution (experimentally | 1557 // The following fields should be a minor size contribution (experimentally |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2172 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2235 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2173 } | 2236 } |
2174 | 2237 |
2175 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2238 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2176 return allow_cross_origin_auth_prompt_; | 2239 return allow_cross_origin_auth_prompt_; |
2177 } | 2240 } |
2178 | 2241 |
2179 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2242 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2180 allow_cross_origin_auth_prompt_ = value; | 2243 allow_cross_origin_auth_prompt_ = value; |
2181 } | 2244 } |
2245 | |
2246 void ResourceDispatcherHost::MarkAsTransferredNavigation( | |
2247 const GlobalRequestID& transferred_request_id, | |
2248 net::URLRequest* ransferred_request) { | |
2249 transferred_navigations_[transferred_request_id] = ransferred_request; | |
2250 } | |
OLD | NEW |