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

Side by Side Diff: content/browser/appcache/appcache_job.cc

Issue 2974733002: Add support for subresource request fallback in AppCache for the network service.. (Closed)
Patch Set: Address first round of review comments Created 3 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
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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/appcache/appcache_job.h" 5 #include "content/browser/appcache/appcache_job.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/appcache/appcache_request.h" 8 #include "content/browser/appcache/appcache_request.h"
9 #include "content/browser/appcache/appcache_response.h" 9 #include "content/browser/appcache/appcache_response.h"
10 #include "content/browser/appcache/appcache_url_loader_job.h" 10 #include "content/browser/appcache/appcache_url_loader_job.h"
11 #include "content/browser/appcache/appcache_url_request_job.h" 11 #include "content/browser/appcache/appcache_url_request_job.h"
12 #include "content/public/common/content_features.h" 12 #include "content/public/common/content_features.h"
13 #include "net/http/http_request_headers.h" 13 #include "net/http/http_request_headers.h"
14 #include "net/http/http_response_headers.h" 14 #include "net/http/http_response_headers.h"
15 #include "net/http/http_util.h" 15 #include "net/http/http_util.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 std::unique_ptr<AppCacheJob> AppCacheJob::Create( 19 std::unique_ptr<AppCacheJob> AppCacheJob::Create(
20 bool is_main_resource, 20 bool is_main_resource,
21 AppCacheHost* host, 21 AppCacheHost* host,
22 AppCacheStorage* storage, 22 AppCacheStorage* storage,
23 AppCacheRequest* request, 23 AppCacheRequest* request,
24 net::NetworkDelegate* network_delegate, 24 net::NetworkDelegate* network_delegate,
25 const OnPrepareToRestartCallback& restart_callback) { 25 const OnPrepareToRestartCallback& restart_callback) {
26 std::unique_ptr<AppCacheJob> job; 26 std::unique_ptr<AppCacheJob> job;
27 if (base::FeatureList::IsEnabled(features::kNetworkService)) { 27 if (base::FeatureList::IsEnabled(features::kNetworkService)) {
28 job.reset( 28 job.reset(new AppCacheURLLoaderJob(*(request->GetResourceRequest()),
29 new AppCacheURLLoaderJob(*(request->GetResourceRequest()), storage)); 29 request->AsURLLoaderRequest(), storage));
30 } else { 30 } else {
31 job.reset(new AppCacheURLRequestJob(request->GetURLRequest(), 31 job.reset(new AppCacheURLRequestJob(request->GetURLRequest(),
32 network_delegate, storage, host, 32 network_delegate, storage, host,
33 is_main_resource, restart_callback)); 33 is_main_resource, restart_callback));
34 } 34 }
35 return job; 35 return job;
36 } 36 }
37 37
38 AppCacheJob::~AppCacheJob() { 38 AppCacheJob::~AppCacheJob() {
39 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); 39 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Make a copy of the full response headers and fix them up 110 // Make a copy of the full response headers and fix them up
111 // for the range we'll be returning. 111 // for the range we'll be returning.
112 range_response_info_.reset( 112 range_response_info_.reset(
113 new net::HttpResponseInfo(*info_->http_response_info())); 113 new net::HttpResponseInfo(*info_->http_response_info()));
114 net::HttpResponseHeaders* headers = range_response_info_->headers.get(); 114 net::HttpResponseHeaders* headers = range_response_info_->headers.get();
115 headers->UpdateWithNewRange(range_requested_, resource_size, 115 headers->UpdateWithNewRange(range_requested_, resource_size,
116 true /* replace status line */); 116 true /* replace status line */);
117 } 117 }
118 118
119 } // namespace content 119 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/appcache/appcache_request.h » ('j') | content/browser/appcache/appcache_request_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698