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

Unified Diff: base/trace_event/trace_event_impl.cc

Issue 1546033002: Switch to standard integer types in base/trace_event/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/trace_event_impl.h ('k') | base/trace_event/trace_event_memory_overhead.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_impl.cc
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc
index b7f0f24f33f48c222f6074cbab7bbcaed473cf50..24d6568f90d7808ed573412b44b5cb1c0cca8b92 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -4,6 +4,8 @@
#include "base/trace_event/trace_event_impl.h"
+#include <stddef.h>
+
#include "base/format_macros.h"
#include "base/json/string_escape.h"
#include "base/process/process_handle.h"
@@ -210,10 +212,10 @@ void TraceEvent::AppendValueAsJSON(unsigned char type,
*out += value.as_bool ? "true" : "false";
break;
case TRACE_VALUE_TYPE_UINT:
- StringAppendF(out, "%" PRIu64, static_cast<uint64>(value.as_uint));
+ StringAppendF(out, "%" PRIu64, static_cast<uint64_t>(value.as_uint));
break;
case TRACE_VALUE_TYPE_INT:
- StringAppendF(out, "%" PRId64, static_cast<int64>(value.as_int));
+ StringAppendF(out, "%" PRId64, static_cast<int64_t>(value.as_int));
break;
case TRACE_VALUE_TYPE_DOUBLE: {
// FIXME: base/json/json_writer.cc is using the same code,
@@ -253,9 +255,9 @@ void TraceEvent::AppendValueAsJSON(unsigned char type,
case TRACE_VALUE_TYPE_POINTER:
// JSON only supports double and int numbers.
// So as not to lose bits from a 64-bit pointer, output as a hex string.
- StringAppendF(out, "\"0x%" PRIx64 "\"", static_cast<uint64>(
- reinterpret_cast<intptr_t>(
- value.as_pointer)));
+ StringAppendF(
+ out, "\"0x%" PRIx64 "\"",
+ static_cast<uint64_t>(reinterpret_cast<intptr_t>(value.as_pointer)));
break;
case TRACE_VALUE_TYPE_STRING:
case TRACE_VALUE_TYPE_COPY_STRING:
@@ -270,7 +272,7 @@ void TraceEvent::AppendValueAsJSON(unsigned char type,
void TraceEvent::AppendAsJSON(
std::string* out,
const ArgumentFilterPredicate& argument_filter_predicate) const {
- int64 time_int64 = timestamp_.ToInternalValue();
+ int64_t time_int64 = timestamp_.ToInternalValue();
int process_id;
int thread_id;
if ((flags_ & TRACE_EVENT_FLAG_HAS_PROCESS_ID) &&
@@ -329,11 +331,11 @@ void TraceEvent::AppendAsJSON(
}
if (phase_ == TRACE_EVENT_PHASE_COMPLETE) {
- int64 duration = duration_.ToInternalValue();
+ int64_t duration = duration_.ToInternalValue();
if (duration != -1)
StringAppendF(out, ",\"dur\":%" PRId64, duration);
if (!thread_timestamp_.is_null()) {
- int64 thread_duration = thread_duration_.ToInternalValue();
+ int64_t thread_duration = thread_duration_.ToInternalValue();
if (thread_duration != -1)
StringAppendF(out, ",\"tdur\":%" PRId64, thread_duration);
}
@@ -341,7 +343,7 @@ void TraceEvent::AppendAsJSON(
// Output tts if thread_timestamp is valid.
if (!thread_timestamp_.is_null()) {
- int64 thread_time_int64 = thread_timestamp_.ToInternalValue();
+ int64_t thread_time_int64 = thread_timestamp_.ToInternalValue();
StringAppendF(out, ",\"tts\":%" PRId64, thread_time_int64);
}
@@ -353,7 +355,7 @@ void TraceEvent::AppendAsJSON(
// If id_ is set, print it out as a hex string so we don't loose any
// bits (it might be a 64-bit pointer).
if (flags_ & TRACE_EVENT_FLAG_HAS_ID)
- StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"", static_cast<uint64>(id_));
+ StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"", static_cast<uint64_t>(id_));
if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING)
StringAppendF(out, ",\"bp\":\"e\"");
@@ -361,7 +363,7 @@ void TraceEvent::AppendAsJSON(
if ((flags_ & TRACE_EVENT_FLAG_FLOW_OUT) ||
(flags_ & TRACE_EVENT_FLAG_FLOW_IN)) {
StringAppendF(out, ",\"bind_id\":\"0x%" PRIx64 "\"",
- static_cast<uint64>(bind_id_));
+ static_cast<uint64_t>(bind_id_));
}
if (flags_ & TRACE_EVENT_FLAG_FLOW_IN)
StringAppendF(out, ",\"flow_in\":true");
« no previous file with comments | « base/trace_event/trace_event_impl.h ('k') | base/trace_event/trace_event_memory_overhead.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698