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

Side by Side Diff: components/offline_pages/background/request_coordinator.h

Issue 2388303007: [Offline Pages] Adds UMA for result of attempts to immediately start background loading. (Closed)
Patch Set: Addressed mpearson feedback Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // the next StartProcessing() call. 162 // the next StartProcessing() call.
163 bool is_canceled() { 163 bool is_canceled() {
164 return is_stopped_; 164 return is_stopped_;
165 } 165 }
166 166
167 OfflineEventLogger* GetLogger() { 167 OfflineEventLogger* GetLogger() {
168 return &event_logger_; 168 return &event_logger_;
169 } 169 }
170 170
171 private: 171 private:
172 enum OfflinerImmediateStartStatus {
Mark P 2016/10/06 23:11:36 Can you please add the warning at the top as well?
dougarnett 2016/10/07 00:18:56 Done.
Mark P 2016/10/07 04:44:06 Next time you update this file, can you please upd
173 // Did start processing request.
174 STARTED = 0,
175 // Already busy processing a request.
176 BUSY = 1,
177 // The Offliner did not accept processing the request.
178 NOT_ACCEPTED = 2,
179 // No current network connection.
180 NO_CONNECTION = 3,
181 // Weak network connection (worse than 2G speed)
182 // according to network quality estimator.
183 WEAK_CONNECTION = 4,
184 // Did not start because this is svelte device.
185 NOT_STARTED_ON_SVELTE = 5,
186 // NOTE: insert new values above this line and update histogram enum too.
187 STATUS_COUNT = 6,
188 };
189
172 // Receives the results of a get from the request queue, and turns that into 190 // Receives the results of a get from the request queue, and turns that into
173 // SavePageRequest objects for the caller of GetQueuedRequests. 191 // SavePageRequest objects for the caller of GetQueuedRequests.
174 void GetQueuedRequestsCallback( 192 void GetQueuedRequestsCallback(
175 const GetRequestsCallback& callback, 193 const GetRequestsCallback& callback,
176 RequestQueue::GetRequestsResult result, 194 RequestQueue::GetRequestsResult result,
177 std::vector<std::unique_ptr<SavePageRequest>> requests); 195 std::vector<std::unique_ptr<SavePageRequest>> requests);
178 196
179 // Receives the results of a get from the request queue, and turns that into 197 // Receives the results of a get from the request queue, and turns that into
180 // SavePageRequest objects for the caller of GetQueuedRequests. 198 // SavePageRequest objects for the caller of GetQueuedRequests.
181 void GetRequestsForSchedulingCallback( 199 void GetRequestsForSchedulingCallback(
(...skipping 16 matching lines...) Expand all
198 BackgroundSavePageResult status, 216 BackgroundSavePageResult status,
199 std::unique_ptr<UpdateRequestsResult> result); 217 std::unique_ptr<UpdateRequestsResult> result);
200 218
201 void HandleRemovedRequests(BackgroundSavePageResult status, 219 void HandleRemovedRequests(BackgroundSavePageResult status,
202 std::unique_ptr<UpdateRequestsResult> result); 220 std::unique_ptr<UpdateRequestsResult> result);
203 221
204 // Start processing now if connected (but with conservative assumption 222 // Start processing now if connected (but with conservative assumption
205 // as to other device conditions). 223 // as to other device conditions).
206 void StartProcessingIfConnected(); 224 void StartProcessingIfConnected();
207 225
226 OfflinerImmediateStartStatus TryImmediateStart();
227
208 // Check the request queue, and schedule a task corresponding 228 // Check the request queue, and schedule a task corresponding
209 // to the least restrictive type of request in the queue. 229 // to the least restrictive type of request in the queue.
210 void ScheduleAsNeeded(); 230 void ScheduleAsNeeded();
211 231
212 // Callback from the request picker when it has chosen our next request. 232 // Callback from the request picker when it has chosen our next request.
213 void RequestPicked(const SavePageRequest& request); 233 void RequestPicked(const SavePageRequest& request);
214 234
215 // Callback from the request picker when no more requests are in the queue. 235 // Callback from the request picker when no more requests are in the queue.
216 // The parameter is a signal for what (if any) conditions to schedule future 236 // The parameter is a signal for what (if any) conditions to schedule future
217 // processing for. 237 // processing for.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 base::TimeDelta offliner_timeout_; 339 base::TimeDelta offliner_timeout_;
320 // Allows us to pass a weak pointer to callbacks. 340 // Allows us to pass a weak pointer to callbacks.
321 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; 341 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;
322 342
323 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); 343 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
324 }; 344 };
325 345
326 } // namespace offline_pages 346 } // namespace offline_pages
327 347
328 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 348 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698