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

Unified 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: Sync'd to r193064. 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index d69582ea2c130b7c7a3e3e89a5825c7db205de6a..17a9e566fdc798f2c1b3b0c116545f6ef451a1ec 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -231,8 +231,9 @@ net::Error CallbackAndReturn(
return net_error;
}
-int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data,
- int child_id, bool is_sync_load) {
+int BuildLoadFlagsForRequest(
+ const ResourceHostMsg_Request& request_data, int child_id,
darin (slow to review) 2013/04/11 20:01:23 nit: I think the style guide says to put one argum
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Wow, right you are. I wonder if that changed rece
+ bool is_sync_load) {
int load_flags = request_data.load_flags;
// Although EV status is irrelevant to sub-frames and sub-resources, we have
@@ -702,6 +703,10 @@ void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader,
void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) {
ResourceRequestInfoImpl* info = loader->GetRequestInfo();
+ // There should be an entry in the map created when we dispatched the
darin (slow to review) 2013/04/11 20:01:23 DCHECK that this is true? operator[] will create
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 So my basic response to this is "Sure" and I'll pu
+ // request.
+ offline_map_[ProcessRouteIDs(info->GetChildID(), info->GetRouteID())]->
darin (slow to review) 2013/04/11 20:01:23 It could also be reasonable for ResourceRequestInf
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Done, though it was a bit of a yak shave. If you
+ RequestCompleted(loader->request()->response_info());
int render_process_id, render_view_id;
if (!info->GetAssociatedRenderView(&render_process_id, &render_view_id))
@@ -936,6 +941,12 @@ void ResourceDispatcherHostImpl::BeginRequest(
int load_flags =
BuildLoadFlagsForRequest(request_data, child_id, is_sync_load);
+ ProcessRouteIDs id(child_id, route_id);
+ if (!offline_map_[id])
+ offline_map_[id] = new OfflinePolicy();
+ load_flags |= offline_map_[id]->GetAdditionalLoadFlags(
+ load_flags, request_data.resource_type);
+
// Construct the request.
scoped_ptr<net::URLRequest> new_request;
net::URLRequest* request;
@@ -1371,6 +1382,10 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id,
CancelBlockedRequestsForRoute(child_id, *iter);
}
}
+
+ // Cleanup the offline state for the route.
+ delete offline_map_[ProcessRouteIDs(child_id, route_id)];
+ offline_map_.erase(ProcessRouteIDs(child_id, route_id));
}
// Cancels the request and removes it from the list.

Powered by Google App Engine
This is Rietveld 408576698