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

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

Issue 2064323004: Defines initial DeviceConditions and and plumbs down through StartProcessing() call. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 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 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 #include "components/offline_pages/background/request_coordinator.h" 5 #include "components/offline_pages/background/request_coordinator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 void RequestCoordinator::RequestQueueEmpty() { 86 void RequestCoordinator::RequestQueueEmpty() {
87 // Clear the outstanding "safety" task in the scheduler. 87 // Clear the outstanding "safety" task in the scheduler.
88 scheduler_->Unschedule(); 88 scheduler_->Unschedule();
89 // Return control to the scheduler when there is no more to do. 89 // Return control to the scheduler when there is no more to do.
90 scheduler_callback_.Run(true); 90 scheduler_callback_.Run(true);
91 } 91 }
92 92
93 bool RequestCoordinator::StartProcessing( 93 bool RequestCoordinator::StartProcessing(
94 const DeviceConditions& device_conditions,
94 const base::Callback<void(bool)>& callback) { 95 const base::Callback<void(bool)>& callback) {
95 scheduler_callback_ = callback; 96 scheduler_callback_ = callback;
96 // TODO(petewil): Check existing conditions (should be passed down from 97 // TODO(petewil): Check existing conditions (should be passed down from
97 // BackgroundTask) 98 // BackgroundTask)
98 99
99 TryNextRequest(); 100 TryNextRequest();
100 101
101 // TODO(petewil): Should return true if the caller should expect a 102 // TODO(petewil): Should return true if the caller should expect a
102 // callback. Return false if there is already a request running. 103 // callback. Return false if there is already a request running.
103 // Probably best to do this when I prevent multiple instances from 104 // Probably best to do this when I prevent multiple instances from
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 // TODO(petewil): Check time budget. Return to the scheduler if we are out. 152 // TODO(petewil): Check time budget. Return to the scheduler if we are out.
152 153
153 154
154 // Start a request if we have time. 155 // Start a request if we have time.
155 TryNextRequest(); 156 TryNextRequest();
156 157
157 } 158 }
158 159
159 } // namespace offline_pages 160 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698