base: Disable trace event

This allows builds with enable_base_tracing=false.
This commit is contained in:
klzgrad 2020-08-29 20:22:14 +08:00
parent 2a9473027a
commit f701b08a6d
11 changed files with 66 additions and 80 deletions

View File

@ -14,77 +14,7 @@ struct ProcessName {
}; };
constexpr ProcessName kProcessNames[] = { constexpr ProcessName kProcessNames[] = {
{CurrentProcessType::PROCESS_UNSPECIFIED, "Null"}, {CurrentProcessType{}, ""},
{CurrentProcessType::PROCESS_BROWSER, "Browser"},
{CurrentProcessType::PROCESS_RENDERER, "Renderer"},
{CurrentProcessType::PROCESS_UTILITY, "Utility"},
{CurrentProcessType::PROCESS_ZYGOTE, "SandboxHelper"},
{CurrentProcessType::PROCESS_GPU, "Gpu"},
{CurrentProcessType::PROCESS_PPAPI_PLUGIN, "PpapiPlugin"},
{CurrentProcessType::PROCESS_PPAPI_BROKER, "PpapiBroker"},
{CurrentProcessType::PROCESS_SERVICE_NETWORK,
"Service: network.mojom.NetworkService"},
{CurrentProcessType::PROCESS_SERVICE_TRACING,
"Service: tracing.mojom.TracingService"},
{CurrentProcessType::PROCESS_SERVICE_STORAGE,
"Service: storage.mojom.StorageService"},
{CurrentProcessType::PROCESS_SERVICE_AUDIO,
"Service: audio.mojom.AudioService"},
{CurrentProcessType::PROCESS_SERVICE_DATA_DECODER,
"Service: data_decoder.mojom.DataDecoderService"},
{CurrentProcessType::PROCESS_SERVICE_UTIL_WIN,
"Service: chrome.mojom.UtilWin"},
{CurrentProcessType::PROCESS_SERVICE_PROXY_RESOLVER,
"Service: proxy_resolver.mojom.ProxyResolverFactory"},
{CurrentProcessType::PROCESS_SERVICE_CDM,
"Service: media.mojom.CdmService"},
{CurrentProcessType::PROCESS_SERVICE_VIDEO_CAPTURE,
"Service: video_capture.mojom.VideoCaptureService"},
{CurrentProcessType::PROCESS_SERVICE_UNZIPPER,
"Service: unzip.mojom.Unzipper"},
{CurrentProcessType::PROCESS_SERVICE_MIRRORING,
"Service: mirroring.mojom.MirroringService"},
{CurrentProcessType::PROCESS_SERVICE_FILEPATCHER,
"Service: patch.mojom.FilePatcher"},
{CurrentProcessType::PROCESS_SERVICE_TTS,
"Service: chromeos.tts.mojom.TtsService"},
{CurrentProcessType::PROCESS_SERVICE_PRINTING,
"Service: printing.mojom.PrintingService"},
{CurrentProcessType::PROCESS_SERVICE_QUARANTINE,
"Service: quarantine.mojom.Quarantine"},
{CurrentProcessType::PROCESS_SERVICE_CROS_LOCALSEARCH,
"Service: chromeos.local_search_service.mojom.LocalSearchService"},
{CurrentProcessType::PROCESS_SERVICE_CROS_ASSISTANT_AUDIO_DECODER,
"Service: chromeos.assistant.mojom.AssistantAudioDecoderFactory"},
{CurrentProcessType::PROCESS_SERVICE_FILEUTIL,
"Service: chrome.mojom.FileUtilService"},
{CurrentProcessType::PROCESS_SERVICE_PRINTCOMPOSITOR,
"Service: printing.mojom.PrintCompositor"},
{CurrentProcessType::PROCESS_SERVICE_PAINTPREVIEW,
"Service: paint_preview.mojom.PaintPreviewCompositorCollection"},
{CurrentProcessType::PROCESS_SERVICE_SPEECHRECOGNITION,
"Service: media.mojom.SpeechRecognitionService"},
{CurrentProcessType::PROCESS_SERVICE_XRDEVICE,
"Service: device.mojom.XRDeviceService"},
{CurrentProcessType::PROCESS_SERVICE_READICON,
"Service: chrome.mojom.UtilReadIcon"},
{CurrentProcessType::PROCESS_SERVICE_LANGUAGEDETECTION,
"Service: language_detection.mojom.LanguageDetectionService"},
{CurrentProcessType::PROCESS_SERVICE_SHARING,
"Service: sharing.mojom.Sharing"},
{CurrentProcessType::PROCESS_SERVICE_MEDIAPARSER,
"Service: chrome.mojom.MediaParserFactory"},
{CurrentProcessType::PROCESS_SERVICE_QRCODEGENERATOR,
"Service: qrcode_generator.mojom.QRCodeGeneratorService"},
{CurrentProcessType::PROCESS_SERVICE_PROFILEIMPORT,
"Service: chrome.mojom.ProfileImport"},
{CurrentProcessType::PROCESS_SERVICE_IME,
"Service: chromeos.ime.mojom.ImeService"},
{CurrentProcessType::PROCESS_SERVICE_RECORDING,
"Service: recording.mojom.RecordingService"},
{CurrentProcessType::PROCESS_SERVICE_SHAPEDETECTION,
"Service: shape_detection.mojom.ShapeDetectionService"},
{CurrentProcessType::PROCESS_RENDERER_EXTENSION, "Extension Renderer"},
}; };
} // namespace } // namespace

