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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 12886022: Implement offline mode behind a flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments. Created 7 years, 8 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 // 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/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 net::Error net_error) { 224 net::Error net_error) {
225 if (started_cb.is_null()) 225 if (started_cb.is_null())
226 return net_error; 226 return net_error;
227 BrowserThread::PostTask( 227 BrowserThread::PostTask(
228 BrowserThread::UI, FROM_HERE, 228 BrowserThread::UI, FROM_HERE,
229 base::Bind(started_cb, static_cast<DownloadItem*>(NULL), net_error)); 229 base::Bind(started_cb, static_cast<DownloadItem*>(NULL), net_error));
230 230
231 return net_error; 231 return net_error;
232 } 232 }
233 233
234 int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data, 234 int BuildLoadFlagsForRequest(
235 int child_id, bool is_sync_load) { 235 const ResourceHostMsg_Request& request_data,
236 int child_id,
237 bool is_sync_load) {
236 int load_flags = request_data.load_flags; 238 int load_flags = request_data.load_flags;
237 239
238 // Although EV status is irrelevant to sub-frames and sub-resources, we have 240 // Although EV status is irrelevant to sub-frames and sub-resources, we have
239 // to perform EV certificate verification on all resources because an HTTP 241 // to perform EV certificate verification on all resources because an HTTP
240 // keep-alive connection created to load a sub-frame or a sub-resource could 242 // keep-alive connection created to load a sub-frame or a sub-resource could
241 // be reused to load a main frame. 243 // be reused to load a main frame.
242 load_flags |= net::LOAD_VERIFY_EV_CERT; 244 load_flags |= net::LOAD_VERIFY_EV_CERT;
243 if (request_data.resource_type == ResourceType::MAIN_FRAME) { 245 if (request_data.resource_type == ResourceType::MAIN_FRAME) {
244 load_flags |= net::LOAD_MAIN_FRAME; 246 load_flags |= net::LOAD_MAIN_FRAME;
245 } else if (request_data.resource_type == ResourceType::SUB_FRAME) { 247 } else if (request_data.resource_type == ResourceType::SUB_FRAME) {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 BrowserThread::PostTask( 697 BrowserThread::PostTask(
696 BrowserThread::UI, FROM_HERE, 698 BrowserThread::UI, FROM_HERE,
697 base::Bind( 699 base::Bind(
698 &NotifyOnUI<ResourceRedirectDetails>, 700 &NotifyOnUI<ResourceRedirectDetails>,
699 static_cast<int>(NOTIFICATION_RESOURCE_RECEIVED_REDIRECT), 701 static_cast<int>(NOTIFICATION_RESOURCE_RECEIVED_REDIRECT),
700 render_process_id, render_view_id, base::Passed(&detail))); 702 render_process_id, render_view_id, base::Passed(&detail)));
701 } 703 }
702 704
703 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) { 705 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) {
704 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); 706 ResourceRequestInfoImpl* info = loader->GetRequestInfo();
707 // There should be an entry in the map created when we dispatched the
708 // request.
709 GlobalRoutingID routing_id(info->GetGlobalRoutingID());
710 DCHECK(offline_policy_map_.end() != offline_policy_map_.find(routing_id));
711 offline_policy_map_[routing_id]->
712 UpdateStateForCompletedRequest(loader->request()->response_info());
705 713
706 int render_process_id, render_view_id; 714 int render_process_id, render_view_id;
707 if (!info->GetAssociatedRenderView(&render_process_id, &render_view_id)) 715 if (!info->GetAssociatedRenderView(&render_process_id, &render_view_id))
708 return; 716 return;
709 717
710 // Notify the observers on the UI thread. 718 // Notify the observers on the UI thread.
711 scoped_ptr<ResourceRequestDetails> detail(new ResourceRequestDetails( 719 scoped_ptr<ResourceRequestDetails> detail(new ResourceRequestDetails(
712 loader->request(), 720 loader->request(),
713 GetCertID(loader->request(), info->GetChildID()))); 721 GetCertID(loader->request(), info->GetChildID())));
714 BrowserThread::PostTask( 722 BrowserThread::PostTask(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 790
783 // Make sure we shutdown the timer now, otherwise by the time our destructor 791 // Make sure we shutdown the timer now, otherwise by the time our destructor
784 // runs if the timer is still running the Task is deleted twice (once by 792 // runs if the timer is still running the Task is deleted twice (once by
785 // the MessageLoop and the second time by RepeatingTimer). 793 // the MessageLoop and the second time by RepeatingTimer).
786 update_load_states_timer_.reset(); 794 update_load_states_timer_.reset();
787 795
788 // Clear blocked requests if any left. 796 // Clear blocked requests if any left.
789 // Note that we have to do this in 2 passes as we cannot call 797 // Note that we have to do this in 2 passes as we cannot call
790 // CancelBlockedRequestsForRoute while iterating over 798 // CancelBlockedRequestsForRoute while iterating over
791 // blocked_loaders_map_, as it modifies it. 799 // blocked_loaders_map_, as it modifies it.
792 std::set<ProcessRouteIDs> ids; 800 std::set<GlobalRoutingID> ids;
793 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin(); 801 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin();
794 iter != blocked_loaders_map_.end(); ++iter) { 802 iter != blocked_loaders_map_.end(); ++iter) {
795 std::pair<std::set<ProcessRouteIDs>::iterator, bool> result = 803 std::pair<std::set<GlobalRoutingID>::iterator, bool> result =
796 ids.insert(iter->first); 804 ids.insert(iter->first);
797 // We should not have duplicates. 805 // We should not have duplicates.
798 DCHECK(result.second); 806 DCHECK(result.second);
799 } 807 }
800 for (std::set<ProcessRouteIDs>::const_iterator iter = ids.begin(); 808 for (std::set<GlobalRoutingID>::const_iterator iter = ids.begin();
801 iter != ids.end(); ++iter) { 809 iter != ids.end(); ++iter) {
802 CancelBlockedRequestsForRoute(iter->first, iter->second); 810 CancelBlockedRequestsForRoute(iter->child_id, iter->route_id);
803 } 811 }
804 812
805 scheduler_.reset(); 813 scheduler_.reset();
806 } 814 }
807 815
808 bool ResourceDispatcherHostImpl::OnMessageReceived( 816 bool ResourceDispatcherHostImpl::OnMessageReceived(
809 const IPC::Message& message, 817 const IPC::Message& message,
810 ResourceMessageFilter* filter, 818 ResourceMessageFilter* filter,
811 bool* message_was_ok) { 819 bool* message_was_ok) {
812 filter_ = filter; 820 filter_ = filter;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 resource_context, 937 resource_context,
930 referrer)) { 938 referrer)) {
931 AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id); 939 AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
932 return; 940 return;
933 } 941 }
934 942
935 bool is_sync_load = sync_result != NULL; 943 bool is_sync_load = sync_result != NULL;
936 int load_flags = 944 int load_flags =
937 BuildLoadFlagsForRequest(request_data, child_id, is_sync_load); 945 BuildLoadFlagsForRequest(request_data, child_id, is_sync_load);
938 946
947 GlobalRoutingID id(child_id, route_id);
948 if (!offline_policy_map_[id])
949 offline_policy_map_[id] = new OfflinePolicy();
950 load_flags |= offline_policy_map_[id]->GetAdditionalLoadFlags(
951 load_flags, request_data.resource_type == ResourceType::MAIN_FRAME);
952
939 // Construct the request. 953 // Construct the request.
940 scoped_ptr<net::URLRequest> new_request; 954 scoped_ptr<net::URLRequest> new_request;
941 net::URLRequest* request; 955 net::URLRequest* request;
942 if (deferred_loader.get()) { 956 if (deferred_loader.get()) {
943 request = deferred_loader->request(); 957 request = deferred_loader->request();
944 958
945 // Give the ResourceLoader (or any of the ResourceHandlers held by it) a 959 // Give the ResourceLoader (or any of the ResourceHandlers held by it) a
946 // chance to reset some state before we complete the transfer. 960 // chance to reset some state before we complete the transfer.
947 deferred_loader->WillCompleteTransfer(); 961 deferred_loader->WillCompleteTransfer();
948 } else { 962 } else {
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 // net::URLRequest that needs exclusive access to the same cache entry, and 1358 // net::URLRequest that needs exclusive access to the same cache entry, and
1345 // that net::URLRequest may complete and remove itself from 1359 // that net::URLRequest may complete and remove itself from
1346 // pending_requests_. So we need to check that iter is not equal to 1360 // pending_requests_. So we need to check that iter is not equal to
1347 // pending_requests_.end(). 1361 // pending_requests_.end().
1348 if (iter != pending_loaders_.end()) 1362 if (iter != pending_loaders_.end())
1349 RemovePendingLoader(iter); 1363 RemovePendingLoader(iter);
1350 } 1364 }
1351 1365
1352 // Now deal with blocked requests if any. 1366 // Now deal with blocked requests if any.
1353 if (route_id != -1) { 1367 if (route_id != -1) {
1354 if (blocked_loaders_map_.find(ProcessRouteIDs(child_id, route_id)) != 1368 if (blocked_loaders_map_.find(GlobalRoutingID(child_id, route_id)) !=
1355 blocked_loaders_map_.end()) { 1369 blocked_loaders_map_.end()) {
1356 CancelBlockedRequestsForRoute(child_id, route_id); 1370 CancelBlockedRequestsForRoute(child_id, route_id);
1357 } 1371 }
1358 } else { 1372 } else {
1359 // We have to do all render views for the process |child_id|. 1373 // We have to do all render views for the process |child_id|.
1360 // Note that we have to do this in 2 passes as we cannot call 1374 // Note that we have to do this in 2 passes as we cannot call
1361 // CancelBlockedRequestsForRoute while iterating over 1375 // CancelBlockedRequestsForRoute while iterating over
1362 // blocked_loaders_map_, as it modifies it. 1376 // blocked_loaders_map_, as it modifies it.
1363 std::set<int> route_ids; 1377 std::set<int> route_ids;
1364 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin(); 1378 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin();
1365 iter != blocked_loaders_map_.end(); ++iter) { 1379 iter != blocked_loaders_map_.end(); ++iter) {
1366 if (iter->first.first == child_id) 1380 if (iter->first.child_id == child_id)
1367 route_ids.insert(iter->first.second); 1381 route_ids.insert(iter->first.route_id);
1368 } 1382 }
1369 for (std::set<int>::const_iterator iter = route_ids.begin(); 1383 for (std::set<int>::const_iterator iter = route_ids.begin();
1370 iter != route_ids.end(); ++iter) { 1384 iter != route_ids.end(); ++iter) {
1371 CancelBlockedRequestsForRoute(child_id, *iter); 1385 CancelBlockedRequestsForRoute(child_id, *iter);
1372 } 1386 }
1373 } 1387 }
1388
1389 // Cleanup the offline state for the route.
1390 delete offline_policy_map_[GlobalRoutingID(child_id, route_id)];
darin (slow to review) 2013/04/18 05:03:02 nit: consider doing this with an iterator so you o
Randy Smith (Not in Mondays) 2013/04/18 20:04:57 Done.
1391 offline_policy_map_.erase(GlobalRoutingID(child_id, route_id));
1374 } 1392 }
1375 1393
1376 // Cancels the request and removes it from the list. 1394 // Cancels the request and removes it from the list.
1377 void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id, 1395 void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id,
1378 int request_id) { 1396 int request_id) {
1379 LoaderMap::iterator i = pending_loaders_.find( 1397 LoaderMap::iterator i = pending_loaders_.find(
1380 GlobalRequestID(child_id, request_id)); 1398 GlobalRequestID(child_id, request_id));
1381 if (i == pending_loaders_.end()) { 1399 if (i == pending_loaders_.end()) {
1382 NOTREACHED() << "Trying to remove a request that's not here"; 1400 NOTREACHED() << "Trying to remove a request that's not here";
1383 return; 1401 return;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 info->GetChildID()); 1513 info->GetChildID());
1496 1514
1497 // A ResourceHandler must not outlive its associated URLRequest. 1515 // A ResourceHandler must not outlive its associated URLRequest.
1498 handler.reset(); 1516 handler.reset();
1499 return; 1517 return;
1500 } 1518 }
1501 1519
1502 linked_ptr<ResourceLoader> loader( 1520 linked_ptr<ResourceLoader> loader(
1503 new ResourceLoader(request.Pass(), handler.Pass(), this)); 1521 new ResourceLoader(request.Pass(), handler.Pass(), this));
1504 1522
1505 ProcessRouteIDs pair_id(info->GetChildID(), info->GetRouteID()); 1523 GlobalRoutingID id(info->GetGlobalRoutingID());
1506 BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(pair_id); 1524 BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(id);
1507 if (iter != blocked_loaders_map_.end()) { 1525 if (iter != blocked_loaders_map_.end()) {
1508 // The request should be blocked. 1526 // The request should be blocked.
1509 iter->second->push_back(loader); 1527 iter->second->push_back(loader);
1510 return; 1528 return;
1511 } 1529 }
1512 1530
1513 StartLoading(info, loader); 1531 StartLoading(info, loader);
1514 } 1532 }
1515 1533
1516 void ResourceDispatcherHostImpl::StartLoading( 1534 void ResourceDispatcherHostImpl::StartLoading(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 } 1576 }
1559 1577
1560 // Carries information about a load state change. 1578 // Carries information about a load state change.
1561 struct LoadInfo { 1579 struct LoadInfo {
1562 GURL url; 1580 GURL url;
1563 net::LoadStateWithParam load_state; 1581 net::LoadStateWithParam load_state;
1564 uint64 upload_position; 1582 uint64 upload_position;
1565 uint64 upload_size; 1583 uint64 upload_size;
1566 }; 1584 };
1567 1585
1568 // Map from ProcessID+ViewID pair to LoadState 1586 // Map from ProcessID+RouteID pair to LoadState
1569 typedef std::map<std::pair<int, int>, LoadInfo> LoadInfoMap; 1587 typedef std::map<GlobalRoutingID, LoadInfo> LoadInfoMap;
1570 1588
1571 // Used to marshal calls to LoadStateChanged from the IO to UI threads. We do 1589 // Used to marshal calls to LoadStateChanged from the IO to UI threads. We do
1572 // them all as a single callback to avoid spamming the UI thread. 1590 // them all as a single callback to avoid spamming the UI thread.
1573 void LoadInfoUpdateCallback(const LoadInfoMap& info_map) { 1591 void LoadInfoUpdateCallback(const LoadInfoMap& info_map) {
1574 LoadInfoMap::const_iterator i; 1592 LoadInfoMap::const_iterator i;
1575 for (i = info_map.begin(); i != info_map.end(); ++i) { 1593 for (i = info_map.begin(); i != info_map.end(); ++i) {
1576 RenderViewHostImpl* view = 1594 RenderViewHostImpl* view =
1577 RenderViewHostImpl::FromID(i->first.first, i->first.second); 1595 RenderViewHostImpl::FromID(i->first.child_id, i->first.route_id);
1578 if (view) // The view could be gone at this point. 1596 if (view) // The view could be gone at this point.
1579 view->LoadStateChanged(i->second.url, i->second.load_state, 1597 view->LoadStateChanged(i->second.url, i->second.load_state,
1580 i->second.upload_position, 1598 i->second.upload_position,
1581 i->second.upload_size); 1599 i->second.upload_size);
1582 } 1600 }
1583 } 1601 }
1584 1602
1585 } // namespace 1603 } // namespace
1586 1604
1587 void ResourceDispatcherHostImpl::UpdateLoadStates() { 1605 void ResourceDispatcherHostImpl::UpdateLoadStates() {
1588 // Populate this map with load state changes, and then send them on to the UI 1606 // Populate this map with load state changes, and then send them on to the UI
1589 // thread where they can be passed along to the respective RVHs. 1607 // thread where they can be passed along to the respective RVHs.
1590 LoadInfoMap info_map; 1608 LoadInfoMap info_map;
1591 1609
1592 LoaderMap::const_iterator i; 1610 LoaderMap::const_iterator i;
1593 1611
1594 // Determine the largest upload size of all requests 1612 // Determine the largest upload size of all requests
1595 // in each View (good chance it's zero). 1613 // in each View (good chance it's zero).
1596 std::map<std::pair<int, int>, uint64> largest_upload_size; 1614 std::map<GlobalRoutingID, uint64> largest_upload_size;
1597 for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { 1615 for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) {
1598 net::URLRequest* request = i->second->request(); 1616 net::URLRequest* request = i->second->request();
1599 ResourceRequestInfoImpl* info = i->second->GetRequestInfo(); 1617 ResourceRequestInfoImpl* info = i->second->GetRequestInfo();
1600 uint64 upload_size = request->GetUploadProgress().size(); 1618 uint64 upload_size = request->GetUploadProgress().size();
1601 if (request->GetLoadState().state != net::LOAD_STATE_SENDING_REQUEST) 1619 if (request->GetLoadState().state != net::LOAD_STATE_SENDING_REQUEST)
1602 upload_size = 0; 1620 upload_size = 0;
1603 std::pair<int, int> key(info->GetChildID(), info->GetRouteID()); 1621 GlobalRoutingID id(info->GetGlobalRoutingID());
1604 if (upload_size && largest_upload_size[key] < upload_size) 1622 if (upload_size && largest_upload_size[id] < upload_size)
1605 largest_upload_size[key] = upload_size; 1623 largest_upload_size[id] = upload_size;
1606 } 1624 }
1607 1625
1608 for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { 1626 for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) {
1609 net::URLRequest* request = i->second->request(); 1627 net::URLRequest* request = i->second->request();
1610 ResourceRequestInfoImpl* info = i->second->GetRequestInfo(); 1628 ResourceRequestInfoImpl* info = i->second->GetRequestInfo();
1611 net::LoadStateWithParam load_state = request->GetLoadState(); 1629 net::LoadStateWithParam load_state = request->GetLoadState();
1612 net::UploadProgress progress = request->GetUploadProgress(); 1630 net::UploadProgress progress = request->GetUploadProgress();
1613 1631
1614 // We also poll for upload progress on this timer and send upload 1632 // We also poll for upload progress on this timer and send upload
1615 // progress ipc messages to the plugin process. 1633 // progress ipc messages to the plugin process.
1616 i->second->ReportUploadProgress(); 1634 i->second->ReportUploadProgress();
1617 1635
1618 std::pair<int, int> key(info->GetChildID(), info->GetRouteID()); 1636 GlobalRoutingID id(info->GetGlobalRoutingID());
1619 1637
1620 // If a request is uploading data, ignore all other requests so that the 1638 // If a request is uploading data, ignore all other requests so that the
1621 // upload progress takes priority for being shown in the status bar. 1639 // upload progress takes priority for being shown in the status bar.
1622 if (largest_upload_size.find(key) != largest_upload_size.end() && 1640 if (largest_upload_size.find(id) != largest_upload_size.end() &&
1623 progress.size() < largest_upload_size[key]) 1641 progress.size() < largest_upload_size[id])
1624 continue; 1642 continue;
1625 1643
1626 net::LoadStateWithParam to_insert = load_state; 1644 net::LoadStateWithParam to_insert = load_state;
1627 LoadInfoMap::iterator existing = info_map.find(key); 1645 LoadInfoMap::iterator existing = info_map.find(id);
1628 if (existing != info_map.end()) { 1646 if (existing != info_map.end()) {
1629 to_insert = 1647 to_insert =
1630 MoreInterestingLoadState(existing->second.load_state, load_state); 1648 MoreInterestingLoadState(existing->second.load_state, load_state);
1631 if (to_insert.state == existing->second.load_state.state) 1649 if (to_insert.state == existing->second.load_state.state)
1632 continue; 1650 continue;
1633 } 1651 }
1634 LoadInfo& load_info = info_map[key]; 1652 LoadInfo& load_info = info_map[id];
1635 load_info.url = request->url(); 1653 load_info.url = request->url();
1636 load_info.load_state = to_insert; 1654 load_info.load_state = to_insert;
1637 load_info.upload_size = progress.size(); 1655 load_info.upload_size = progress.size();
1638 load_info.upload_position = progress.position(); 1656 load_info.upload_position = progress.position();
1639 } 1657 }
1640 1658
1641 if (info_map.empty()) 1659 if (info_map.empty())
1642 return; 1660 return;
1643 1661
1644 BrowserThread::PostTask( 1662 BrowserThread::PostTask(
1645 BrowserThread::UI, FROM_HERE, 1663 BrowserThread::UI, FROM_HERE,
1646 base::Bind(&LoadInfoUpdateCallback, info_map)); 1664 base::Bind(&LoadInfoUpdateCallback, info_map));
1647 } 1665 }
1648 1666
1649 void ResourceDispatcherHostImpl::BlockRequestsForRoute(int child_id, 1667 void ResourceDispatcherHostImpl::BlockRequestsForRoute(int child_id,
1650 int route_id) { 1668 int route_id) {
1651 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1669 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1652 ProcessRouteIDs key(child_id, route_id); 1670 GlobalRoutingID key(child_id, route_id);
1653 DCHECK(blocked_loaders_map_.find(key) == blocked_loaders_map_.end()) << 1671 DCHECK(blocked_loaders_map_.find(key) == blocked_loaders_map_.end()) <<
1654 "BlockRequestsForRoute called multiple time for the same RVH"; 1672 "BlockRequestsForRoute called multiple time for the same RVH";
1655 blocked_loaders_map_[key] = new BlockedLoadersList(); 1673 blocked_loaders_map_[key] = new BlockedLoadersList();
1656 } 1674 }
1657 1675
1658 void ResourceDispatcherHostImpl::ResumeBlockedRequestsForRoute(int child_id, 1676 void ResourceDispatcherHostImpl::ResumeBlockedRequestsForRoute(int child_id,
1659 int route_id) { 1677 int route_id) {
1660 ProcessBlockedRequestsForRoute(child_id, route_id, false); 1678 ProcessBlockedRequestsForRoute(child_id, route_id, false);
1661 } 1679 }
1662 1680
1663 void ResourceDispatcherHostImpl::CancelBlockedRequestsForRoute(int child_id, 1681 void ResourceDispatcherHostImpl::CancelBlockedRequestsForRoute(int child_id,
1664 int route_id) { 1682 int route_id) {
1665 ProcessBlockedRequestsForRoute(child_id, route_id, true); 1683 ProcessBlockedRequestsForRoute(child_id, route_id, true);
1666 } 1684 }
1667 1685
1668 void ResourceDispatcherHostImpl::ProcessBlockedRequestsForRoute( 1686 void ResourceDispatcherHostImpl::ProcessBlockedRequestsForRoute(
1669 int child_id, 1687 int child_id,
1670 int route_id, 1688 int route_id,
1671 bool cancel_requests) { 1689 bool cancel_requests) {
1672 BlockedLoadersMap::iterator iter = blocked_loaders_map_.find( 1690 BlockedLoadersMap::iterator iter = blocked_loaders_map_.find(
1673 std::pair<int, int>(child_id, route_id)); 1691 GlobalRoutingID(child_id, route_id));
1674 if (iter == blocked_loaders_map_.end()) { 1692 if (iter == blocked_loaders_map_.end()) {
1675 // It's possible to reach here if the renderer crashed while an interstitial 1693 // It's possible to reach here if the renderer crashed while an interstitial
1676 // page was showing. 1694 // page was showing.
1677 return; 1695 return;
1678 } 1696 }
1679 1697
1680 BlockedLoadersList* loaders = iter->second; 1698 BlockedLoadersList* loaders = iter->second;
1681 1699
1682 // Removing the vector from the map unblocks any subsequent requests. 1700 // Removing the vector from the map unblocks any subsequent requests.
1683 blocked_loaders_map_.erase(iter); 1701 blocked_loaders_map_.erase(iter);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 DelegateMap::iterator it = delegate_map_.find(id); 1774 DelegateMap::iterator it = delegate_map_.find(id);
1757 DCHECK(it->second->HasObserver(delegate)); 1775 DCHECK(it->second->HasObserver(delegate));
1758 it->second->RemoveObserver(delegate); 1776 it->second->RemoveObserver(delegate);
1759 if (it->second->size() == 0) { 1777 if (it->second->size() == 0) {
1760 delete it->second; 1778 delete it->second;
1761 delegate_map_.erase(it); 1779 delegate_map_.erase(it);
1762 } 1780 }
1763 } 1781 }
1764 1782
1765 } // namespace content 1783 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698