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

Side by Side Diff: net/log/net_log.cc

Issue 2086763002: Don't use deprecated ListValue::Append(Value*) overload. (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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/log/net_log.h" 5 #include "net/log/net_log.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 *source = Source(); 145 *source = Source();
146 return false; 146 return false;
147 } 147 }
148 148
149 DCHECK_GE(source_id, 0); 149 DCHECK_GE(source_id, 0);
150 DCHECK_LT(source_type, NetLog::SOURCE_COUNT); 150 DCHECK_LT(source_type, NetLog::SOURCE_COUNT);
151 *source = Source(static_cast<SourceType>(source_type), source_id); 151 *source = Source(static_cast<SourceType>(source_type), source_id);
152 return true; 152 return true;
153 } 153 }
154 154
155 base::Value* NetLog::Entry::ToValue() const { 155 std::unique_ptr<base::Value> NetLog::Entry::ToValue() const {
156 std::unique_ptr<base::DictionaryValue> entry_dict( 156 std::unique_ptr<base::DictionaryValue> entry_dict(
157 new base::DictionaryValue()); 157 new base::DictionaryValue());
158 158
159 entry_dict->SetString("time", TickCountToString(data_->time)); 159 entry_dict->SetString("time", TickCountToString(data_->time));
160 160
161 // Set the entry source. 161 // Set the entry source.
162 std::unique_ptr<base::DictionaryValue> source_dict( 162 std::unique_ptr<base::DictionaryValue> source_dict(
163 new base::DictionaryValue()); 163 new base::DictionaryValue());
164 source_dict->SetInteger("id", data_->source.id); 164 source_dict->SetInteger("id", data_->source.id);
165 source_dict->SetInteger("type", static_cast<int>(data_->source.type)); 165 source_dict->SetInteger("type", static_cast<int>(data_->source.type));
166 entry_dict->Set("source", std::move(source_dict)); 166 entry_dict->Set("source", std::move(source_dict));
167 167
168 // Set the event info. 168 // Set the event info.
169 entry_dict->SetInteger("type", static_cast<int>(data_->type)); 169 entry_dict->SetInteger("type", static_cast<int>(data_->type));
170 entry_dict->SetInteger("phase", static_cast<int>(data_->phase)); 170 entry_dict->SetInteger("phase", static_cast<int>(data_->phase));
171 171
172 // Set the event-specific parameters. 172 // Set the event-specific parameters.
173 if (data_->parameters_callback) { 173 if (data_->parameters_callback) {
174 std::unique_ptr<base::Value> value( 174 std::unique_ptr<base::Value> value(
175 data_->parameters_callback->Run(capture_mode_)); 175 data_->parameters_callback->Run(capture_mode_));
176 if (value) 176 if (value)
177 entry_dict->Set("params", std::move(value)); 177 entry_dict->Set("params", std::move(value));
178 } 178 }
179 179
180 return entry_dict.release(); 180 return std::move(entry_dict);
181 } 181 }
182 182
183 std::unique_ptr<base::Value> NetLog::Entry::ParametersToValue() const { 183 std::unique_ptr<base::Value> NetLog::Entry::ParametersToValue() const {
184 if (data_->parameters_callback) 184 if (data_->parameters_callback)
185 return data_->parameters_callback->Run(capture_mode_); 185 return data_->parameters_callback->Run(capture_mode_);
186 return nullptr; 186 return nullptr;
187 } 187 }
188 188
189 NetLog::EntryData::EntryData(EventType type, 189 NetLog::EntryData::EntryData(EventType type,
190 Source source, 190 Source source,
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 Liveness liveness = liveness_; 509 Liveness liveness = liveness_;
510 510
511 if (liveness == ALIVE) 511 if (liveness == ALIVE)
512 return; 512 return;
513 513
514 base::debug::Alias(&liveness); 514 base::debug::Alias(&liveness);
515 CHECK_EQ(ALIVE, liveness); 515 CHECK_EQ(ALIVE, liveness);
516 } 516 }
517 517
518 } // namespace net 518 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698