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

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

Issue 165613002: Add UMA stats for AppCacheUpdateJob results. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ 5 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ 6 #define WEBKIT_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 17 matching lines...) Expand all
28 namespace appcache { 28 namespace appcache {
29 29
30 class HostNotifier; 30 class HostNotifier;
31 31
32 // Application cache Update algorithm and state. 32 // Application cache Update algorithm and state.
33 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheUpdateJob 33 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheUpdateJob
34 : public AppCacheStorage::Delegate, 34 : public AppCacheStorage::Delegate,
35 public AppCacheHost::Observer, 35 public AppCacheHost::Observer,
36 public AppCacheService::Observer { 36 public AppCacheService::Observer {
37 public: 37 public:
38 // Used for uma stats only for now.
jsbell 2014/02/14 23:53:26 Should probably warn that values should only be ap
39 enum ResultType {
40 UPDATE_OK, DB_ERROR, DISKCACHE_ERROR, QUOTA_ERROR, REDIRECT_ERROR,
41 MANIFEST_ERROR, NETWORK_ERROR, SERVER_ERROR,
42 NUM_UPDATE_JOB_RESULT_TYPES
43 };
44
38 AppCacheUpdateJob(AppCacheService* service, AppCacheGroup* group); 45 AppCacheUpdateJob(AppCacheService* service, AppCacheGroup* group);
39 virtual ~AppCacheUpdateJob(); 46 virtual ~AppCacheUpdateJob();
40 47
41 // Triggers the update process or adds more info if this update is already 48 // Triggers the update process or adds more info if this update is already
42 // in progress. 49 // in progress.
43 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource); 50 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource);
44 51
45 private: 52 private:
46 friend class AppCacheUpdateJobTest; 53 friend class AppCacheUpdateJobTest;
47 class URLFetcher; 54 class URLFetcher;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 const std::string& manifest_data() const { return manifest_data_; } 118 const std::string& manifest_data() const { return manifest_data_; }
112 AppCacheResponseWriter* response_writer() const { 119 AppCacheResponseWriter* response_writer() const {
113 return response_writer_.get(); 120 return response_writer_.get();
114 } 121 }
115 void set_existing_response_headers(net::HttpResponseHeaders* headers) { 122 void set_existing_response_headers(net::HttpResponseHeaders* headers) {
116 existing_response_headers_ = headers; 123 existing_response_headers_ = headers;
117 } 124 }
118 void set_existing_entry(const AppCacheEntry& entry) { 125 void set_existing_entry(const AppCacheEntry& entry) {
119 existing_entry_ = entry; 126 existing_entry_ = entry;
120 } 127 }
128 ResultType result() const { return result_; }
121 129
122 private: 130 private:
123 // URLRequest::Delegate overrides 131 // URLRequest::Delegate overrides
124 virtual void OnReceivedRedirect(net::URLRequest* request, 132 virtual void OnReceivedRedirect(net::URLRequest* request,
125 const GURL& new_url, 133 const GURL& new_url,
126 bool* defer_redirect) OVERRIDE; 134 bool* defer_redirect) OVERRIDE;
127 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; 135 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
128 virtual void OnReadCompleted(net::URLRequest* request, 136 virtual void OnReadCompleted(net::URLRequest* request,
129 int bytes_read) OVERRIDE; 137 int bytes_read) OVERRIDE;
130 138
131 void AddConditionalHeaders(const net::HttpResponseHeaders* headers); 139 void AddConditionalHeaders(const net::HttpResponseHeaders* headers);
132 void OnWriteComplete(int result); 140 void OnWriteComplete(int result);
133 void ReadResponseData(); 141 void ReadResponseData();
134 bool ConsumeResponseData(int bytes_read); 142 bool ConsumeResponseData(int bytes_read);
135 void OnResponseCompleted(); 143 void OnResponseCompleted();
136 bool MaybeRetryRequest(); 144 bool MaybeRetryRequest();
137 145
138 GURL url_; 146 GURL url_;
139 AppCacheUpdateJob* job_; 147 AppCacheUpdateJob* job_;
140 FetchType fetch_type_; 148 FetchType fetch_type_;
141 int retry_503_attempts_; 149 int retry_503_attempts_;
142 scoped_refptr<net::IOBuffer> buffer_; 150 scoped_refptr<net::IOBuffer> buffer_;
143 scoped_ptr<net::URLRequest> request_; 151 scoped_ptr<net::URLRequest> request_;
144 AppCacheEntry existing_entry_; 152 AppCacheEntry existing_entry_;
145 scoped_refptr<net::HttpResponseHeaders> existing_response_headers_; 153 scoped_refptr<net::HttpResponseHeaders> existing_response_headers_;
146 std::string manifest_data_; 154 std::string manifest_data_;
155 ResultType result_;
147 scoped_ptr<AppCacheResponseWriter> response_writer_; 156 scoped_ptr<AppCacheResponseWriter> response_writer_;
148 }; // class URLFetcher 157 }; // class URLFetcher
149 158
150 AppCacheResponseWriter* CreateResponseWriter(); 159 AppCacheResponseWriter* CreateResponseWriter();
151 160
152 // Methods for AppCacheStorage::Delegate. 161 // Methods for AppCacheStorage::Delegate.
153 virtual void OnResponseInfoLoaded(AppCacheResponseInfo* response_info, 162 virtual void OnResponseInfoLoaded(AppCacheResponseInfo* response_info,
154 int64 response_id) OVERRIDE; 163 int64 response_id) OVERRIDE;
155 virtual void OnGroupAndNewestCacheStored(AppCacheGroup* group, 164 virtual void OnGroupAndNewestCacheStored(AppCacheGroup* group,
156 AppCache* newest_cache, 165 AppCache* newest_cache,
157 bool success, 166 bool success,
158 bool would_exceed_quota) OVERRIDE; 167 bool would_exceed_quota) OVERRIDE;
159 virtual void OnGroupMadeObsolete(AppCacheGroup* group, bool success) OVERRIDE; 168 virtual void OnGroupMadeObsolete(AppCacheGroup* group, bool success) OVERRIDE;
160 169
161 // Methods for AppCacheHost::Observer. 170 // Methods for AppCacheHost::Observer.
162 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A 171 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A
163 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; 172 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE;
164 173
165 // Methods for AppCacheService::Observer. 174 // Methods for AppCacheService::Observer.
166 virtual void OnServiceReinitialized( 175 virtual void OnServiceReinitialized(
167 AppCacheStorageReference* old_storage) OVERRIDE; 176 AppCacheStorageReference* old_storage) OVERRIDE;
168 177
169 void HandleCacheFailure(const std::string& error_message); 178 void HandleCacheFailure(const std::string& error_message, ResultType result);
170 179
171 void FetchManifest(bool is_first_fetch); 180 void FetchManifest(bool is_first_fetch);
172 void HandleManifestFetchCompleted(URLFetcher* fetcher); 181 void HandleManifestFetchCompleted(URLFetcher* fetcher);
173 void ContinueHandleManifestFetchCompleted(bool changed); 182 void ContinueHandleManifestFetchCompleted(bool changed);
174 183
175 void HandleUrlFetchCompleted(URLFetcher* fetcher); 184 void HandleUrlFetchCompleted(URLFetcher* fetcher);
176 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher); 185 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher);
177 186
178 void HandleManifestRefetchCompleted(URLFetcher* fetcher); 187 void HandleManifestRefetchCompleted(URLFetcher* fetcher);
179 void OnManifestInfoWriteComplete(int result); 188 void OnManifestInfoWriteComplete(int result);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 AppCacheStorage* storage_; 323 AppCacheStorage* storage_;
315 324
316 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); 325 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate);
317 326
318 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); 327 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob);
319 }; 328 };
320 329
321 } // namespace appcache 330 } // namespace appcache
322 331
323 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ 332 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698