| 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 #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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // a callback. If processing was already active, returns false. | 48 // a callback. If processing was already active, returns false. |
| 49 bool StartProcessing(const ProcessingDoneCallback& callback); | 49 bool StartProcessing(const ProcessingDoneCallback& callback); |
| 50 | 50 |
| 51 // Stops the current request processing if active. This is a way for | 51 // Stops the current request processing if active. This is a way for |
| 52 // caller to abort processing; otherwise, processing will complete on | 52 // caller to abort processing; otherwise, processing will complete on |
| 53 // its own. In either case, the callback will be called when processing | 53 // its own. In either case, the callback will be called when processing |
| 54 // is stopped or complete. | 54 // is stopped or complete. |
| 55 void StopProcessing(); | 55 void StopProcessing(); |
| 56 | 56 |
| 57 // Returns the request queue used for requests. Coordinator keeps ownership. | 57 // Returns the request queue used for requests. Coordinator keeps ownership. |
| 58 RequestQueue* GetQueue() { return queue_.get(); } | 58 RequestQueue* queue() { return queue_.get(); } |
| 59 | 59 |
| 60 Scheduler* GetSchedulerForTesting() { return scheduler_.get(); } | 60 // Return an unowned pointer to the Scheduler. |
| 61 Scheduler* scheduler() { return scheduler_.get(); } |
| 61 | 62 |
| 62 // Returns the status of the most recent offlining. | 63 // Returns the status of the most recent offlining. |
| 63 Offliner::RequestStatus last_offlining_status() { | 64 Offliner::RequestStatus last_offlining_status() { |
| 64 return last_offlining_status_; | 65 return last_offlining_status_; |
| 65 } | 66 } |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 void AddRequestResultCallback(RequestQueue::AddRequestResult result, | 69 void AddRequestResultCallback(RequestQueue::AddRequestResult result, |
| 69 const SavePageRequest& request); | 70 const SavePageRequest& request); |
| 70 | 71 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 std::unique_ptr<Scheduler> scheduler_; | 84 std::unique_ptr<Scheduler> scheduler_; |
| 84 // Status of the most recent offlining. | 85 // Status of the most recent offlining. |
| 85 Offliner::RequestStatus last_offlining_status_; | 86 Offliner::RequestStatus last_offlining_status_; |
| 86 | 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 88 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace offline_pages | 91 } // namespace offline_pages |
| 91 | 92 |
| 92 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 93 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |