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

Side by Side Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc

Issue 2287733002: Switch //components away from base::ListValue::Append(Value*) overload. (Closed)
Patch Set: Test fix Created 4 years, 3 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/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h" 5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 int current_time_ticks_ms = 131 int current_time_ticks_ms =
132 (base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds(); 132 (base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds();
133 if (expiration_ticks_ > current_time_ticks_ms) { 133 if (expiration_ticks_ > current_time_ticks_ms) {
134 data_reduction_proxy_values->Set("last_bypass", 134 data_reduction_proxy_values->Set("last_bypass",
135 last_bypass_event->DeepCopy()); 135 last_bypass_event->DeepCopy());
136 } 136 }
137 } 137 }
138 138
139 auto events_list = base::MakeUnique<base::ListValue>(); 139 auto events_list = base::MakeUnique<base::ListValue>();
140 for (const auto& event : stored_events_) 140 for (const auto& event : stored_events_)
141 events_list->Append(event->DeepCopy()); 141 events_list->Append(event->CreateDeepCopy());
142 data_reduction_proxy_values->Set("events", std::move(events_list)); 142 data_reduction_proxy_values->Set("events", std::move(events_list));
143 return data_reduction_proxy_values; 143 return data_reduction_proxy_values;
144 } 144 }
145 145
146 void DataReductionProxyEventStore::AddEvent( 146 void DataReductionProxyEventStore::AddEvent(
147 std::unique_ptr<base::Value> event) { 147 std::unique_ptr<base::Value> event) {
148 if (stored_events_.size() == kMaxEventsToStore) 148 if (stored_events_.size() == kMaxEventsToStore)
149 stored_events_.pop_front(); 149 stored_events_.pop_front();
150 stored_events_.push_back(std::move(event)); 150 stored_events_.push_back(std::move(event));
151 } 151 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 last_bypass->SetString("url", clean_url.spec()); 258 last_bypass->SetString("url", clean_url.spec());
259 } 259 }
260 } 260 }
261 261
262 std::string json; 262 std::string json;
263 base::JSONWriter::Write(*last_bypass.get(), &json); 263 base::JSONWriter::Write(*last_bypass.get(), &json);
264 return json; 264 return json;
265 } 265 }
266 266
267 } // namespace data_reduction_proxy 267 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698