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

Side by Side Diff: components/domain_reliability/context.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Nits Created 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/domain_reliability/context.h" 5 #include "components/domain_reliability/context.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 beacons_value->Append(beacon->ToValue(upload_time, 224 beacons_value->Append(beacon->ToValue(upload_time,
225 *last_network_change_time_, 225 *last_network_change_time_,
226 collector_url, 226 collector_url,
227 config().path_prefixes)); 227 config().path_prefixes));
228 if (beacon->upload_depth > max_upload_depth) 228 if (beacon->upload_depth > max_upload_depth)
229 max_upload_depth = beacon->upload_depth; 229 max_upload_depth = beacon->upload_depth;
230 } 230 }
231 231
232 std::unique_ptr<DictionaryValue> report_value(new DictionaryValue()); 232 std::unique_ptr<DictionaryValue> report_value(new DictionaryValue());
233 report_value->SetString("reporter", upload_reporter_string_); 233 report_value->SetString("reporter", upload_reporter_string_);
234 report_value->Set("entries", beacons_value.release()); 234 report_value->Set("entries", std::move(beacons_value));
235 235
236 *max_upload_depth_out = max_upload_depth; 236 *max_upload_depth_out = max_upload_depth;
237 return std::move(report_value); 237 return std::move(report_value);
238 } 238 }
239 239
240 void DomainReliabilityContext::MarkUpload() { 240 void DomainReliabilityContext::MarkUpload() {
241 DCHECK_EQ(0u, uploading_beacons_size_); 241 DCHECK_EQ(0u, uploading_beacons_size_);
242 uploading_beacons_size_ = beacons_.size(); 242 uploading_beacons_size_ = beacons_.size();
243 DCHECK_NE(0u, uploading_beacons_size_); 243 DCHECK_NE(0u, uploading_beacons_size_);
244 } 244 }
(...skipping 26 matching lines...) Expand all
271 } 271 }
272 272
273 void DomainReliabilityContext::RemoveExpiredBeacons() { 273 void DomainReliabilityContext::RemoveExpiredBeacons() {
274 base::TimeTicks now = time_->NowTicks(); 274 base::TimeTicks now = time_->NowTicks();
275 const base::TimeDelta kMaxAge = base::TimeDelta::FromHours(1); 275 const base::TimeDelta kMaxAge = base::TimeDelta::FromHours(1);
276 while (!beacons_.empty() && now - beacons_.front()->start_time >= kMaxAge) 276 while (!beacons_.empty() && now - beacons_.front()->start_time >= kMaxAge)
277 beacons_.pop_front(); 277 beacons_.pop_front();
278 } 278 }
279 279
280 } // namespace domain_reliability 280 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/domain_reliability/beacon.cc ('k') | components/error_page/common/localized_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698