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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/log/net_log.h ('k') | net/log/net_log_capture_mode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/alias.h" 8 #include "base/debug/alias.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const char* name, 55 const char* name,
56 int value, 56 int value,
57 NetLogCaptureMode /* capture_mode */) { 57 NetLogCaptureMode /* capture_mode */) {
58 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); 58 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue());
59 event_params->SetInteger(name, value); 59 event_params->SetInteger(name, value);
60 return event_params.Pass(); 60 return event_params.Pass();
61 } 61 }
62 62
63 scoped_ptr<base::Value> NetLogInt64Callback( 63 scoped_ptr<base::Value> NetLogInt64Callback(
64 const char* name, 64 const char* name,
65 int64 value, 65 int64_t value,
66 NetLogCaptureMode /* capture_mode */) { 66 NetLogCaptureMode /* capture_mode */) {
67 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); 67 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue());
68 event_params->SetString(name, base::Int64ToString(value)); 68 event_params->SetString(name, base::Int64ToString(value));
69 return event_params.Pass(); 69 return event_params.Pass();
70 } 70 }
71 71
72 scoped_ptr<base::Value> NetLogStringCallback( 72 scoped_ptr<base::Value> NetLogStringCallback(
73 const char* name, 73 const char* name,
74 const std::string* value, 74 const std::string* value,
75 NetLogCaptureMode /* capture_mode */) { 75 NetLogCaptureMode /* capture_mode */) {
76 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); 76 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue());
77 event_params->SetString(name, *value); 77 event_params->SetString(name, *value);
78 return event_params.Pass(); 78 return event_params.Pass();
79 } 79 }
80 80
81 scoped_ptr<base::Value> NetLogString16Callback( 81 scoped_ptr<base::Value> NetLogString16Callback(
82 const char* name, 82 const char* name,
83 const base::string16* value, 83 const base::string16* value,
84 NetLogCaptureMode /* capture_mode */) { 84 NetLogCaptureMode /* capture_mode */) {
85 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); 85 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue());
86 event_params->SetString(name, *value); 86 event_params->SetString(name, *value);
87 return event_params.Pass(); 87 return event_params.Pass();
88 } 88 }
89 89
90 } // namespace 90 } // namespace
91 91
92 // LoadTimingInfo requires this be 0. 92 // LoadTimingInfo requires this be 0.
93 const uint32 NetLog::Source::kInvalidId = 0; 93 const uint32_t NetLog::Source::kInvalidId = 0;
94 94
95 NetLog::Source::Source() : type(SOURCE_NONE), id(kInvalidId) { 95 NetLog::Source::Source() : type(SOURCE_NONE), id(kInvalidId) {
96 } 96 }
97 97
98 NetLog::Source::Source(SourceType type, uint32 id) : type(type), id(id) { 98 NetLog::Source::Source(SourceType type, uint32_t id) : type(type), id(id) {}
99 }
100 99
101 bool NetLog::Source::IsValid() const { 100 bool NetLog::Source::IsValid() const {
102 return id != kInvalidId; 101 return id != kInvalidId;
103 } 102 }
104 103
105 void NetLog::Source::AddToEventParameters( 104 void NetLog::Source::AddToEventParameters(
106 base::DictionaryValue* event_params) const { 105 base::DictionaryValue* event_params) const {
107 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 106 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
108 dict->SetInteger("type", static_cast<int>(type)); 107 dict->SetInteger("type", static_cast<int>(type));
109 dict->SetInteger("id", static_cast<int>(id)); 108 dict->SetInteger("id", static_cast<int>(id));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 NULL); 222 NULL);
224 } 223 }
225 224
226 void NetLog::AddGlobalEntry( 225 void NetLog::AddGlobalEntry(
227 EventType type, 226 EventType type,
228 const NetLog::ParametersCallback& parameters_callback) { 227 const NetLog::ParametersCallback& parameters_callback) {
229 AddEntry(type, Source(NetLog::SOURCE_NONE, NextID()), NetLog::PHASE_NONE, 228 AddEntry(type, Source(NetLog::SOURCE_NONE, NextID()), NetLog::PHASE_NONE,
230 &parameters_callback); 229 &parameters_callback);
231 } 230 }
232 231
233 uint32 NetLog::NextID() { 232 uint32_t NetLog::NextID() {
234 return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1); 233 return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1);
235 } 234 }
236 235
237 bool NetLog::IsCapturing() const { 236 bool NetLog::IsCapturing() const {
238 return base::subtle::NoBarrier_Load(&is_capturing_) != 0; 237 return base::subtle::NoBarrier_Load(&is_capturing_) != 0;
239 } 238 }
240 239
241 void NetLog::DeprecatedAddObserver(NetLog::ThreadSafeObserver* observer, 240 void NetLog::DeprecatedAddObserver(NetLog::ThreadSafeObserver* observer,
242 NetLogCaptureMode capture_mode) { 241 NetLogCaptureMode capture_mode) {
243 base::AutoLock lock(lock_); 242 base::AutoLock lock(lock_);
(...skipping 26 matching lines...) Expand all
270 } 269 }
271 270
272 void NetLog::UpdateIsCapturing() { 271 void NetLog::UpdateIsCapturing() {
273 lock_.AssertAcquired(); 272 lock_.AssertAcquired();
274 base::subtle::NoBarrier_Store(&is_capturing_, 273 base::subtle::NoBarrier_Store(&is_capturing_,
275 observers_.might_have_observers() ? 1 : 0); 274 observers_.might_have_observers() ? 1 : 0);
276 } 275 }
277 276
278 // static 277 // static
279 std::string NetLog::TickCountToString(const base::TimeTicks& time) { 278 std::string NetLog::TickCountToString(const base::TimeTicks& time) {
280 int64 delta_time = (time - base::TimeTicks()).InMilliseconds(); 279 int64_t delta_time = (time - base::TimeTicks()).InMilliseconds();
281 return base::Int64ToString(delta_time); 280 return base::Int64ToString(delta_time);
282 } 281 }
283 282
284 // static 283 // static
285 const char* NetLog::EventTypeToString(EventType event) { 284 const char* NetLog::EventTypeToString(EventType event) {
286 switch (event) { 285 switch (event) {
287 #define EVENT_TYPE(label) \ 286 #define EVENT_TYPE(label) \
288 case TYPE_##label: \ 287 case TYPE_##label: \
289 return #label; 288 return #label;
290 #include "net/log/net_log_event_type_list.h" 289 #include "net/log/net_log_event_type_list.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return base::Bind(&NetLogBoolCallback, name, value); 345 return base::Bind(&NetLogBoolCallback, name, value);
347 } 346 }
348 347
349 // static 348 // static
350 NetLog::ParametersCallback NetLog::IntCallback(const char* name, int value) { 349 NetLog::ParametersCallback NetLog::IntCallback(const char* name, int value) {
351 return base::Bind(&NetLogIntCallback, name, value); 350 return base::Bind(&NetLogIntCallback, name, value);
352 } 351 }
353 352
354 // static 353 // static
355 NetLog::ParametersCallback NetLog::Int64Callback(const char* name, 354 NetLog::ParametersCallback NetLog::Int64Callback(const char* name,
356 int64 value) { 355 int64_t value) {
357 return base::Bind(&NetLogInt64Callback, name, value); 356 return base::Bind(&NetLogInt64Callback, name, value);
358 } 357 }
359 358
360 // static 359 // static
361 NetLog::ParametersCallback NetLog::StringCallback(const char* name, 360 NetLog::ParametersCallback NetLog::StringCallback(const char* name,
362 const std::string* value) { 361 const std::string* value) {
363 DCHECK(value); 362 DCHECK(value);
364 return base::Bind(&NetLogStringCallback, name, value); 363 return base::Bind(&NetLogStringCallback, name, value);
365 } 364 }
366 365
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 Liveness liveness = liveness_; 482 Liveness liveness = liveness_;
484 483
485 if (liveness == ALIVE) 484 if (liveness == ALIVE)
486 return; 485 return;
487 486
488 base::debug::Alias(&liveness); 487 base::debug::Alias(&liveness);
489 CHECK_EQ(ALIVE, liveness); 488 CHECK_EQ(ALIVE, liveness);
490 } 489 }
491 490
492 } // namespace net 491 } // namespace net
OLDNEW
« no previous file with comments | « net/log/net_log.h ('k') | net/log/net_log_capture_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698