From bd1ed0533f99d31ffc69481840e6771db6a00ac6 Mon Sep 17 00:00:00 2001 From: avi Date: Wed, 23 Dec 2015 20:03:44 -0800 Subject: [PATCH] Switch to standard integer types in base/trace_event/. BUG=138542 TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1546033002 Cr-Commit-Position: refs/heads/master@{#366798} --- .../heap_profiler_allocation_context.h | 1 + ...ler_allocation_context_tracker_unittest.cc | 2 ++ .../heap_profiler_allocation_register.h | 1 + ...heap_profiler_allocation_register_posix.cc | 2 +- ...p_profiler_allocation_register_unittest.cc | 3 ++ .../heap_profiler_allocation_register_win.cc | 1 + .../heap_profiler_heap_dump_writer.cc | 3 ++ .../heap_profiler_heap_dump_writer.h | 2 ++ ...heap_profiler_heap_dump_writer_unittest.cc | 2 ++ .../heap_profiler_stack_frame_deduplicator.cc | 2 ++ .../heap_profiler_type_name_deduplicator.cc | 1 + .../java_heap_dump_provider_android.h | 1 + base/trace_event/malloc_dump_provider.cc | 9 ++++-- base/trace_event/memory_allocator_dump.cc | 2 +- base/trace_event/memory_allocator_dump.h | 6 ++-- .../trace_event/memory_allocator_dump_guid.cc | 7 ++--- base/trace_event/memory_allocator_dump_guid.h | 9 +++--- .../memory_allocator_dump_unittest.cc | 5 +++- base/trace_event/memory_dump_manager.h | 3 ++ .../memory_dump_manager_unittest.cc | 10 ++++--- base/trace_event/process_memory_dump.cc | 1 + base/trace_event/process_memory_dump.h | 4 +++ .../process_memory_dump_unittest.cc | 2 ++ base/trace_event/process_memory_maps.cc | 6 ++-- base/trace_event/process_memory_maps.h | 28 ++++++++++--------- .../process_memory_maps_dump_provider.cc | 26 +++++++++-------- .../process_memory_maps_dump_provider.h | 2 ++ ...cess_memory_maps_dump_provider_unittest.cc | 8 ++++-- base/trace_event/process_memory_totals.h | 4 ++- .../process_memory_totals_dump_provider.cc | 13 +++++---- .../process_memory_totals_dump_provider.h | 5 +++- ...ss_memory_totals_dump_provider_unittest.cc | 8 ++++-- base/trace_event/trace_buffer.cc | 9 +++--- base/trace_event/trace_buffer.h | 11 +++++--- base/trace_event/trace_config.cc | 4 ++- base/trace_event/trace_config.h | 4 ++- base/trace_event/trace_config_unittest.cc | 3 ++ base/trace_event/trace_event.h | 8 ++++-- base/trace_event/trace_event_android.cc | 6 ++-- base/trace_event/trace_event_argument.cc | 6 ++-- base/trace_event/trace_event_argument.h | 3 ++ .../trace_event_argument_unittest.cc | 2 ++ .../trace_event/trace_event_etw_export_win.cc | 6 ++-- base/trace_event/trace_event_etw_export_win.h | 5 +++- base/trace_event/trace_event_impl.cc | 24 ++++++++-------- base/trace_event/trace_event_impl.h | 6 +++- .../trace_event/trace_event_memory_overhead.h | 3 ++ .../trace_event_synthetic_delay.cc | 1 + .../trace_event/trace_event_synthetic_delay.h | 1 + .../trace_event_synthetic_delay_unittest.cc | 9 ++++-- .../trace_event_system_stats_monitor.cc | 1 + .../trace_event_system_stats_monitor.h | 1 + ...ace_event_system_stats_monitor_unittest.cc | 2 ++ base/trace_event/trace_event_unittest.cc | 6 +++- base/trace_event/trace_log.cc | 12 ++++---- base/trace_event/trace_log.h | 7 ++++- base/trace_event/trace_sampling_thread.cc | 4 ++- base/trace_event/winheap_dump_provider_win.h | 3 ++ 58 files changed, 224 insertions(+), 102 deletions(-) diff --git a/base/trace_event/heap_profiler_allocation_context.h b/base/trace_event/heap_profiler_allocation_context.h index a7f1e9dca9031a..8544c78eb2cd34 100644 --- a/base/trace_event/heap_profiler_allocation_context.h +++ b/base/trace_event/heap_profiler_allocation_context.h @@ -5,6 +5,7 @@ #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_H_ +#include #include #include "base/base_export.h" diff --git a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc index 130a9279534a14..58255ad788ae3d 100644 --- a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc +++ b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include #include "base/memory/ref_counted.h" diff --git a/base/trace_event/heap_profiler_allocation_register.h b/base/trace_event/heap_profiler_allocation_register.h index 940fb5454bef31..b8afa6b8ed65f7 100644 --- a/base/trace_event/heap_profiler_allocation_register.h +++ b/base/trace_event/heap_profiler_allocation_register.h @@ -5,6 +5,7 @@ #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_ #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_ +#include #include #include "base/logging.h" diff --git a/base/trace_event/heap_profiler_allocation_register_posix.cc b/base/trace_event/heap_profiler_allocation_register_posix.cc index bc175e44987570..c38d7e69182b9a 100644 --- a/base/trace_event/heap_profiler_allocation_register_posix.cc +++ b/base/trace_event/heap_profiler_allocation_register_posix.cc @@ -4,10 +4,10 @@ #include "base/trace_event/heap_profiler_allocation_register.h" +#include #include #include -#include "base/basictypes.h" #include "base/bits.h" #include "base/logging.h" #include "base/process/process_metrics.h" diff --git a/base/trace_event/heap_profiler_allocation_register_unittest.cc b/base/trace_event/heap_profiler_allocation_register_unittest.cc index e6447fce3d7f82..b74f052d6511d9 100644 --- a/base/trace_event/heap_profiler_allocation_register_unittest.cc +++ b/base/trace_event/heap_profiler_allocation_register_unittest.cc @@ -4,6 +4,9 @@ #include "base/trace_event/heap_profiler_allocation_register.h" +#include +#include + #include "base/process/process_metrics.h" #include "base/trace_event/heap_profiler_allocation_context.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/trace_event/heap_profiler_allocation_register_win.cc b/base/trace_event/heap_profiler_allocation_register_win.cc index 5bcac63fc2a3eb..bc0afbf340199c 100644 --- a/base/trace_event/heap_profiler_allocation_register_win.cc +++ b/base/trace_event/heap_profiler_allocation_register_win.cc @@ -5,6 +5,7 @@ #include "base/trace_event/heap_profiler_allocation_register.h" #include +#include #include "base/bits.h" #include "base/logging.h" diff --git a/base/trace_event/heap_profiler_heap_dump_writer.cc b/base/trace_event/heap_profiler_heap_dump_writer.cc index e37c540cc22fd7..d14f8c471534c2 100644 --- a/base/trace_event/heap_profiler_heap_dump_writer.cc +++ b/base/trace_event/heap_profiler_heap_dump_writer.cc @@ -4,6 +4,8 @@ #include "base/trace_event/heap_profiler_heap_dump_writer.h" +#include + #include #include #include @@ -12,6 +14,7 @@ #include "base/format_macros.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/stringprintf.h" #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" #include "base/trace_event/heap_profiler_type_name_deduplicator.h" diff --git a/base/trace_event/heap_profiler_heap_dump_writer.h b/base/trace_event/heap_profiler_heap_dump_writer.h index 71377cc5443938..41f5488e35896c 100644 --- a/base/trace_event/heap_profiler_heap_dump_writer.h +++ b/base/trace_event/heap_profiler_heap_dump_writer.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_HEAP_DUMP_WRITER_H_ #define BASE_TRACE_EVENT_HEAP_PROFILER_HEAP_DUMP_WRITER_H_ +#include + #include #include "base/base_export.h" diff --git a/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc b/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc index ba632da6ad6a03..2b94b5e4426bc0 100644 --- a/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc +++ b/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include #include diff --git a/base/trace_event/heap_profiler_stack_frame_deduplicator.cc b/base/trace_event/heap_profiler_stack_frame_deduplicator.cc index e61442be70d102..cf3d1987979282 100644 --- a/base/trace_event/heap_profiler_stack_frame_deduplicator.cc +++ b/base/trace_event/heap_profiler_stack_frame_deduplicator.cc @@ -4,6 +4,8 @@ #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" +#include + #include #include diff --git a/base/trace_event/heap_profiler_type_name_deduplicator.cc b/base/trace_event/heap_profiler_type_name_deduplicator.cc index 17c3ceee67261a..e7f57c8ae0ebd8 100644 --- a/base/trace_event/heap_profiler_type_name_deduplicator.cc +++ b/base/trace_event/heap_profiler_type_name_deduplicator.cc @@ -4,6 +4,7 @@ #include "base/trace_event/heap_profiler_type_name_deduplicator.h" +#include #include #include #include diff --git a/base/trace_event/java_heap_dump_provider_android.h b/base/trace_event/java_heap_dump_provider_android.h index e69c28102ad909..b9f2333089c491 100644 --- a/base/trace_event/java_heap_dump_provider_android.h +++ b/base/trace_event/java_heap_dump_provider_android.h @@ -5,6 +5,7 @@ #ifndef BASE_TRACE_EVENT_JAVA_HEAP_DUMP_PROVIDER_ANDROID_H_ #define BASE_TRACE_EVENT_JAVA_HEAP_DUMP_PROVIDER_ANDROID_H_ +#include "base/macros.h" #include "base/memory/singleton.h" #include "base/trace_event/memory_dump_provider.h" diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc index 7f4ac5a125dee3..6f9aa9602f7334 100644 --- a/base/trace_event/malloc_dump_provider.cc +++ b/base/trace_event/malloc_dump_provider.cc @@ -4,15 +4,18 @@ #include "base/trace_event/malloc_dump_provider.h" +#include + +#include "base/allocator/allocator_extension.h" +#include "base/trace_event/process_memory_dump.h" +#include "build/build_config.h" + #if defined(OS_MACOSX) #include #else #include #endif -#include "base/allocator/allocator_extension.h" -#include "base/trace_event/process_memory_dump.h" - namespace base { namespace trace_event { diff --git a/base/trace_event/memory_allocator_dump.cc b/base/trace_event/memory_allocator_dump.cc index 703fc65befb8c8..5c5af7ee45842e 100644 --- a/base/trace_event/memory_allocator_dump.cc +++ b/base/trace_event/memory_allocator_dump.cc @@ -57,7 +57,7 @@ MemoryAllocatorDump::~MemoryAllocatorDump() { void MemoryAllocatorDump::AddScalar(const char* name, const char* units, - uint64 value) { + uint64_t value) { SStringPrintf(&string_conversion_buffer_, "%" PRIx64, value); attributes_->BeginDictionary(name); attributes_->SetString("type", kTypeScalar); diff --git a/base/trace_event/memory_allocator_dump.h b/base/trace_event/memory_allocator_dump.h index 6ad3d64110e241..6c514fa6a62380 100644 --- a/base/trace_event/memory_allocator_dump.h +++ b/base/trace_event/memory_allocator_dump.h @@ -5,11 +5,13 @@ #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ +#include + #include #include "base/base_export.h" -#include "base/basictypes.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/trace_event/memory_allocator_dump_guid.h" #include "base/values.h" @@ -51,7 +53,7 @@ class BASE_EXPORT MemoryAllocatorDump { // AddScalar("number_of_freelist_entires", kUnitsObjects, 42) // - Other informational column (will not be auto-added in the UI) // AddScalarF("kittens_ratio", "ratio", 42.0f) - void AddScalar(const char* name, const char* units, uint64 value); + void AddScalar(const char* name, const char* units, uint64_t value); void AddScalarF(const char* name, const char* units, double value); void AddString(const char* name, const char* units, const std::string& value); diff --git a/base/trace_event/memory_allocator_dump_guid.cc b/base/trace_event/memory_allocator_dump_guid.cc index d4ed900b9febcd..bf4389a4c759f5 100644 --- a/base/trace_event/memory_allocator_dump_guid.cc +++ b/base/trace_event/memory_allocator_dump_guid.cc @@ -12,16 +12,15 @@ namespace base { namespace trace_event { namespace { -uint64 HashString(const std::string& str) { - uint64 hash[(kSHA1Length + sizeof(uint64) - 1) / sizeof(uint64)] = { 0 }; +uint64_t HashString(const std::string& str) { + uint64_t hash[(kSHA1Length + sizeof(uint64_t) - 1) / sizeof(uint64_t)] = {0}; SHA1HashBytes(reinterpret_cast(str.data()), str.size(), reinterpret_cast(hash)); return hash[0]; } } // namespace -MemoryAllocatorDumpGuid::MemoryAllocatorDumpGuid(uint64 guid) : guid_(guid) { -} +MemoryAllocatorDumpGuid::MemoryAllocatorDumpGuid(uint64_t guid) : guid_(guid) {} MemoryAllocatorDumpGuid::MemoryAllocatorDumpGuid() : MemoryAllocatorDumpGuid(0u) { diff --git a/base/trace_event/memory_allocator_dump_guid.h b/base/trace_event/memory_allocator_dump_guid.h index 634ca8133b5320..b6472c66129bda 100644 --- a/base/trace_event/memory_allocator_dump_guid.h +++ b/base/trace_event/memory_allocator_dump_guid.h @@ -5,10 +5,11 @@ #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_GUID_H_ +#include + #include #include "base/base_export.h" -#include "base/basictypes.h" namespace base { namespace trace_event { @@ -16,14 +17,14 @@ namespace trace_event { class BASE_EXPORT MemoryAllocatorDumpGuid { public: MemoryAllocatorDumpGuid(); - explicit MemoryAllocatorDumpGuid(uint64 guid); + explicit MemoryAllocatorDumpGuid(uint64_t guid); // Utility ctor to hash a GUID if the caller prefers a string. The caller // still has to ensure that |guid_str| is unique, per snapshot, within the // global scope of all the traced processes. explicit MemoryAllocatorDumpGuid(const std::string& guid_str); - uint64 ToUint64() const { return guid_; } + uint64_t ToUint64() const { return guid_; } // Returns a (hex-encoded) string representation of the guid. std::string ToString() const; @@ -39,7 +40,7 @@ class BASE_EXPORT MemoryAllocatorDumpGuid { } private: - uint64 guid_; + uint64_t guid_; // Deliberately copy-able. }; diff --git a/base/trace_event/memory_allocator_dump_unittest.cc b/base/trace_event/memory_allocator_dump_unittest.cc index 124de0def2e724..d1cfe91a4f1ee3 100644 --- a/base/trace_event/memory_allocator_dump_unittest.cc +++ b/base/trace_event/memory_allocator_dump_unittest.cc @@ -4,6 +4,8 @@ #include "base/trace_event/memory_allocator_dump.h" +#include + #include "base/format_macros.h" #include "base/strings/stringprintf.h" #include "base/trace_event/memory_allocator_dump_guid.h" @@ -12,6 +14,7 @@ #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/trace_event_argument.h" #include "base/values.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -82,7 +85,7 @@ void CheckString(const MemoryAllocatorDump* dump, void CheckScalar(const MemoryAllocatorDump* dump, const std::string& name, const char* expected_units, - uint64 expected_value) { + uint64_t expected_value) { CheckString(dump, name, MemoryAllocatorDump::kTypeScalar, expected_units, StringPrintf("%" PRIx64, expected_value)); } diff --git a/base/trace_event/memory_dump_manager.h b/base/trace_event/memory_dump_manager.h index 539141158c6570..f9774634ad037c 100644 --- a/base/trace_event/memory_dump_manager.h +++ b/base/trace_event/memory_dump_manager.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ +#include + #include #include #include @@ -12,6 +14,7 @@ #include "base/atomicops.h" #include "base/containers/hash_tables.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" #include "base/synchronization/lock.h" diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc index cf0f30574d2544..898f003807eb92 100644 --- a/base/trace_event/memory_dump_manager_unittest.cc +++ b/base/trace_event/memory_dump_manager_unittest.cc @@ -4,6 +4,8 @@ #include "base/trace_event/memory_dump_manager.h" +#include + #include #include "base/bind_helpers.h" @@ -83,7 +85,7 @@ class MemoryDumpManagerDelegateForTesting : public MemoryDumpManagerDelegate { void(const MemoryDumpRequestArgs& args, const MemoryDumpCallback& callback)); - uint64 GetTracingProcessId() const override { + uint64_t GetTracingProcessId() const override { NOTREACHED(); return MemoryDumpManager::kInvalidTracingProcessId; } @@ -120,7 +122,7 @@ class MemoryDumpManagerTest : public testing::Test { // result and taking care of posting the closure on the correct task runner. void DumpCallbackAdapter(scoped_refptr task_runner, Closure closure, - uint64 dump_guid, + uint64_t dump_guid, bool success) { last_callback_success_ = success; task_runner->PostTask(FROM_HERE, closure); @@ -373,7 +375,7 @@ TEST_F(MemoryDumpManagerTest, RegistrationConsistency) { // iteration, one thread is removed, to check the live unregistration logic. TEST_F(MemoryDumpManagerTest, RespectTaskRunnerAffinity) { InitializeMemoryDumpManager(false /* is_coordinator */); - const uint32 kNumInitialThreads = 8; + const uint32_t kNumInitialThreads = 8; std::vector> threads; std::vector> mdps; @@ -381,7 +383,7 @@ TEST_F(MemoryDumpManagerTest, RespectTaskRunnerAffinity) { // Create the threads and setup the expectations. Given that at each iteration // we will pop out one thread/MemoryDumpProvider, each MDP is supposed to be // invoked a number of times equal to its index. - for (uint32 i = kNumInitialThreads; i > 0; --i) { + for (uint32_t i = kNumInitialThreads; i > 0; --i) { threads.push_back(make_scoped_ptr(new Thread("test thread"))); auto thread = threads.back().get(); thread->Start(); diff --git a/base/trace_event/process_memory_dump.cc b/base/trace_event/process_memory_dump.cc index 15106729096bef..ae60bb06b15263 100644 --- a/base/trace_event/process_memory_dump.cc +++ b/base/trace_event/process_memory_dump.cc @@ -10,6 +10,7 @@ #include "base/process/process_metrics.h" #include "base/trace_event/process_memory_totals.h" #include "base/trace_event/trace_event_argument.h" +#include "build/build_config.h" #if defined(OS_POSIX) #include diff --git a/base/trace_event/process_memory_dump.h b/base/trace_event/process_memory_dump.h index a997c691da24ac..5a664028817078 100644 --- a/base/trace_event/process_memory_dump.h +++ b/base/trace_event/process_memory_dump.h @@ -5,11 +5,14 @@ #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ +#include + #include #include "base/base_export.h" #include "base/containers/hash_tables.h" #include "base/containers/small_map.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_vector.h" #include "base/trace_event/memory_allocator_dump.h" @@ -17,6 +20,7 @@ #include "base/trace_event/memory_dump_session_state.h" #include "base/trace_event/process_memory_maps.h" #include "base/trace_event/process_memory_totals.h" +#include "build/build_config.h" // Define COUNT_RESIDENT_BYTES_SUPPORTED if platform supports counting of the // resident memory. diff --git a/base/trace_event/process_memory_dump_unittest.cc b/base/trace_event/process_memory_dump_unittest.cc index 132bb475bd3a10..88984abd34d6fa 100644 --- a/base/trace_event/process_memory_dump_unittest.cc +++ b/base/trace_event/process_memory_dump_unittest.cc @@ -4,6 +4,8 @@ #include "base/trace_event/process_memory_dump.h" +#include + #include "base/memory/aligned_memory.h" #include "base/process/process_metrics.h" #include "base/trace_event/memory_allocator_dump_guid.h" diff --git a/base/trace_event/process_memory_maps.cc b/base/trace_event/process_memory_maps.cc index bb400de1743c85..31083a892773ad 100644 --- a/base/trace_event/process_memory_maps.cc +++ b/base/trace_event/process_memory_maps.cc @@ -12,9 +12,9 @@ namespace base { namespace trace_event { // static -const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4; -const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2; -const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1; +const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4; +const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2; +const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1; ProcessMemoryMaps::VMRegion::VMRegion() : start_address(0), diff --git a/base/trace_event/process_memory_maps.h b/base/trace_event/process_memory_maps.h index b06a85037a57a2..3dfcc0c988beaf 100644 --- a/base/trace_event/process_memory_maps.h +++ b/base/trace_event/process_memory_maps.h @@ -5,11 +5,13 @@ #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ #define BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ +#include + #include #include #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" namespace base { namespace trace_event { @@ -20,28 +22,28 @@ class TracedValue; class BASE_EXPORT ProcessMemoryMaps { public: struct BASE_EXPORT VMRegion { - static const uint32 kProtectionFlagsRead; - static const uint32 kProtectionFlagsWrite; - static const uint32 kProtectionFlagsExec; + static const uint32_t kProtectionFlagsRead; + static const uint32_t kProtectionFlagsWrite; + static const uint32_t kProtectionFlagsExec; VMRegion(); - uint64 start_address; - uint64 size_in_bytes; - uint32 protection_flags; + uint64_t start_address; + uint64_t size_in_bytes; + uint32_t protection_flags; std::string mapped_file; // private_dirty_resident + private_clean_resident + shared_dirty_resident + // shared_clean_resident = resident set size. - uint64 byte_stats_private_dirty_resident; - uint64 byte_stats_private_clean_resident; - uint64 byte_stats_shared_dirty_resident; - uint64 byte_stats_shared_clean_resident; + uint64_t byte_stats_private_dirty_resident; + uint64_t byte_stats_private_clean_resident; + uint64_t byte_stats_shared_dirty_resident; + uint64_t byte_stats_shared_clean_resident; - uint64 byte_stats_swapped; + uint64_t byte_stats_swapped; // For multiprocess accounting. - uint64 byte_stats_proportional_resident; + uint64_t byte_stats_proportional_resident; }; ProcessMemoryMaps(); diff --git a/base/trace_event/process_memory_maps_dump_provider.cc b/base/trace_event/process_memory_maps_dump_provider.cc index 19f8d891618c10..4c3959fe9be57f 100644 --- a/base/trace_event/process_memory_maps_dump_provider.cc +++ b/base/trace_event/process_memory_maps_dump_provider.cc @@ -4,6 +4,8 @@ #include "base/trace_event/process_memory_maps_dump_provider.h" +#include + #include "base/files/scoped_file.h" #include "base/format_macros.h" #include "base/logging.h" @@ -19,13 +21,13 @@ FILE* ProcessMemoryMapsDumpProvider::proc_smaps_for_testing = nullptr; namespace { -const uint32 kMaxLineSize = 4096; +const uint32_t kMaxLineSize = 4096; bool ParseSmapsHeader(const char* header_line, ProcessMemoryMaps::VMRegion* region) { // e.g., "00400000-00421000 r-xp 00000000 fc:01 1234 /foo.so\n" bool res = true; // Whether this region should be appended or skipped. - uint64 end_addr = 0; + uint64_t end_addr = 0; char protection_flags[5] = {0}; char mapped_file[kMaxLineSize]; @@ -62,17 +64,17 @@ bool ParseSmapsHeader(const char* header_line, return res; } -uint64 ReadCounterBytes(char* counter_line) { - uint64 counter_value = 0; +uint64_t ReadCounterBytes(char* counter_line) { + uint64_t counter_value = 0; int res = sscanf(counter_line, "%*s %" SCNu64 " kB", &counter_value); DCHECK_EQ(1, res); return counter_value * 1024; } -uint32 ParseSmapsCounter(char* counter_line, - ProcessMemoryMaps::VMRegion* region) { +uint32_t ParseSmapsCounter(char* counter_line, + ProcessMemoryMaps::VMRegion* region) { // A smaps counter lines looks as follows: "RSS: 0 Kb\n" - uint32 res = 1; + uint32_t res = 1; char counter_name[20]; int did_read = sscanf(counter_line, "%19[^\n ]", counter_name); DCHECK_EQ(1, did_read); @@ -96,16 +98,16 @@ uint32 ParseSmapsCounter(char* counter_line, return res; } -uint32 ReadLinuxProcSmapsFile(FILE* smaps_file, ProcessMemoryMaps* pmm) { +uint32_t ReadLinuxProcSmapsFile(FILE* smaps_file, ProcessMemoryMaps* pmm) { if (!smaps_file) return 0; fseek(smaps_file, 0, SEEK_SET); char line[kMaxLineSize]; - const uint32 kNumExpectedCountersPerRegion = 6; - uint32 counters_parsed_for_current_region = 0; - uint32 num_valid_regions = 0; + const uint32_t kNumExpectedCountersPerRegion = 6; + uint32_t counters_parsed_for_current_region = 0; + uint32_t num_valid_regions = 0; ProcessMemoryMaps::VMRegion region; bool should_add_current_region = false; for (;;) { @@ -155,7 +157,7 @@ bool ProcessMemoryMapsDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, if (args.level_of_detail == MemoryDumpLevelOfDetail::LIGHT) return true; - uint32 res = 0; + uint32_t res = 0; if (UNLIKELY(proc_smaps_for_testing)) { res = ReadLinuxProcSmapsFile(proc_smaps_for_testing, pmd->process_mmaps()); } else { diff --git a/base/trace_event/process_memory_maps_dump_provider.h b/base/trace_event/process_memory_maps_dump_provider.h index f302a48dd7da18..84badfe9a06070 100644 --- a/base/trace_event/process_memory_maps_dump_provider.h +++ b/base/trace_event/process_memory_maps_dump_provider.h @@ -6,8 +6,10 @@ #define BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_ #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/singleton.h" #include "base/trace_event/memory_dump_provider.h" +#include "build/build_config.h" namespace base { namespace trace_event { diff --git a/base/trace_event/process_memory_maps_dump_provider_unittest.cc b/base/trace_event/process_memory_maps_dump_provider_unittest.cc index cce33eba369b96..624f96fcb0a185 100644 --- a/base/trace_event/process_memory_maps_dump_provider_unittest.cc +++ b/base/trace_event/process_memory_maps_dump_provider_unittest.cc @@ -4,6 +4,8 @@ #include "base/trace_event/process_memory_maps_dump_provider.h" +#include + #include "base/files/file_util.h" #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/process_memory_maps.h" @@ -116,9 +118,9 @@ void CreateAndSetSmapsFileForTesting(const char* smaps_string, } // namespace TEST(ProcessMemoryMapsDumpProviderTest, ParseProcSmaps) { - const uint32 kProtR = ProcessMemoryMaps::VMRegion::kProtectionFlagsRead; - const uint32 kProtW = ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite; - const uint32 kProtX = ProcessMemoryMaps::VMRegion::kProtectionFlagsExec; + const uint32_t kProtR = ProcessMemoryMaps::VMRegion::kProtectionFlagsRead; + const uint32_t kProtW = ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite; + const uint32_t kProtX = ProcessMemoryMaps::VMRegion::kProtectionFlagsExec; const MemoryDumpArgs dump_args = {MemoryDumpLevelOfDetail::DETAILED}; auto pmmdp = ProcessMemoryMapsDumpProvider::GetInstance(); diff --git a/base/trace_event/process_memory_totals.h b/base/trace_event/process_memory_totals.h index eb7757c91b89fe..329967a6ee74cb 100644 --- a/base/trace_event/process_memory_totals.h +++ b/base/trace_event/process_memory_totals.h @@ -5,10 +5,12 @@ #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_H_ #define BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_H_ +#include + #include #include "base/base_export.h" -#include "base/basictypes.h" +#include "base/macros.h" namespace base { namespace trace_event { diff --git a/base/trace_event/process_memory_totals_dump_provider.cc b/base/trace_event/process_memory_totals_dump_provider.cc index 83015f8e5098eb..1713ebf0bc99ed 100644 --- a/base/trace_event/process_memory_totals_dump_provider.cc +++ b/base/trace_event/process_memory_totals_dump_provider.cc @@ -4,9 +4,12 @@ #include "base/trace_event/process_memory_totals_dump_provider.h" +#include + #include "base/process/process_metrics.h" #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/process_memory_totals.h" +#include "build/build_config.h" #if defined(OS_LINUX) || defined(OS_ANDROID) #include @@ -23,7 +26,7 @@ namespace base { namespace trace_event { // static -uint64 ProcessMemoryTotalsDumpProvider::rss_bytes_for_testing = 0; +uint64_t ProcessMemoryTotalsDumpProvider::rss_bytes_for_testing = 0; // static ProcessMemoryTotalsDumpProvider* @@ -43,11 +46,11 @@ ProcessMemoryTotalsDumpProvider::~ProcessMemoryTotalsDumpProvider() { // the current process. bool ProcessMemoryTotalsDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, ProcessMemoryDump* pmd) { - const uint64 rss_bytes = rss_bytes_for_testing - ? rss_bytes_for_testing - : process_metrics_->GetWorkingSetSize(); + const uint64_t rss_bytes = rss_bytes_for_testing + ? rss_bytes_for_testing + : process_metrics_->GetWorkingSetSize(); - uint64 peak_rss_bytes = 0; + uint64_t peak_rss_bytes = 0; #if !defined(OS_IOS) peak_rss_bytes = process_metrics_->GetPeakWorkingSetSize(); diff --git a/base/trace_event/process_memory_totals_dump_provider.h b/base/trace_event/process_memory_totals_dump_provider.h index 66d4f9956dd5b9..d9573d31e1ba96 100644 --- a/base/trace_event/process_memory_totals_dump_provider.h +++ b/base/trace_event/process_memory_totals_dump_provider.h @@ -5,7 +5,10 @@ #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_DUMP_PROVIDER_H_ #define BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_DUMP_PROVIDER_H_ +#include + #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/trace_event/memory_dump_provider.h" @@ -29,7 +32,7 @@ class BASE_EXPORT ProcessMemoryTotalsDumpProvider : public MemoryDumpProvider { friend struct DefaultSingletonTraits; FRIEND_TEST_ALL_PREFIXES(ProcessMemoryTotalsDumpProviderTest, DumpRSS); - static uint64 rss_bytes_for_testing; + static uint64_t rss_bytes_for_testing; ProcessMemoryTotalsDumpProvider(); ~ProcessMemoryTotalsDumpProvider() override; diff --git a/base/trace_event/process_memory_totals_dump_provider_unittest.cc b/base/trace_event/process_memory_totals_dump_provider_unittest.cc index 4ec37f57653f85..d3f517e2836748 100644 --- a/base/trace_event/process_memory_totals_dump_provider_unittest.cc +++ b/base/trace_event/process_memory_totals_dump_provider_unittest.cc @@ -4,6 +4,9 @@ #include "base/trace_event/process_memory_totals_dump_provider.h" +#include +#include + #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/process_memory_totals.h" #include "testing/gtest/include/gtest/gtest.h" @@ -31,8 +34,9 @@ TEST(ProcessMemoryTotalsDumpProviderTest, DumpRSS) { ASSERT_TRUE(pmd_before->has_process_totals()); ASSERT_TRUE(pmd_after->has_process_totals()); - const uint64 rss_before = pmd_before->process_totals()->resident_set_bytes(); - const uint64 rss_after = pmd_after->process_totals()->resident_set_bytes(); + const uint64_t rss_before = + pmd_before->process_totals()->resident_set_bytes(); + const uint64_t rss_after = pmd_after->process_totals()->resident_set_bytes(); EXPECT_NE(0U, rss_before); EXPECT_NE(0U, rss_after); diff --git a/base/trace_event/trace_buffer.cc b/base/trace_event/trace_buffer.cc index 5d8a9bfa15bdcd..e96699f69df21f 100644 --- a/base/trace_event/trace_buffer.cc +++ b/base/trace_event/trace_buffer.cc @@ -7,6 +7,7 @@ #include #include +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/trace_event/trace_event_impl.h" @@ -191,7 +192,7 @@ class TraceBufferRingBuffer : public TraceBuffer { size_t queue_tail_; size_t current_iteration_index_; - uint32 current_chunk_seq_; + uint32_t current_chunk_seq_; DISALLOW_COPY_AND_ASSIGN(TraceBufferRingBuffer); }; @@ -215,7 +216,7 @@ class TraceBufferVector : public TraceBuffer { ++in_flight_chunk_count_; // + 1 because zero chunk_seq is not allowed. return scoped_ptr( - new TraceBufferChunk(static_cast(*index) + 1)); + new TraceBufferChunk(static_cast(*index) + 1)); } void ReturnChunk(size_t index, scoped_ptr chunk) override { @@ -289,11 +290,11 @@ class TraceBufferVector : public TraceBuffer { } // namespace -TraceBufferChunk::TraceBufferChunk(uint32 seq) : next_free_(0), seq_(seq) {} +TraceBufferChunk::TraceBufferChunk(uint32_t seq) : next_free_(0), seq_(seq) {} TraceBufferChunk::~TraceBufferChunk() {} -void TraceBufferChunk::Reset(uint32 new_seq) { +void TraceBufferChunk::Reset(uint32_t new_seq) { for (size_t i = 0; i < next_free_; ++i) chunk_[i].Reset(); next_free_ = 0; diff --git a/base/trace_event/trace_buffer.h b/base/trace_event/trace_buffer.h index d54bd74bec53ed..a7b80595b544d0 100644 --- a/base/trace_event/trace_buffer.h +++ b/base/trace_event/trace_buffer.h @@ -5,6 +5,9 @@ #ifndef BASE_TRACE_EVENT_TRACE_BUFFER_H_ #define BASE_TRACE_EVENT_TRACE_BUFFER_H_ +#include +#include + #include "base/base_export.h" #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_impl.h" @@ -16,14 +19,14 @@ namespace trace_event { // TraceBufferChunk is the basic unit of TraceBuffer. class BASE_EXPORT TraceBufferChunk { public: - explicit TraceBufferChunk(uint32 seq); + explicit TraceBufferChunk(uint32_t seq); ~TraceBufferChunk(); - void Reset(uint32 new_seq); + void Reset(uint32_t new_seq); TraceEvent* AddTraceEvent(size_t* event_index); bool IsFull() const { return next_free_ == kTraceBufferChunkSize; } - uint32 seq() const { return seq_; } + uint32_t seq() const { return seq_; } size_t capacity() const { return kTraceBufferChunkSize; } size_t size() const { return next_free_; } @@ -50,7 +53,7 @@ class BASE_EXPORT TraceBufferChunk { size_t next_free_; scoped_ptr cached_overhead_estimate_; TraceEvent chunk_[kTraceBufferChunkSize]; - uint32 seq_; + uint32_t seq_; }; // TraceBuffer holds the events as they are collected. diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc index 8d2c909bf8933a..8e11078ebc7684 100644 --- a/base/trace_event/trace_config.cc +++ b/base/trace_event/trace_config.cc @@ -4,6 +4,8 @@ #include "base/trace_event/trace_config.h" +#include + #include #include "base/json/json_reader.h" @@ -497,7 +499,7 @@ void TraceConfig::SetMemoryDumpConfig( continue; } DCHECK_GT(interval, 0); - dump_config.periodic_interval_ms = static_cast(interval); + dump_config.periodic_interval_ms = static_cast(interval); std::string level_of_detail_str; trigger->GetString(kModeParam, &level_of_detail_str); dump_config.level_of_detail = diff --git a/base/trace_event/trace_config.h b/base/trace_event/trace_config.h index e7a1ab57e9a614..c7d3f4b379b7dc 100644 --- a/base/trace_event/trace_config.h +++ b/base/trace_event/trace_config.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_H_ #define BASE_TRACE_EVENT_TRACE_CONFIG_H_ +#include + #include #include @@ -41,7 +43,7 @@ class BASE_EXPORT TraceConfig { // Specifies the memory dump config for tracing. Used only when // "memory-infra" category is enabled. struct MemoryDumpTriggerConfig { - uint32 periodic_interval_ms; + uint32_t periodic_interval_ms; MemoryDumpLevelOfDetail level_of_detail; }; diff --git a/base/trace_event/trace_config_unittest.cc b/base/trace_event/trace_config_unittest.cc index 1d888912a93b83..bd378803292416 100644 --- a/base/trace_event/trace_config_unittest.cc +++ b/base/trace_event/trace_config_unittest.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + +#include "base/macros.h" #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/trace_config.h" #include "base/trace_event/trace_config_memory_test_util.h" diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h index afe4105c6c1d7c..cb3f36a589cdca 100644 --- a/base/trace_event/trace_event.h +++ b/base/trace_event/trace_event.h @@ -9,9 +9,13 @@ // trace_event_common.h collect and store trace events. Anything not // implementation-specific should go in trace_macros_common.h instead of here. +#include +#include + #include #include "base/atomicops.h" +#include "base/macros.h" #include "base/time/time.h" #include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/trace_event_system_stats_monitor.h" @@ -23,8 +27,8 @@ #define TRACE_STR_COPY(str) \ trace_event_internal::TraceStringWithCopy(str) -// By default, uint64 ID argument values are not mangled with the Process ID in -// TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. +// By default, uint64_t ID argument values are not mangled with the Process ID +// in TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. #define TRACE_ID_MANGLE(id) \ trace_event_internal::TraceID::ForceMangle(id) diff --git a/base/trace_event/trace_event_android.cc b/base/trace_event/trace_event_android.cc index 01ca8e4d55c797..83cac1c921c12c 100644 --- a/base/trace_event/trace_event_android.cc +++ b/base/trace_event/trace_event_android.cc @@ -5,6 +5,8 @@ #include "base/trace_event/trace_event_impl.h" #include +#include +#include #include "base/format_macros.h" #include "base/logging.h" @@ -48,7 +50,7 @@ void WriteEvent( unsigned int flags) { std::string out = StringPrintf("%c|%d|%s", phase, getpid(), name); if (flags & TRACE_EVENT_FLAG_HAS_ID) - StringAppendF(&out, "-%" PRIx64, static_cast(id)); + StringAppendF(&out, "-%" PRIx64, static_cast(id)); out += '|'; for (int i = 0; i < kTraceMaxNumArgs && arg_names[i]; @@ -177,7 +179,7 @@ void TraceEvent::SendToATrace() { std::string out = base::StringPrintf( "C|%d|%s-%s", getpid(), name_, arg_names_[i]); if (flags_ & TRACE_EVENT_FLAG_HAS_ID) - StringAppendF(&out, "-%" PRIx64, static_cast(id_)); + StringAppendF(&out, "-%" PRIx64, static_cast(id_)); StringAppendF(&out, "|%d|%s", static_cast(arg_values_[i].as_int), category_group); WriteToATrace(g_atrace_fd, out.c_str(), out.size()); diff --git a/base/trace_event/trace_event_argument.cc b/base/trace_event/trace_event_argument.cc index 72c68669108d65..6d787c80dad169 100644 --- a/base/trace_event/trace_event_argument.cc +++ b/base/trace_event/trace_event_argument.cc @@ -4,6 +4,8 @@ #include "base/trace_event/trace_event_argument.h" +#include + #include #include "base/bits.h" @@ -41,7 +43,7 @@ const bool kStackTypeArray = true; inline void WriteKeyNameAsRawPtr(Pickle& pickle, const char* ptr) { pickle.WriteBytes(&kTypeCStr, 1); - pickle.WriteUInt64(static_cast(reinterpret_cast(ptr))); + pickle.WriteUInt64(static_cast(reinterpret_cast(ptr))); } inline void WriteKeyNameWithCopy(Pickle& pickle, base::StringPiece str) { @@ -54,7 +56,7 @@ std::string ReadKeyName(PickleIterator& pickle_iterator) { bool res = pickle_iterator.ReadBytes(&type, 1); std::string key_name; if (res && *type == kTypeCStr) { - uint64 ptr_value = 0; + uint64_t ptr_value = 0; res = pickle_iterator.ReadUInt64(&ptr_value); key_name = reinterpret_cast(static_cast(ptr_value)); } else if (res && *type == kTypeString) { diff --git a/base/trace_event/trace_event_argument.h b/base/trace_event/trace_event_argument.h index dbdd67f9fcb124..a127b0d66d5629 100644 --- a/base/trace_event/trace_event_argument.h +++ b/base/trace_event/trace_event_argument.h @@ -5,9 +5,12 @@ #ifndef BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_ #define BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_ +#include + #include #include +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/pickle.h" #include "base/strings/string_piece.h" diff --git a/base/trace_event/trace_event_argument_unittest.cc b/base/trace_event/trace_event_argument_unittest.cc index c9ccdb47ce4dc7..82436ba1994de4 100644 --- a/base/trace_event/trace_event_argument_unittest.cc +++ b/base/trace_event/trace_event_argument_unittest.cc @@ -4,6 +4,8 @@ #include "base/trace_event/trace_event_argument.h" +#include + #include #include "base/values.h" diff --git a/base/trace_event/trace_event_etw_export_win.cc b/base/trace_event/trace_event_etw_export_win.cc index 934c6249751b11..c7de890756b11b 100644 --- a/base/trace_event/trace_event_etw_export_win.cc +++ b/base/trace_event/trace_event_etw_export_win.cc @@ -4,6 +4,8 @@ #include "base/trace_event/trace_event_etw_export_win.h" +#include + #include "base/command_line.h" #include "base/logging.h" #include "base/memory/singleton.h" @@ -90,8 +92,8 @@ const char* const kFilteredEventGroupNames[] = { const char kOtherEventsGroupName[] = "__OTHER_EVENTS"; // 0x2000000000000000 const char kDisabledOtherEventsGroupName[] = "__DISABLED_OTHER_EVENTS"; // 0x4000000000000000 -const uint64 kOtherEventsKeywordBit = 1ULL << 61; -const uint64 kDisabledOtherEventsKeywordBit = 1ULL << 62; +const uint64_t kOtherEventsKeywordBit = 1ULL << 61; +const uint64_t kDisabledOtherEventsKeywordBit = 1ULL << 62; const size_t kNumberOfCategories = ARRAYSIZE(kFilteredEventGroupNames) + 2U; } // namespace diff --git a/base/trace_event/trace_event_etw_export_win.h b/base/trace_event/trace_event_etw_export_win.h index 5c3ae60d6e2aa9..9201622a9c6e70 100644 --- a/base/trace_event/trace_event_etw_export_win.h +++ b/base/trace_event/trace_event_etw_export_win.h @@ -6,9 +6,12 @@ #ifndef BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ #define BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ +#include + #include #include "base/base_export.h" +#include "base/macros.h" #include "base/strings/string_piece.h" #include "base/trace_event/trace_event_impl.h" @@ -80,7 +83,7 @@ class BASE_EXPORT TraceEventETWExport { std::map categories_status_; // Local copy of the ETW keyword. - uint64 etw_match_any_keyword_; + uint64_t etw_match_any_keyword_; // Background thread that monitors changes to the ETW keyword and updates // the enabled categories when a change occurs. diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc index b7f0f24f33f48c..24d6568f90d780 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 + #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(value.as_uint)); + StringAppendF(out, "%" PRIu64, static_cast(value.as_uint)); break; case TRACE_VALUE_TYPE_INT: - StringAppendF(out, "%" PRId64, static_cast(value.as_int)); + StringAppendF(out, "%" PRId64, static_cast(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( - reinterpret_cast( - value.as_pointer))); + StringAppendF( + out, "\"0x%" PRIx64 "\"", + static_cast(reinterpret_cast(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(id_)); + StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"", static_cast(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(bind_id_)); + static_cast(bind_id_)); } if (flags_ & TRACE_EVENT_FLAG_FLOW_IN) StringAppendF(out, ",\"flow_in\":true"); diff --git a/base/trace_event/trace_event_impl.h b/base/trace_event/trace_event_impl.h index f6d4d4ee28d45a..36461e2b52f478 100644 --- a/base/trace_event/trace_event_impl.h +++ b/base/trace_event/trace_event_impl.h @@ -6,6 +6,8 @@ #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ +#include + #include #include #include @@ -14,6 +16,7 @@ #include "base/base_export.h" #include "base/callback.h" #include "base/containers/hash_tables.h" +#include "base/macros.h" #include "base/memory/ref_counted_memory.h" #include "base/observer_list.h" #include "base/single_thread_task_runner.h" @@ -23,6 +26,7 @@ #include "base/threading/thread.h" #include "base/threading/thread_local.h" #include "base/trace_event/trace_event_memory_overhead.h" +#include "build/build_config.h" namespace base { @@ -67,7 +71,7 @@ class BASE_EXPORT ConvertableToTraceFormat const int kTraceMaxNumArgs = 2; struct TraceEventHandle { - uint32 chunk_seq; + uint32_t chunk_seq; // These numbers of bits must be kept consistent with // TraceBufferChunk::kMaxTrunkIndex and // TraceBufferChunk::kTraceBufferChunkSize (in trace_buffer.h). diff --git a/base/trace_event/trace_event_memory_overhead.h b/base/trace_event/trace_event_memory_overhead.h index 25853d11d1284d..a69c93fed200de 100644 --- a/base/trace_event/trace_event_memory_overhead.h +++ b/base/trace_event/trace_event_memory_overhead.h @@ -5,9 +5,12 @@ #ifndef BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_ #define BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_ +#include + #include "base/base_export.h" #include "base/containers/hash_tables.h" #include "base/containers/small_map.h" +#include "base/macros.h" namespace base { diff --git a/base/trace_event/trace_event_synthetic_delay.cc b/base/trace_event/trace_event_synthetic_delay.cc index cd0c364d5bf0c7..cfae7435e9ba9f 100644 --- a/base/trace_event/trace_event_synthetic_delay.cc +++ b/base/trace_event/trace_event_synthetic_delay.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/macros.h" #include "base/memory/singleton.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "base/trace_event/trace_event_synthetic_delay.h" diff --git a/base/trace_event/trace_event_synthetic_delay.h b/base/trace_event/trace_event_synthetic_delay.h index 0df794b46c2f62..59e2842f71a8f6 100644 --- a/base/trace_event/trace_event_synthetic_delay.h +++ b/base/trace_event/trace_event_synthetic_delay.h @@ -33,6 +33,7 @@ #define BASE_TRACE_EVENT_TRACE_EVENT_SYNTHETIC_DELAY_H_ #include "base/atomicops.h" +#include "base/macros.h" #include "base/synchronization/lock.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" diff --git a/base/trace_event/trace_event_synthetic_delay_unittest.cc b/base/trace_event/trace_event_synthetic_delay_unittest.cc index 1dc0fc26f5c7a1..97a4580b3bbad6 100644 --- a/base/trace_event/trace_event_synthetic_delay_unittest.cc +++ b/base/trace_event/trace_event_synthetic_delay_unittest.cc @@ -4,6 +4,9 @@ #include "base/trace_event/trace_event_synthetic_delay.h" +#include + +#include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -39,19 +42,19 @@ class TraceEventSyntheticDelayTest : public testing::Test, void AdvanceTime(base::TimeDelta delta) { now_ += delta; } - int64 TestFunction() { + int64_t TestFunction() { base::TimeTicks start = Now(); { TRACE_EVENT_SYNTHETIC_DELAY("test.Delay"); } return (Now() - start).InMilliseconds(); } - int64 AsyncTestFunctionBegin() { + int64_t AsyncTestFunctionBegin() { base::TimeTicks start = Now(); { TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("test.AsyncDelay"); } return (Now() - start).InMilliseconds(); } - int64 AsyncTestFunctionEnd() { + int64_t AsyncTestFunctionEnd() { base::TimeTicks start = Now(); { TRACE_EVENT_SYNTHETIC_DELAY_END("test.AsyncDelay"); } return (Now() - start).InMilliseconds(); diff --git a/base/trace_event/trace_event_system_stats_monitor.cc b/base/trace_event/trace_event_system_stats_monitor.cc index c08d9b9477aa58..057967bfd90496 100644 --- a/base/trace_event/trace_event_system_stats_monitor.cc +++ b/base/trace_event/trace_event_system_stats_monitor.cc @@ -8,6 +8,7 @@ #include "base/json/json_writer.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" diff --git a/base/trace_event/trace_event_system_stats_monitor.h b/base/trace_event/trace_event_system_stats_monitor.h index 0ae1f487a391c1..14aa5681fe46e0 100644 --- a/base/trace_event/trace_event_system_stats_monitor.h +++ b/base/trace_event/trace_event_system_stats_monitor.h @@ -7,6 +7,7 @@ #include "base/base_export.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/process/process_metrics.h" diff --git a/base/trace_event/trace_event_system_stats_monitor_unittest.cc b/base/trace_event/trace_event_system_stats_monitor_unittest.cc index 03dff591cfa753..a90e74d13098b2 100644 --- a/base/trace_event/trace_event_system_stats_monitor_unittest.cc +++ b/base/trace_event/trace_event_system_stats_monitor_unittest.cc @@ -7,7 +7,9 @@ #include #include +#include "base/macros.h" #include "base/trace_event/trace_event_impl.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc index a588ce04b4f224..09f2a916c32045 100644 --- a/base/trace_event/trace_event_unittest.cc +++ b/base/trace_event/trace_event_unittest.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include +#include +#include + #include #include "base/bind.h" @@ -10,6 +13,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/ref_counted_memory.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" @@ -2625,7 +2629,7 @@ TEST_F(TraceEventTestFixture, TraceBufferRingBufferGetReturnChunk) { TraceBuffer* buffer = TraceLog::GetInstance()->trace_buffer(); size_t capacity = buffer->Capacity(); size_t num_chunks = capacity / TraceBufferChunk::kTraceBufferChunkSize; - uint32 last_seq = 0; + uint32_t last_seq = 0; size_t chunk_index; EXPECT_EQ(0u, buffer->Size()); diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc index 59bc15a70cf70e..c36550a95722f7 100644 --- a/base/trace_event/trace_log.cc +++ b/base/trace_event/trace_log.cc @@ -14,6 +14,7 @@ #include "base/debug/leak_annotations.h" #include "base/lazy_instance.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/process/process_metrics.h" @@ -36,6 +37,7 @@ #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_synthetic_delay.h" #include "base/trace_event/trace_sampling_thread.h" +#include "build/build_config.h" #if defined(OS_WIN) #include "base/trace_event/trace_event_etw_export_win.h" @@ -164,7 +166,7 @@ class AutoThreadLocalBoolean { // Use this function instead of TraceEventHandle constructor to keep the // overhead of ScopedTracer (trace_event.h) constructor minimum. -void MakeHandle(uint32 chunk_seq, +void MakeHandle(uint32_t chunk_seq, size_t chunk_index, size_t event_index, TraceEventHandle* handle) { @@ -172,8 +174,8 @@ void MakeHandle(uint32 chunk_seq, DCHECK(chunk_index <= TraceBufferChunk::kMaxChunkIndex); DCHECK(event_index < TraceBufferChunk::kTraceBufferChunkSize); handle->chunk_seq = chunk_seq; - handle->chunk_index = static_cast(chunk_index); - handle->event_index = static_cast(event_index); + handle->chunk_index = static_cast(chunk_index); + handle->event_index = static_cast(event_index); } } // namespace @@ -491,7 +493,7 @@ void TraceLog::UpdateSyntheticDelaysFromTraceConfig() { double target_duration = strtod(token.c_str(), &duration_end); if (duration_end != token.c_str()) { delay->SetTargetDuration(TimeDelta::FromMicroseconds( - static_cast(target_duration * 1e6))); + static_cast(target_duration * 1e6))); } else if (token == "static") { delay->SetMode(TraceEventSyntheticDelay::STATIC); } else if (token == "oneshot") { @@ -1489,7 +1491,7 @@ void TraceLog::CancelWatchEvent() { watch_event_callback_.Reset(); } -uint64 TraceLog::MangleEventId(uint64 id) { +uint64_t TraceLog::MangleEventId(uint64_t id) { return id ^ process_id_hash_; } diff --git a/base/trace_event/trace_log.h b/base/trace_event/trace_log.h index a6a5ac81947966..a079f04378aa98 100644 --- a/base/trace_event/trace_log.h +++ b/base/trace_event/trace_log.h @@ -5,17 +5,22 @@ #ifndef BASE_TRACE_EVENT_TRACE_LOG_H_ #define BASE_TRACE_EVENT_TRACE_LOG_H_ +#include +#include + #include #include #include "base/atomicops.h" #include "base/containers/hash_tables.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/trace_event/memory_dump_provider.h" #include "base/trace_event/trace_config.h" #include "base/trace_event/trace_event_impl.h" +#include "build/build_config.h" namespace base { @@ -267,7 +272,7 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider { int process_id() const { return process_id_; } - uint64 MangleEventId(uint64 id); + uint64_t MangleEventId(uint64_t id); // Exposed for unittesting: diff --git a/base/trace_event/trace_sampling_thread.cc b/base/trace_event/trace_sampling_thread.cc index 32ce7bde7693f2..ec4602ccc16392 100644 --- a/base/trace_event/trace_sampling_thread.cc +++ b/base/trace_event/trace_sampling_thread.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/trace_event/trace_sampling_thread.h" +#include + #include "base/trace_event/trace_event_impl.h" #include "base/trace_event/trace_log.h" +#include "base/trace_event/trace_sampling_thread.h" namespace base { namespace trace_event { diff --git a/base/trace_event/winheap_dump_provider_win.h b/base/trace_event/winheap_dump_provider_win.h index e3653550d44279..52edb06a8dc6ab 100644 --- a/base/trace_event/winheap_dump_provider_win.h +++ b/base/trace_event/winheap_dump_provider_win.h @@ -5,8 +5,11 @@ #ifndef BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_ #define BASE_TRACE_EVENT_WINHEAP_DUMP_PROVIDER_WIN_H_ +#include + #include +#include "base/macros.h" #include "base/memory/singleton.h" #include "base/trace_event/memory_dump_provider.h"