OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 RequestQueue::AddRequestResult result, | 62 RequestQueue::AddRequestResult result, |
63 const SavePageRequest& request) { | 63 const SavePageRequest& request) { |
64 | 64 |
65 // Inform the scheduler that we have an outstanding task. | 65 // Inform the scheduler that we have an outstanding task. |
66 // TODO(petewil): Define proper TriggerConditions and set them. | 66 // TODO(petewil): Define proper TriggerConditions and set them. |
67 Scheduler::TriggerCondition conditions; | 67 Scheduler::TriggerCondition conditions; |
68 scheduler_->Schedule(conditions); | 68 scheduler_->Schedule(conditions); |
69 } | 69 } |
70 | 70 |
71 void RequestCoordinator::RequestPicked(const SavePageRequest& request) { | 71 void RequestCoordinator::RequestPicked(const SavePageRequest& request) { |
| 72 Scheduler::TriggerCondition conditions; |
| 73 |
| 74 // Ensure that the scheduler has actively scheduled a task. |
| 75 scheduler_->Schedule(conditions); |
| 76 |
72 // Send the request on to the offliner. | 77 // Send the request on to the offliner. |
73 SendRequestToOffliner(request); | 78 SendRequestToOffliner(request); |
74 } | 79 } |
75 | 80 |
76 void RequestCoordinator::RequestQueueEmpty() { | 81 void RequestCoordinator::RequestQueueEmpty() { |
77 // TODO(petewil): return to the BackgroundScheduler by calling | 82 // TODO(petewil): return to the BackgroundScheduler by calling |
78 // ProcessingDoneCallback | 83 // ProcessingDoneCallback |
79 } | 84 } |
80 | 85 |
81 bool RequestCoordinator::StartProcessing( | 86 bool RequestCoordinator::StartProcessing( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 << __FUNCTION__; | 124 << __FUNCTION__; |
120 last_offlining_status_ = status; | 125 last_offlining_status_ = status; |
121 | 126 |
122 // TODO(petewil): Check time budget. Start a request if we have time, return | 127 // TODO(petewil): Check time budget. Start a request if we have time, return |
123 // to the scheduler if we are out of time. | 128 // to the scheduler if we are out of time. |
124 | 129 |
125 // TODO(petewil): If the request succeeded, remove it from the Queue. | 130 // TODO(petewil): If the request succeeded, remove it from the Queue. |
126 } | 131 } |
127 | 132 |
128 } // namespace offline_pages | 133 } // namespace offline_pages |
OLD | NEW |