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

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

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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) 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 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 28 matching lines...) Expand all
39 public AppCacheServiceImpl::Observer { 39 public AppCacheServiceImpl::Observer {
40 public: 40 public:
41 // Used for uma stats only for now, so new values are append only. 41 // Used for uma stats only for now, so new values are append only.
42 enum ResultType { 42 enum ResultType {
43 UPDATE_OK, DB_ERROR, DISKCACHE_ERROR, QUOTA_ERROR, REDIRECT_ERROR, 43 UPDATE_OK, DB_ERROR, DISKCACHE_ERROR, QUOTA_ERROR, REDIRECT_ERROR,
44 MANIFEST_ERROR, NETWORK_ERROR, SERVER_ERROR, CANCELLED_ERROR, 44 MANIFEST_ERROR, NETWORK_ERROR, SERVER_ERROR, CANCELLED_ERROR,
45 SECURITY_ERROR, NUM_UPDATE_JOB_RESULT_TYPES 45 SECURITY_ERROR, NUM_UPDATE_JOB_RESULT_TYPES
46 }; 46 };
47 47
48 AppCacheUpdateJob(AppCacheServiceImpl* service, AppCacheGroup* group); 48 AppCacheUpdateJob(AppCacheServiceImpl* service, AppCacheGroup* group);
49 virtual ~AppCacheUpdateJob(); 49 ~AppCacheUpdateJob() override;
50 50
51 // Triggers the update process or adds more info if this update is already 51 // Triggers the update process or adds more info if this update is already
52 // in progress. 52 // in progress.
53 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource); 53 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource);
54 54
55 private: 55 private:
56 friend class content::AppCacheGroupTest; 56 friend class content::AppCacheGroupTest;
57 friend class content::AppCacheUpdateJobTest; 57 friend class content::AppCacheUpdateJobTest;
58 class URLFetcher; 58 class URLFetcher;
59 59
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 public: 107 public:
108 enum FetchType { 108 enum FetchType {
109 MANIFEST_FETCH, 109 MANIFEST_FETCH,
110 URL_FETCH, 110 URL_FETCH,
111 MASTER_ENTRY_FETCH, 111 MASTER_ENTRY_FETCH,
112 MANIFEST_REFETCH, 112 MANIFEST_REFETCH,
113 }; 113 };
114 URLFetcher(const GURL& url, 114 URLFetcher(const GURL& url,
115 FetchType fetch_type, 115 FetchType fetch_type,
116 AppCacheUpdateJob* job); 116 AppCacheUpdateJob* job);
117 virtual ~URLFetcher(); 117 ~URLFetcher() override;
118 void Start(); 118 void Start();
119 FetchType fetch_type() const { return fetch_type_; } 119 FetchType fetch_type() const { return fetch_type_; }
120 net::URLRequest* request() const { return request_.get(); } 120 net::URLRequest* request() const { return request_.get(); }
121 const AppCacheEntry& existing_entry() const { return existing_entry_; } 121 const AppCacheEntry& existing_entry() const { return existing_entry_; }
122 const std::string& manifest_data() const { return manifest_data_; } 122 const std::string& manifest_data() const { return manifest_data_; }
123 AppCacheResponseWriter* response_writer() const { 123 AppCacheResponseWriter* response_writer() const {
124 return response_writer_.get(); 124 return response_writer_.get();
125 } 125 }
126 void set_existing_response_headers(net::HttpResponseHeaders* headers) { 126 void set_existing_response_headers(net::HttpResponseHeaders* headers) {
127 existing_response_headers_ = headers; 127 existing_response_headers_ = headers;
128 } 128 }
129 void set_existing_entry(const AppCacheEntry& entry) { 129 void set_existing_entry(const AppCacheEntry& entry) {
130 existing_entry_ = entry; 130 existing_entry_ = entry;
131 } 131 }
132 ResultType result() const { return result_; } 132 ResultType result() const { return result_; }
133 int redirect_response_code() const { return redirect_response_code_; } 133 int redirect_response_code() const { return redirect_response_code_; }
134 134
135 private: 135 private:
136 // URLRequest::Delegate overrides 136 // URLRequest::Delegate overrides
137 virtual void OnReceivedRedirect(net::URLRequest* request, 137 void OnReceivedRedirect(net::URLRequest* request,
138 const net::RedirectInfo& redirect_info, 138 const net::RedirectInfo& redirect_info,
139 bool* defer_redirect) override; 139 bool* defer_redirect) override;
140 virtual void OnResponseStarted(net::URLRequest* request) override; 140 void OnResponseStarted(net::URLRequest* request) override;
141 virtual void OnReadCompleted(net::URLRequest* request, 141 void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
142 int bytes_read) override;
143 142
144 void AddConditionalHeaders(const net::HttpResponseHeaders* headers); 143 void AddConditionalHeaders(const net::HttpResponseHeaders* headers);
145 void OnWriteComplete(int result); 144 void OnWriteComplete(int result);
146 void ReadResponseData(); 145 void ReadResponseData();
147 bool ConsumeResponseData(int bytes_read); 146 bool ConsumeResponseData(int bytes_read);
148 void OnResponseCompleted(); 147 void OnResponseCompleted();
149 bool MaybeRetryRequest(); 148 bool MaybeRetryRequest();
150 149
151 GURL url_; 150 GURL url_;
152 AppCacheUpdateJob* job_; 151 AppCacheUpdateJob* job_;
153 FetchType fetch_type_; 152 FetchType fetch_type_;
154 int retry_503_attempts_; 153 int retry_503_attempts_;
155 scoped_refptr<net::IOBuffer> buffer_; 154 scoped_refptr<net::IOBuffer> buffer_;
156 scoped_ptr<net::URLRequest> request_; 155 scoped_ptr<net::URLRequest> request_;
157 AppCacheEntry existing_entry_; 156 AppCacheEntry existing_entry_;
158 scoped_refptr<net::HttpResponseHeaders> existing_response_headers_; 157 scoped_refptr<net::HttpResponseHeaders> existing_response_headers_;
159 std::string manifest_data_; 158 std::string manifest_data_;
160 ResultType result_; 159 ResultType result_;
161 int redirect_response_code_; 160 int redirect_response_code_;
162 scoped_ptr<AppCacheResponseWriter> response_writer_; 161 scoped_ptr<AppCacheResponseWriter> response_writer_;
163 }; // class URLFetcher 162 }; // class URLFetcher
164 163
165 AppCacheResponseWriter* CreateResponseWriter(); 164 AppCacheResponseWriter* CreateResponseWriter();
166 165
167 // Methods for AppCacheStorage::Delegate. 166 // Methods for AppCacheStorage::Delegate.
168 virtual void OnResponseInfoLoaded(AppCacheResponseInfo* response_info, 167 void OnResponseInfoLoaded(AppCacheResponseInfo* response_info,
169 int64 response_id) override; 168 int64 response_id) override;
170 virtual void OnGroupAndNewestCacheStored(AppCacheGroup* group, 169 void OnGroupAndNewestCacheStored(AppCacheGroup* group,
171 AppCache* newest_cache, 170 AppCache* newest_cache,
172 bool success,
173 bool would_exceed_quota) override;
174 virtual void OnGroupMadeObsolete(AppCacheGroup* group,
175 bool success, 171 bool success,
176 int response_code) override; 172 bool would_exceed_quota) override;
173 void OnGroupMadeObsolete(AppCacheGroup* group,
174 bool success,
175 int response_code) override;
177 176
178 // Methods for AppCacheHost::Observer. 177 // Methods for AppCacheHost::Observer.
179 virtual void OnCacheSelectionComplete(AppCacheHost* host) override {} // N/A 178 void OnCacheSelectionComplete(AppCacheHost* host) override {} // N/A
180 virtual void OnDestructionImminent(AppCacheHost* host) override; 179 void OnDestructionImminent(AppCacheHost* host) override;
181 180
182 // Methods for AppCacheServiceImpl::Observer. 181 // Methods for AppCacheServiceImpl::Observer.
183 virtual void OnServiceReinitialized( 182 void OnServiceReinitialized(AppCacheStorageReference* old_storage) override;
184 AppCacheStorageReference* old_storage) override;
185 183
186 void HandleCacheFailure(const AppCacheErrorDetails& details, 184 void HandleCacheFailure(const AppCacheErrorDetails& details,
187 ResultType result, 185 ResultType result,
188 const GURL& failed_resource_url); 186 const GURL& failed_resource_url);
189 187
190 void FetchManifest(bool is_first_fetch); 188 void FetchManifest(bool is_first_fetch);
191 void HandleManifestFetchCompleted(URLFetcher* fetcher); 189 void HandleManifestFetchCompleted(URLFetcher* fetcher);
192 void ContinueHandleManifestFetchCompleted(bool changed); 190 void ContinueHandleManifestFetchCompleted(bool changed);
193 191
194 void HandleUrlFetchCompleted(URLFetcher* fetcher); 192 void HandleUrlFetchCompleted(URLFetcher* fetcher);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 AppCacheStorage* storage_; 337 AppCacheStorage* storage_;
340 338
341 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); 339 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate);
342 340
343 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); 341 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob);
344 }; 342 };
345 343
346 } // namespace content 344 } // namespace content
347 345
348 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ 346 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_unittest.cc ('k') | content/browser/appcache/appcache_update_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698