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

Side by Side Diff: base/trace_event/trace_event_argument.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 4 years, 12 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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_argument.h" 5 #include "base/trace_event/trace_event_argument.h"
6 6
7 #include <stdint.h>
8
7 #include <utility> 9 #include <utility>
8 10
9 #include "base/bits.h" 11 #include "base/bits.h"
10 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
11 #include "base/trace_event/trace_event_memory_overhead.h" 13 #include "base/trace_event/trace_event_memory_overhead.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 15
14 namespace base { 16 namespace base {
15 namespace trace_event { 17 namespace trace_event {
16 18
(...skipping 17 matching lines...) Expand all
34 #define DEBUG_POP_CONTAINER() nesting_stack_.pop_back() 36 #define DEBUG_POP_CONTAINER() nesting_stack_.pop_back()
35 #else 37 #else
36 #define DCHECK_CURRENT_CONTAINER_IS(x) do {} while (0) 38 #define DCHECK_CURRENT_CONTAINER_IS(x) do {} while (0)
37 #define DCHECK_CONTAINER_STACK_DEPTH_EQ(x) do {} while (0) 39 #define DCHECK_CONTAINER_STACK_DEPTH_EQ(x) do {} while (0)
38 #define DEBUG_PUSH_CONTAINER(x) do {} while (0) 40 #define DEBUG_PUSH_CONTAINER(x) do {} while (0)
39 #define DEBUG_POP_CONTAINER() do {} while (0) 41 #define DEBUG_POP_CONTAINER() do {} while (0)
40 #endif 42 #endif
41 43
42 inline void WriteKeyNameAsRawPtr(Pickle& pickle, const char* ptr) { 44 inline void WriteKeyNameAsRawPtr(Pickle& pickle, const char* ptr) {
43 pickle.WriteBytes(&kTypeCStr, 1); 45 pickle.WriteBytes(&kTypeCStr, 1);
44 pickle.WriteUInt64(static_cast<uint64>(reinterpret_cast<uintptr_t>(ptr))); 46 pickle.WriteUInt64(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr)));
45 } 47 }
46 48
47 inline void WriteKeyNameWithCopy(Pickle& pickle, base::StringPiece str) { 49 inline void WriteKeyNameWithCopy(Pickle& pickle, base::StringPiece str) {
48 pickle.WriteBytes(&kTypeString, 1); 50 pickle.WriteBytes(&kTypeString, 1);
49 pickle.WriteString(str); 51 pickle.WriteString(str);
50 } 52 }
51 53
52 std::string ReadKeyName(PickleIterator& pickle_iterator) { 54 std::string ReadKeyName(PickleIterator& pickle_iterator) {
53 const char* type = nullptr; 55 const char* type = nullptr;
54 bool res = pickle_iterator.ReadBytes(&type, 1); 56 bool res = pickle_iterator.ReadBytes(&type, 1);
55 std::string key_name; 57 std::string key_name;
56 if (res && *type == kTypeCStr) { 58 if (res && *type == kTypeCStr) {
57 uint64 ptr_value = 0; 59 uint64_t ptr_value = 0;
58 res = pickle_iterator.ReadUInt64(&ptr_value); 60 res = pickle_iterator.ReadUInt64(&ptr_value);
59 key_name = reinterpret_cast<const char*>(static_cast<uintptr_t>(ptr_value)); 61 key_name = reinterpret_cast<const char*>(static_cast<uintptr_t>(ptr_value));
60 } else if (res && *type == kTypeString) { 62 } else if (res && *type == kTypeString) {
61 res = pickle_iterator.ReadString(&key_name); 63 res = pickle_iterator.ReadString(&key_name);
62 } 64 }
63 DCHECK(res); 65 DCHECK(res);
64 return key_name; 66 return key_name;
65 } 67 }
66 } // namespace 68 } // namespace
67 69
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 465
464 /* allocated size */ 466 /* allocated size */
465 bits::Align(pickle_.GetTotalAllocatedSize(), kPickleHeapAlign), 467 bits::Align(pickle_.GetTotalAllocatedSize(), kPickleHeapAlign),
466 468
467 /* resident size */ 469 /* resident size */
468 bits::Align(pickle_.size(), kPickleHeapAlign)); 470 bits::Align(pickle_.size(), kPickleHeapAlign));
469 } 471 }
470 472
471 } // namespace trace_event 473 } // namespace trace_event
472 } // namespace base 474 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_argument.h ('k') | base/trace_event/trace_event_argument_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698