Chromium Code Reviews| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 | 89 |
| 90 // Called by the offliner when an offlining request is completed. (and by | 90 // Called by the offliner when an offlining request is completed. (and by |
| 91 // tests). | 91 // tests). |
| 92 void OfflinerDoneCallback(const SavePageRequest& request, | 92 void OfflinerDoneCallback(const SavePageRequest& request, |
| 93 Offliner::RequestStatus status); | 93 Offliner::RequestStatus status); |
| 94 | 94 |
| 95 void TryNextRequest(); | 95 void TryNextRequest(); |
| 96 | 96 |
| 97 friend class RequestCoordinatorTest; | 97 friend class RequestCoordinatorTest; |
| 98 | 98 |
| 99 bool request_in_progress_; | |
|
chili
2016/06/20 18:38:34
though probably annoying to change - can we rename
Pete Williamson
2016/06/21 17:55:25
renamed to is_busy_
| |
| 99 // RequestCoordinator takes over ownership of the policy | 100 // RequestCoordinator takes over ownership of the policy |
| 100 std::unique_ptr<OfflinerPolicy> policy_; | 101 std::unique_ptr<OfflinerPolicy> policy_; |
| 101 // OfflinerFactory. Used to create offline pages. Owned. | 102 // OfflinerFactory. Used to create offline pages. Owned. |
| 102 std::unique_ptr<OfflinerFactory> factory_; | 103 std::unique_ptr<OfflinerFactory> factory_; |
| 103 // RequestQueue. Used to store incoming requests. Owned. | 104 // RequestQueue. Used to store incoming requests. Owned. |
| 104 std::unique_ptr<RequestQueue> queue_; | 105 std::unique_ptr<RequestQueue> queue_; |
| 105 // Scheduler. Used to request a callback when network is available. Owned. | 106 // Scheduler. Used to request a callback when network is available. Owned. |
| 106 std::unique_ptr<Scheduler> scheduler_; | 107 std::unique_ptr<Scheduler> scheduler_; |
| 107 // Status of the most recent offlining. | 108 // Status of the most recent offlining. |
| 108 Offliner::RequestStatus last_offlining_status_; | 109 Offliner::RequestStatus last_offlining_status_; |
| 109 // Class to choose which request to schedule next | 110 // Class to choose which request to schedule next |
| 110 std::unique_ptr<RequestPicker> picker_; | 111 std::unique_ptr<RequestPicker> picker_; |
| 111 // Calling this returns to the scheduler across the JNI bridge. | 112 // Calling this returns to the scheduler across the JNI bridge. |
| 112 base::Callback<void(bool)> scheduler_callback_; | 113 base::Callback<void(bool)> scheduler_callback_; |
| 113 // Allows us to pass a weak pointer to callbacks. | 114 // Allows us to pass a weak pointer to callbacks. |
| 114 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 115 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 115 | 116 |
| 116 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 117 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 } // namespace offline_pages | 120 } // namespace offline_pages |
| 120 | 121 |
| 121 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 122 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |