diff --git a/src/base/trace_event/memory_allocator_dump.h b/src/base/trace_event/memory_allocator_dump.h index d0fbb8af23..22c29baa0d 100644 --- a/src/base/trace_event/memory_allocator_dump.h +++ b/src/base/trace_event/memory_allocator_dump.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ +#include "base/trace_event/trace_event_stub.h" +#if 0 #include #include @@ -161,4 +163,5 @@ void BASE_EXPORT PrintTo(const MemoryAllocatorDump::Entry&, std::ostream*); } // namespace trace_event } // namespace base +#endif #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ diff --git a/src/base/trace_event/memory_dump_manager.h b/src/base/trace_event/memory_dump_manager.h index f83b4915f7..aa43997f34 100644 --- a/src/base/trace_event/memory_dump_manager.h +++ b/src/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 "base/trace_event/trace_event_stub.h" +#if 0 #include #include @@ -267,4 +269,5 @@ class BASE_EXPORT MemoryDumpManager { } // namespace trace_event } // namespace base +#endif #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ diff --git a/src/base/trace_event/memory_dump_provider.h b/src/base/trace_event/memory_dump_provider.h index 983940772c..94d0d7f2a2 100644 --- a/src/base/trace_event/memory_dump_provider.h +++ b/src/base/trace_event/memory_dump_provider.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_H_ #define BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_H_ +#include "base/trace_event/trace_event_stub.h" +#if 0 #include "base/base_export.h" #include "base/process/process_handle.h" #include "base/trace_event/memory_dump_request_args.h" @@ -48,4 +50,5 @@ class BASE_EXPORT MemoryDumpProvider { } // namespace trace_event } // namespace base +#endif #endif // BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_H_ diff --git a/src/base/trace_event/process_memory_dump.h b/src/base/trace_event/process_memory_dump.h index e26442a0d5..138b8dce28 100644 --- a/src/base/trace_event/process_memory_dump.h +++ b/src/base/trace_event/process_memory_dump.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ +#include "base/trace_event/trace_event_stub.h" +#if 0 #include #include @@ -292,4 +294,5 @@ class BASE_EXPORT ProcessMemoryDump { } // namespace trace_event } // namespace base +#endif #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ diff --git a/src/base/trace_event/trace_event.h b/src/base/trace_event/trace_event.h index 9e3f747e98..969c7c0677 100644 --- a/src/base/trace_event/trace_event.h +++ b/src/base/trace_event/trace_event.h @@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ #define BASE_TRACE_EVENT_TRACE_EVENT_H_ +#include "base/trace_event/trace_event_stub.h" +#if 0 // This header file defines implementation details of how the trace macros in // trace_event_common.h collect and store trace events. Anything not // implementation-specific should go in trace_event_common.h instead of here. @@ -803,4 +805,5 @@ class TraceScopedTrackableObject { } // namespace trace_event } // namespace base +#endif #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ diff --git a/src/base/trace_event/trace_event_stub.cc b/src/base/trace_event/trace_event_stub.cc index d3e3f6dba4..ac0089081c 100644 --- a/src/base/trace_event/trace_event_stub.cc +++ b/src/base/trace_event/trace_event_stub.cc @@ -6,6 +6,7 @@ #include +#include "base/trace_event/memory_usage_estimator.h" #include "base/trace_event/trace_event_stub.h" namespace base { @@ -20,6 +21,14 @@ MemoryDumpProvider::~MemoryDumpProvider() = default; // static constexpr const char* const MemoryDumpManager::kTraceCategory; +MemoryDumpManager g_stub_memory_dump_manager; +MemoryDumpManager* MemoryDumpManager::GetInstance() { + return &g_stub_memory_dump_manager; +} + +template size_t EstimateMemoryUsage(const std::string&); +template size_t EstimateMemoryUsage(const std::u16string&); + } // namespace trace_event } // namespace base diff --git a/src/base/trace_event/trace_event_stub.h b/src/base/trace_event/trace_event_stub.h index 7a432ddf6f..f83a5f7fce 100644 --- a/src/base/trace_event/trace_event_stub.h +++ b/src/base/trace_event/trace_event_stub.h @@ -11,6 +11,9 @@ #include #include "base/base_export.h" +#include "base/check.h" +#include "base/memory/ref_counted.h" +#include "base/single_thread_task_runner.h" #include "base/strings/string_piece.h" #include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/memory_allocator_dump_guid.h" @@ -172,10 +175,51 @@ class BASE_EXPORT MemoryDumpProvider { MemoryDumpProvider() = default; }; +class BASE_EXPORT MemoryAllocatorDump { + public: + static constexpr char* kNameSize = nullptr; + static constexpr char* kNameObjectCount = nullptr; + static constexpr char* kUnitsBytes = nullptr; + static constexpr char* kUnitsObjects = nullptr; + static constexpr char* kTypeScalar = nullptr; + static constexpr char* kTypeString = nullptr; + void AddScalar(const char* name, const char* units, uint64_t value) {} + void AddString(const char* name, + const char* units, + const std::string& value) {} + const std::string& absolute_name() const { return absolute_name_; } + const MemoryAllocatorDumpGuid& guid() const { return guid_; } + + private: + const std::string absolute_name_; + MemoryAllocatorDumpGuid guid_; +}; + +class BASE_EXPORT ProcessMemoryDump { + public: + MemoryAllocatorDump* CreateAllocatorDump(const std::string& absolute_name) { + CHECK(false); + return nullptr; + } + MemoryAllocatorDump* GetAllocatorDump( + const std::string& absolute_name) const { + CHECK(false); + return nullptr; + } + void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, + const MemoryAllocatorDumpGuid& target) {} +}; + class BASE_EXPORT MemoryDumpManager { public: static constexpr const char* const kTraceCategory = TRACE_DISABLED_BY_DEFAULT("memory-infra"); + static MemoryDumpManager* GetInstance(); + void RegisterDumpProvider(MemoryDumpProvider* mdp, + const char* name, + scoped_refptr task_runner) { + } + void UnregisterDumpProvider(MemoryDumpProvider* mdp) {} }; } // namespace trace_event diff --git a/src/net/BUILD.gn b/src/net/BUILD.gn index 0a859d4120..0932dd7e4b 100644 --- a/src/net/BUILD.gn +++ b/src/net/BUILD.gn @@ -765,8 +765,6 @@ component("net") { "log/file_net_log_observer.h", "log/net_log_util.cc", "log/net_log_util.h", - "log/trace_net_log_observer.cc", - "log/trace_net_log_observer.h", "nqe/cached_network_quality.cc", "nqe/cached_network_quality.h", "nqe/connectivity_monitor.cc",