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

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

Issue 2089413002: [Offline Pages] Create a event/activity logger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 #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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
14 #include "components/offline_pages/background/device_conditions.h" 14 #include "components/offline_pages/background/device_conditions.h"
15 #include "components/offline_pages/background/offliner.h" 15 #include "components/offline_pages/background/offliner.h"
16 #include "components/offline_pages/background/request_coordinator_event_logger.h "
16 #include "components/offline_pages/background/request_queue.h" 17 #include "components/offline_pages/background/request_queue.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace offline_pages { 20 namespace offline_pages {
20 21
21 struct ClientId; 22 struct ClientId;
22 class OfflinerPolicy; 23 class OfflinerPolicy;
23 class OfflinerFactory; 24 class OfflinerFactory;
24 class Offliner; 25 class Offliner;
25 class RequestPicker; 26 class RequestPicker;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 RequestQueue* queue() { return queue_.get(); } 67 RequestQueue* queue() { return queue_.get(); }
67 68
68 // Return an unowned pointer to the Scheduler. 69 // Return an unowned pointer to the Scheduler.
69 Scheduler* scheduler() { return scheduler_.get(); } 70 Scheduler* scheduler() { return scheduler_.get(); }
70 71
71 // Returns the status of the most recent offlining. 72 // Returns the status of the most recent offlining.
72 Offliner::RequestStatus last_offlining_status() { 73 Offliner::RequestStatus last_offlining_status() {
73 return last_offlining_status_; 74 return last_offlining_status_;
74 } 75 }
75 76
77 void SetIsLogging(bool should_log);
fgorski 2016/06/23 16:34:06 I started review in the middle, so you might see a
chili 2016/06/24 02:45:50 done
78
79 void GetLogs(std::vector<std::string> logs);
80
76 private: 81 private:
77 void AddRequestResultCallback(RequestQueue::AddRequestResult result, 82 void AddRequestResultCallback(RequestQueue::AddRequestResult result,
78 const SavePageRequest& request); 83 const SavePageRequest& request);
79 84
80 void UpdateRequestCallback(RequestQueue::UpdateRequestResult result); 85 void UpdateRequestCallback(RequestQueue::UpdateRequestResult result);
81 86
82 // Callback from the request picker when it has chosen our next request. 87 // Callback from the request picker when it has chosen our next request.
83 void RequestPicked(const SavePageRequest& request); 88 void RequestPicked(const SavePageRequest& request);
84 89
85 // Callback from the request picker when no more requests are in the queue. 90 // Callback from the request picker when no more requests are in the queue.
(...skipping 17 matching lines...) Expand all
103 // RequestQueue. Used to store incoming requests. Owned. 108 // RequestQueue. Used to store incoming requests. Owned.
104 std::unique_ptr<RequestQueue> queue_; 109 std::unique_ptr<RequestQueue> queue_;
105 // Scheduler. Used to request a callback when network is available. Owned. 110 // Scheduler. Used to request a callback when network is available. Owned.
106 std::unique_ptr<Scheduler> scheduler_; 111 std::unique_ptr<Scheduler> scheduler_;
107 // Status of the most recent offlining. 112 // Status of the most recent offlining.
108 Offliner::RequestStatus last_offlining_status_; 113 Offliner::RequestStatus last_offlining_status_;
109 // Class to choose which request to schedule next 114 // Class to choose which request to schedule next
110 std::unique_ptr<RequestPicker> picker_; 115 std::unique_ptr<RequestPicker> picker_;
111 // Calling this returns to the scheduler across the JNI bridge. 116 // Calling this returns to the scheduler across the JNI bridge.
112 base::Callback<void(bool)> scheduler_callback_; 117 base::Callback<void(bool)> scheduler_callback_;
118 // Logger to record events.
119 RequestCoordinatorEventLogger event_logger_;
113 // Allows us to pass a weak pointer to callbacks. 120 // Allows us to pass a weak pointer to callbacks.
114 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; 121 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;
115 122
116 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); 123 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
117 }; 124 };
118 125
119 } // namespace offline_pages 126 } // namespace offline_pages
120 127
121 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 128 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698