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

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

Issue 2089413002: [Offline Pages] Create a event/activity logger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address initial comments Created 4 years, 5 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 offliner_->LoadAndSave(request, 148 offliner_->LoadAndSave(request,
149 base::Bind(&RequestCoordinator::OfflinerDoneCallback, 149 base::Bind(&RequestCoordinator::OfflinerDoneCallback,
150 weak_ptr_factory_.GetWeakPtr())); 150 weak_ptr_factory_.GetWeakPtr()));
151 } 151 }
152 152
153 void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request, 153 void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
154 Offliner::RequestStatus status) { 154 Offliner::RequestStatus status) {
155 DVLOG(2) << "offliner finished, saved: " 155 DVLOG(2) << "offliner finished, saved: "
156 << (status == Offliner::RequestStatus::SAVED) << ", status: " 156 << (status == Offliner::RequestStatus::SAVED) << ", status: "
157 << (int) status << ", " << __FUNCTION__; 157 << (int) status << ", " << __FUNCTION__;
158 event_logger_.RecordSavePageRequestUpdated(
159 request.client_id().name_space,
160 "Saved",
dewittj 2016/06/24 18:32:49 If this is the only place this is called, I'd prob
chili 2016/06/24 20:30:10 Ideally (probably in another CL), we can move the
161 std::to_string(request.request_id()));
dewittj 2016/06/24 18:32:49 Seems like you could just pass the request_id here
chili 2016/06/24 20:30:10 Done.
158 last_offlining_status_ = status; 162 last_offlining_status_ = status;
159 163
160 is_busy_ = false; 164 is_busy_ = false;
161 165
162 // If the request succeeded, remove it from the Queue and maybe schedule 166 // If the request succeeded, remove it from the Queue and maybe schedule
163 // another one. 167 // another one.
164 if (status == Offliner::RequestStatus::SAVED) { 168 if (status == Offliner::RequestStatus::SAVED) {
165 queue_->RemoveRequest(request.request_id(), 169 queue_->RemoveRequest(request.request_id(),
166 base::Bind(&RequestCoordinator::UpdateRequestCallback, 170 base::Bind(&RequestCoordinator::UpdateRequestCallback,
167 weak_ptr_factory_.GetWeakPtr())); 171 weak_ptr_factory_.GetWeakPtr()));
168 172
169 // TODO(petewil): Check time budget. Return to the scheduler if we are out. 173 // TODO(petewil): Check time budget. Return to the scheduler if we are out.
170 174
171 // Start another request if we have time. 175 // Start another request if we have time.
172 TryNextRequest(); 176 TryNextRequest();
173 } 177 }
174 } 178 }
175 179
176 void RequestCoordinator::GetOffliner() { 180 void RequestCoordinator::GetOffliner() {
177 if (!offliner_) { 181 if (!offliner_) {
178 offliner_ = factory_->GetOffliner(policy_.get()); 182 offliner_ = factory_->GetOffliner(policy_.get());
179 } 183 }
180 } 184 }
181 185
182 } // namespace offline_pages 186 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698