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

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

Issue 2934953003: Add support for HTTP range requests in the AppCacheURLLoaderImpl class. (Closed)
Patch Set: Remove include Created 3 years, 6 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 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/sequence_checker.h" 12 #include "base/sequence_checker.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "net/http/http_byte_range.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace net { 18 namespace net {
19 class HttpRequestHeaders;
20 class HttpResponseInfo;
18 class NetworkDelegate; 21 class NetworkDelegate;
19 class URLRequestJob; 22 class URLRequestJob;
20 } 23 }
21 24
22 namespace content { 25 namespace content {
23 26
24 class AppCacheEntry; 27 class AppCacheEntry;
25 class AppCacheHost; 28 class AppCacheHost;
26 class AppCacheRequest; 29 class AppCacheRequest;
30 class AppCacheResponseInfo;
31 class AppCacheResponseReader;
27 class AppCacheStorage; 32 class AppCacheStorage;
28 class AppCacheURLLoaderJob; 33 class AppCacheURLLoaderJob;
29 class URLRequestJob; 34 class URLRequestJob;
30 35
31 // Interface for an AppCache job. This is used to send data stored in the 36 // Interface for an AppCache job. This is used to send data stored in the
32 // AppCache to networking consumers. 37 // AppCache to networking consumers.
33 // Subclasses implement this interface to wrap custom job objects like 38 // Subclasses implement this interface to wrap custom job objects like
34 // URLRequestJob, URLLoaderJob, etc to ensure that these dependencies stay out 39 // URLRequestJob, URLLoaderJob, etc to ensure that these dependencies stay out
35 // of the AppCache code. 40 // of the AppCache code.
36 class CONTENT_EXPORT AppCacheJob : public base::SupportsWeakPtr<AppCacheJob> { 41 class CONTENT_EXPORT AppCacheJob : public base::SupportsWeakPtr<AppCacheJob> {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // AppCaches loaded via the URLLoader mechanism. 114 // AppCaches loaded via the URLLoader mechanism.
110 virtual net::URLRequestJob* AsURLRequestJob(); 115 virtual net::URLRequestJob* AsURLRequestJob();
111 116
112 // Returns the underlying ApppCacheURLLoaderJob if any. This only applies to 117 // Returns the underlying ApppCacheURLLoaderJob if any. This only applies to
113 // AppCaches loaded via the URLRequest mechanism. 118 // AppCaches loaded via the URLRequest mechanism.
114 virtual AppCacheURLLoaderJob* AsURLLoaderJob(); 119 virtual AppCacheURLLoaderJob* AsURLLoaderJob();
115 120
116 protected: 121 protected:
117 AppCacheJob(); 122 AppCacheJob();
118 123
124 bool is_range_request() const { return range_requested_.IsValid(); }
125
126 void InitializeRangeRequestInfo(const net::HttpRequestHeaders& headers);
127 void SetupRangeResponse(AppCacheResponseReader* reader);
128
119 SEQUENCE_CHECKER(sequence_checker_); 129 SEQUENCE_CHECKER(sequence_checker_);
120 130
121 // Set to true if the AppCache entry is not found. 131 // Set to true if the AppCache entry is not found.
122 bool cache_entry_not_found_; 132 bool cache_entry_not_found_;
123 133
124 // The jobs delivery status. 134 // The jobs delivery status.
125 DeliveryType delivery_type_; 135 DeliveryType delivery_type_;
126 136
137 // Byte range request if any.
138 net::HttpByteRange range_requested_;
michaeln 2017/06/14 02:37:24 nit: keep the two range related data members next
ananta 2017/06/14 18:52:18 Done.
139
140 // The response details.
141 scoped_refptr<AppCacheResponseInfo> info_;
142
143 std::unique_ptr<net::HttpResponseInfo> range_response_info_;
144
127 base::WeakPtrFactory<AppCacheJob> weak_factory_; 145 base::WeakPtrFactory<AppCacheJob> weak_factory_;
128 146
129 DISALLOW_COPY_AND_ASSIGN(AppCacheJob); 147 DISALLOW_COPY_AND_ASSIGN(AppCacheJob);
130 }; 148 };
131 149
132 } // namespace content 150 } // namespace content
133 151
134 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ 152 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/appcache/appcache_job.cc » ('j') | content/browser/appcache/appcache_url_loader_job.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698