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

Side by Side Diff: talk/app/webrtc/statstypes.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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
« no previous file with comments | « talk/app/webrtc/statstypes.h ('k') | talk/app/webrtc/test/fakeaudiocapturemodule.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 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 StatsReport::IdBase::IdBase(StatsType type) : type_(type) {} 223 StatsReport::IdBase::IdBase(StatsType type) : type_(type) {}
224 StatsReport::IdBase::~IdBase() {} 224 StatsReport::IdBase::~IdBase() {}
225 225
226 StatsReport::StatsType StatsReport::IdBase::type() const { return type_; } 226 StatsReport::StatsType StatsReport::IdBase::type() const { return type_; }
227 227
228 bool StatsReport::IdBase::Equals(const IdBase& other) const { 228 bool StatsReport::IdBase::Equals(const IdBase& other) const {
229 return other.type_ == type_; 229 return other.type_ == type_;
230 } 230 }
231 231
232 StatsReport::Value::Value(StatsValueName name, int64 value, Type int_type) 232 StatsReport::Value::Value(StatsValueName name, int64_t value, Type int_type)
233 : name(name), type_(int_type) { 233 : name(name), type_(int_type) {
234 RTC_DCHECK(type_ == kInt || type_ == kInt64); 234 RTC_DCHECK(type_ == kInt || type_ == kInt64);
235 type_ == kInt ? value_.int_ = static_cast<int>(value) : value_.int64_ = value; 235 type_ == kInt ? value_.int_ = static_cast<int>(value) : value_.int64_ = value;
236 } 236 }
237 237
238 StatsReport::Value::Value(StatsValueName name, float f) 238 StatsReport::Value::Value(StatsValueName name, float f)
239 : name(name), type_(kFloat) { 239 : name(name), type_(kFloat) {
240 value_.float_ = f; 240 value_.float_ = f;
241 } 241 }
242 242
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 if (type_ != kStaticString) 324 if (type_ != kStaticString)
325 return false; 325 return false;
326 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) 326 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
327 if (value_.static_string_ != value) 327 if (value_.static_string_ != value)
328 RTC_DCHECK(strcmp(value_.static_string_, value) != 0) 328 RTC_DCHECK(strcmp(value_.static_string_, value) != 0)
329 << "Duplicate global?"; 329 << "Duplicate global?";
330 #endif 330 #endif
331 return value == value_.static_string_; 331 return value == value_.static_string_;
332 } 332 }
333 333
334 bool StatsReport::Value::operator==(int64 value) const { 334 bool StatsReport::Value::operator==(int64_t value) const {
335 return type_ == kInt ? value_.int_ == static_cast<int>(value) : 335 return type_ == kInt ? value_.int_ == static_cast<int>(value) :
336 (type_ == kInt64 ? value_.int64_ == value : false); 336 (type_ == kInt64 ? value_.int64_ == value : false);
337 } 337 }
338 338
339 bool StatsReport::Value::operator==(bool value) const { 339 bool StatsReport::Value::operator==(bool value) const {
340 return type_ == kBool && value_.bool_ == value; 340 return type_ == kBool && value_.bool_ == value;
341 } 341 }
342 342
343 bool StatsReport::Value::operator==(float value) const { 343 bool StatsReport::Value::operator==(float value) const {
344 return type_ == kFloat && value_.float_ == value; 344 return type_ == kFloat && value_.float_ == value;
345 } 345 }
346 346
347 bool StatsReport::Value::operator==(const Id& value) const { 347 bool StatsReport::Value::operator==(const Id& value) const {
348 return type_ == kId && (*value_.id_)->Equals(value); 348 return type_ == kId && (*value_.id_)->Equals(value);
349 } 349 }
350 350
351 int StatsReport::Value::int_val() const { 351 int StatsReport::Value::int_val() const {
352 RTC_DCHECK(type_ == kInt); 352 RTC_DCHECK(type_ == kInt);
353 return value_.int_; 353 return value_.int_;
354 } 354 }
355 355
356 int64 StatsReport::Value::int64_val() const { 356 int64_t StatsReport::Value::int64_val() const {
357 RTC_DCHECK(type_ == kInt64); 357 RTC_DCHECK(type_ == kInt64);
358 return value_.int64_; 358 return value_.int64_;
359 } 359 }
360 360
361 float StatsReport::Value::float_val() const { 361 float StatsReport::Value::float_val() const {
362 RTC_DCHECK(type_ == kFloat); 362 RTC_DCHECK(type_ == kFloat);
363 return value_.float_; 363 return value_.float_;
364 } 364 }
365 365
366 const char* StatsReport::Value::static_string_val() const { 366 const char* StatsReport::Value::static_string_val() const {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 values_[name] = ValuePtr(new Value(name, value)); 675 values_[name] = ValuePtr(new Value(name, value));
676 } 676 }
677 677
678 void StatsReport::AddString(StatsReport::StatsValueName name, 678 void StatsReport::AddString(StatsReport::StatsValueName name,
679 const char* value) { 679 const char* value) {
680 const Value* found = FindValue(name); 680 const Value* found = FindValue(name);
681 if (!found || !(*found == value)) 681 if (!found || !(*found == value))
682 values_[name] = ValuePtr(new Value(name, value)); 682 values_[name] = ValuePtr(new Value(name, value));
683 } 683 }
684 684
685 void StatsReport::AddInt64(StatsReport::StatsValueName name, int64 value) { 685 void StatsReport::AddInt64(StatsReport::StatsValueName name, int64_t value) {
686 const Value* found = FindValue(name); 686 const Value* found = FindValue(name);
687 if (!found || !(*found == value)) 687 if (!found || !(*found == value))
688 values_[name] = ValuePtr(new Value(name, value, Value::kInt64)); 688 values_[name] = ValuePtr(new Value(name, value, Value::kInt64));
689 } 689 }
690 690
691 void StatsReport::AddInt(StatsReport::StatsValueName name, int value) { 691 void StatsReport::AddInt(StatsReport::StatsValueName name, int value) {
692 const Value* found = FindValue(name); 692 const Value* found = FindValue(name);
693 if (!found || !(*found == static_cast<int64>(value))) 693 if (!found || !(*found == static_cast<int64_t>(value)))
694 values_[name] = ValuePtr(new Value(name, value, Value::kInt)); 694 values_[name] = ValuePtr(new Value(name, value, Value::kInt));
695 } 695 }
696 696
697 void StatsReport::AddFloat(StatsReport::StatsValueName name, float value) { 697 void StatsReport::AddFloat(StatsReport::StatsValueName name, float value) {
698 const Value* found = FindValue(name); 698 const Value* found = FindValue(name);
699 if (!found || !(*found == value)) 699 if (!found || !(*found == value))
700 values_[name] = ValuePtr(new Value(name, value)); 700 values_[name] = ValuePtr(new Value(name, value));
701 } 701 }
702 702
703 void StatsReport::AddBoolean(StatsReport::StatsValueName name, bool value) { 703 void StatsReport::AddBoolean(StatsReport::StatsValueName name, bool value) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 // Looks for a report with the given |id|. If one is not found, NULL 773 // Looks for a report with the given |id|. If one is not found, NULL
774 // will be returned. 774 // will be returned.
775 StatsReport* StatsCollection::Find(const StatsReport::Id& id) { 775 StatsReport* StatsCollection::Find(const StatsReport::Id& id) {
776 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 776 RTC_DCHECK(thread_checker_.CalledOnValidThread());
777 Container::iterator it = std::find_if(list_.begin(), list_.end(), 777 Container::iterator it = std::find_if(list_.begin(), list_.end(),
778 [&id](const StatsReport* r)->bool { return r->id()->Equals(id); }); 778 [&id](const StatsReport* r)->bool { return r->id()->Equals(id); });
779 return it == list_.end() ? nullptr : *it; 779 return it == list_.end() ? nullptr : *it;
780 } 780 }
781 781
782 } // namespace webrtc 782 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/statstypes.h ('k') | talk/app/webrtc/test/fakeaudiocapturemodule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698