View File

@ -10,7 +10,7 @@
#include "base/tracing_buildflags.h" #include "base/tracing_buildflags.h"
#if BUILDFLAG(ENABLE_BASE_TRACING) #if 1
#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" // nogncheck #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" // nogncheck
#else #else

View File

@ -5,6 +5,8 @@
#ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_
#define 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 <stdint.h> #include <stdint.h>
#include <iosfwd> #include <iosfwd>
@ -159,4 +161,5 @@ void BASE_EXPORT PrintTo(const MemoryAllocatorDump::Entry&, std::ostream*);
} // namespace trace_event } // namespace trace_event
} // namespace base } // namespace base
#endif
#endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_

View File

@ -5,6 +5,8 @@
#ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_
#define 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 <stdint.h> #include <stdint.h>
#include <map> #include <map>
@ -267,4 +269,5 @@ class BASE_EXPORT MemoryDumpManager {
} // namespace trace_event } // namespace trace_event
} // namespace base } // namespace base
#endif
#endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_

View File

@ -5,6 +5,8 @@
#ifndef BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_H_ #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_H_
#define 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/base_export.h"
#include "base/process/process_handle.h" #include "base/process/process_handle.h"
#include "base/trace_event/memory_dump_request_args.h" #include "base/trace_event/memory_dump_request_args.h"
@ -48,4 +50,5 @@ class BASE_EXPORT MemoryDumpProvider {
} // namespace trace_event } // namespace trace_event
} // namespace base } // namespace base
#endif
#endif // BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_H_ #endif // BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_H_

View File

@ -5,6 +5,8 @@
#ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_
#define 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 <stddef.h> #include <stddef.h>
#include <map> #include <map>
@ -295,4 +297,5 @@ class BASE_EXPORT ProcessMemoryDump {
} // namespace trace_event } // namespace trace_event
} // namespace base } // namespace base
#endif
#endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_

View File

@ -5,6 +5,8 @@
#ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_
#define 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 // This header file defines implementation details of how the trace macros in
// trace_event_common.h collect and store trace events. Anything not // trace_event_common.h collect and store trace events. Anything not
// implementation-specific should go in trace_event_common.h instead of here. // implementation-specific should go in trace_event_common.h instead of here.
@ -793,4 +795,5 @@ class TraceScopedTrackableObject {
} // namespace trace_event } // namespace trace_event
} // namespace base } // namespace base
#endif
#endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_

View File

@ -6,6 +6,7 @@
#include <string> #include <string>
#include "base/trace_event/memory_usage_estimator.h"
#include "base/trace_event/trace_event_stub.h" #include "base/trace_event/trace_event_stub.h"
namespace base { namespace base {
@ -20,6 +21,9 @@ MemoryDumpProvider::~MemoryDumpProvider() = default;
// static // static
constexpr const char* const MemoryDumpManager::kTraceCategory; constexpr const char* const MemoryDumpManager::kTraceCategory;
template size_t EstimateMemoryUsage(const std::string&);
template size_t EstimateMemoryUsage(const std::u16string&);
} // namespace trace_event } // namespace trace_event
} // namespace base } // namespace base

