Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/trace_event/trace_event_impl.h" | 5 #include "base/trace_event/trace_event_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 real = "\"Infinity\""; | 254 real = "\"Infinity\""; |
| 255 } | 255 } |
| 256 StringAppendF(out, "%s", real.c_str()); | 256 StringAppendF(out, "%s", real.c_str()); |
| 257 break; | 257 break; |
| 258 } | 258 } |
| 259 case TRACE_VALUE_TYPE_POINTER: | 259 case TRACE_VALUE_TYPE_POINTER: |
| 260 // JSON only supports double and int numbers. | 260 // JSON only supports double and int numbers. |
| 261 // So as not to lose bits from a 64-bit pointer, output as a hex string. | 261 // So as not to lose bits from a 64-bit pointer, output as a hex string. |
| 262 StringAppendF( | 262 StringAppendF( |
| 263 out, "\"0x%" PRIx64 "\"", | 263 out, "\"0x%" PRIx64 "\"", |
| 264 static_cast<uint64_t>(reinterpret_cast<intptr_t>(value.as_pointer))); | 264 static_cast<uint64_t>(reinterpret_cast<uintptr_t>(value.as_pointer))); |
|
caseq
2016/06/09 16:59:13
can we drop the inner one and do a reinterpret_cas
Kunihiko Sakamoto
2016/06/10 05:19:24
Unfortunately, that doesn't prevent sign extension
| |
| 265 break; | 265 break; |
| 266 case TRACE_VALUE_TYPE_STRING: | 266 case TRACE_VALUE_TYPE_STRING: |
| 267 case TRACE_VALUE_TYPE_COPY_STRING: | 267 case TRACE_VALUE_TYPE_COPY_STRING: |
| 268 EscapeJSONString(value.as_string ? value.as_string : "NULL", true, out); | 268 EscapeJSONString(value.as_string ? value.as_string : "NULL", true, out); |
| 269 break; | 269 break; |
| 270 default: | 270 default: |
| 271 NOTREACHED() << "Don't know how to print this value"; | 271 NOTREACHED() << "Don't know how to print this value"; |
| 272 break; | 272 break; |
| 273 } | 273 } |
| 274 } | 274 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); | 417 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); |
| 418 | 418 |
| 419 *out << value_as_text; | 419 *out << value_as_text; |
| 420 } | 420 } |
| 421 *out << "}"; | 421 *out << "}"; |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 | 424 |
| 425 } // namespace trace_event | 425 } // namespace trace_event |
| 426 } // namespace base | 426 } // namespace base |
| OLD | NEW |