View File

@ -12,6 +12,8 @@
#include <string> #include <string>
#include "base/base_export.h" #include "base/base_export.h"
#include "base/check.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/common/trace_event_common.h"
#include "base/trace_event/memory_allocator_dump_guid.h" #include "base/trace_event/memory_allocator_dump_guid.h"
@ -152,6 +154,41 @@ class BASE_EXPORT MemoryDumpProvider {
MemoryDumpProvider() = default; 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 { class BASE_EXPORT MemoryDumpManager {
public: public:
static constexpr const char* const kTraceCategory = static constexpr const char* const kTraceCategory =
@ -169,19 +206,19 @@ class TracedArray;
class TracedDictionary; class TracedDictionary;
class EventContext; class EventContext;
class StaticString { class BASE_EXPORT StaticString {
public: public:
template <typename T> template <typename T>
StaticString(T) {} StaticString(T) {}
}; };
class DynamicString { class BASE_EXPORT DynamicString {
public: public:
template <typename T> template <typename T>
explicit DynamicString(T) {} explicit DynamicString(T) {}
}; };
class TracedValue { class BASE_EXPORT TracedValue {
public: public:
void WriteInt64(int64_t) && {} void WriteInt64(int64_t) && {}
void WriteUInt64(uint64_t) && {} void WriteUInt64(uint64_t) && {}
@ -196,7 +233,7 @@ class TracedValue {
TracedArray WriteArray() &&; TracedArray WriteArray() &&;
}; };
class TracedDictionary { class BASE_EXPORT TracedDictionary {
public: public:
TracedValue AddItem(StaticString) { return TracedValue(); } TracedValue AddItem(StaticString) { return TracedValue(); }
TracedValue AddItem(DynamicString) { return TracedValue(); } TracedValue AddItem(DynamicString) { return TracedValue(); }
@ -212,7 +249,7 @@ class TracedDictionary {
TracedArray AddArray(DynamicString); TracedArray AddArray(DynamicString);
}; };
class TracedArray { class BASE_EXPORT TracedArray {
public: public:
TracedValue AppendItem() { return TracedValue(); } TracedValue AppendItem() { return TracedValue(); }
@ -224,7 +261,7 @@ class TracedArray {
}; };
template <class T> template <class T>
void WriteIntoTracedValue(TracedValue, T&&) {} BASE_EXPORT void WriteIntoTracedValue(TracedValue, T&&) {}
namespace protos::pbzero { namespace protos::pbzero {
namespace SequenceManagerTask { namespace SequenceManagerTask {

View File

@ -11,6 +11,7 @@
// Needed not for this file, but for every user of the TRACE_EVENT macros for // Needed not for this file, but for every user of the TRACE_EVENT macros for
// the lambda definition. So included here for convenience. // the lambda definition. So included here for convenience.
#if 0
#include "base/tracing/protos/chrome_track_event.pbzero.h" #include "base/tracing/protos/chrome_track_event.pbzero.h"
#include "third_party/perfetto/include/perfetto/tracing/event_context.h" #include "third_party/perfetto/include/perfetto/tracing/event_context.h"
#include "third_party/perfetto/include/perfetto/tracing/string_helpers.h" #include "third_party/perfetto/include/perfetto/tracing/string_helpers.h"
@ -97,4 +98,5 @@
##__VA_ARGS__) ##__VA_ARGS__)
#endif // !BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY) #endif // !BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY)
#endif
#endif // BASE_TRACE_EVENT_TYPED_MACROS_H_ #endif // BASE_TRACE_EVENT_TYPED_MACROS_H_

View File

@ -698,8 +698,6 @@ component("net") {
"log/net_log_values.h", "log/net_log_values.h",
"log/net_log_with_source.cc", "log/net_log_with_source.cc",
"log/net_log_with_source.h", "log/net_log_with_source.h",
"log/trace_net_log_observer.cc",
"log/trace_net_log_observer.h",
"nqe/cached_network_quality.cc", "nqe/cached_network_quality.cc",
"nqe/cached_network_quality.h", "nqe/cached_network_quality.h",
"nqe/effective_connection_type.cc", "nqe/effective_connection_type.cc",