1*635a8641SAndroid Build Coastguard Worker--- a/base/trace_event/trace_event.h 2*635a8641SAndroid Build Coastguard Worker+++ b/base/trace_event/trace_event.h 3*635a8641SAndroid Build Coastguard Worker@@ -5,6 +5,43 @@ 4*635a8641SAndroid Build Coastguard Worker #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ 5*635a8641SAndroid Build Coastguard Worker #define BASE_TRACE_EVENT_TRACE_EVENT_H_ 6*635a8641SAndroid Build Coastguard Worker 7*635a8641SAndroid Build Coastguard Worker+// Replace with stub implementation. 8*635a8641SAndroid Build Coastguard Worker+#if 1 9*635a8641SAndroid Build Coastguard Worker+#include "base/trace_event/common/trace_event_common.h" 10*635a8641SAndroid Build Coastguard Worker+#include "base/trace_event/heap_profiler.h" 11*635a8641SAndroid Build Coastguard Worker+ 12*635a8641SAndroid Build Coastguard Worker+// To avoid -Wunused-* errors, eat expression by macro. 13*635a8641SAndroid Build Coastguard Worker+namespace libchrome_internal { 14*635a8641SAndroid Build Coastguard Worker+template <typename... Args> void Ignore(Args&&... args) {} 15*635a8641SAndroid Build Coastguard Worker+} 16*635a8641SAndroid Build Coastguard Worker+#define INTERNAL_IGNORE(...) \ 17*635a8641SAndroid Build Coastguard Worker+ (false ? libchrome_internal::Ignore(__VA_ARGS__) : (void) 0) 18*635a8641SAndroid Build Coastguard Worker+ 19*635a8641SAndroid Build Coastguard Worker+// Body is effectively empty. 20*635a8641SAndroid Build Coastguard Worker+#define INTERNAL_TRACE_EVENT_ADD_SCOPED(...) INTERNAL_IGNORE(__VA_ARGS__) 21*635a8641SAndroid Build Coastguard Worker+#define INTERNAL_TRACE_TASK_EXECUTION(...) 22*635a8641SAndroid Build Coastguard Worker+#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(...) \ 23*635a8641SAndroid Build Coastguard Worker+ INTERNAL_IGNORE(__VA_ARGS__) 24*635a8641SAndroid Build Coastguard Worker+#define TRACE_ID_MANGLE(val) (val) 25*635a8641SAndroid Build Coastguard Worker+ 26*635a8641SAndroid Build Coastguard Worker+namespace base { 27*635a8641SAndroid Build Coastguard Worker+namespace trace_event { 28*635a8641SAndroid Build Coastguard Worker+ 29*635a8641SAndroid Build Coastguard Worker+class TraceLog { 30*635a8641SAndroid Build Coastguard Worker+ public: 31*635a8641SAndroid Build Coastguard Worker+ static TraceLog* GetInstance() { 32*635a8641SAndroid Build Coastguard Worker+ static TraceLog instance; 33*635a8641SAndroid Build Coastguard Worker+ return &instance; 34*635a8641SAndroid Build Coastguard Worker+ } 35*635a8641SAndroid Build Coastguard Worker+ 36*635a8641SAndroid Build Coastguard Worker+ pid_t process_id() { return 0; } 37*635a8641SAndroid Build Coastguard Worker+ void SetCurrentThreadBlocksMessageLoop() {} 38*635a8641SAndroid Build Coastguard Worker+}; 39*635a8641SAndroid Build Coastguard Worker+ 40*635a8641SAndroid Build Coastguard Worker+} // namespace trace_event 41*635a8641SAndroid Build Coastguard Worker+} // namespace base 42*635a8641SAndroid Build Coastguard Worker+#else 43*635a8641SAndroid Build Coastguard Worker+ 44*635a8641SAndroid Build Coastguard Worker // This header file defines implementation details of how the trace macros in 45*635a8641SAndroid Build Coastguard Worker // trace_event_common.h collect and store trace events. Anything not 46*635a8641SAndroid Build Coastguard Worker // implementation-specific should go in trace_event_common.h instead of here. 47*635a8641SAndroid Build Coastguard Worker@@ -1115,4 +1152,5 @@ template<typename IDType> class TraceSco 48*635a8641SAndroid Build Coastguard Worker } // namespace trace_event 49*635a8641SAndroid Build Coastguard Worker } // namespace base 50*635a8641SAndroid Build Coastguard Worker 51*635a8641SAndroid Build Coastguard Worker+#endif 52*635a8641SAndroid Build Coastguard Worker #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ 53*635a8641SAndroid Build Coastguard Worker--- a/base/trace_event/heap_profiler.h 54*635a8641SAndroid Build Coastguard Worker+++ b/base/trace_event/heap_profiler.h 55*635a8641SAndroid Build Coastguard Worker@@ -5,6 +5,22 @@ 56*635a8641SAndroid Build Coastguard Worker #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_H 57*635a8641SAndroid Build Coastguard Worker #define BASE_TRACE_EVENT_HEAP_PROFILER_H 58*635a8641SAndroid Build Coastguard Worker 59*635a8641SAndroid Build Coastguard Worker+// Replace with stub implementation. 60*635a8641SAndroid Build Coastguard Worker+#if 1 61*635a8641SAndroid Build Coastguard Worker+#define TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION \ 62*635a8641SAndroid Build Coastguard Worker+ trace_event_internal::HeapProfilerScopedTaskExecutionTracker 63*635a8641SAndroid Build Coastguard Worker+ 64*635a8641SAndroid Build Coastguard Worker+namespace trace_event_internal { 65*635a8641SAndroid Build Coastguard Worker+ 66*635a8641SAndroid Build Coastguard Worker+class HeapProfilerScopedTaskExecutionTracker { 67*635a8641SAndroid Build Coastguard Worker+ public: 68*635a8641SAndroid Build Coastguard Worker+ explicit HeapProfilerScopedTaskExecutionTracker(const char*) {} 69*635a8641SAndroid Build Coastguard Worker+}; 70*635a8641SAndroid Build Coastguard Worker+ 71*635a8641SAndroid Build Coastguard Worker+} // namespace trace_event_internal 72*635a8641SAndroid Build Coastguard Worker+ 73*635a8641SAndroid Build Coastguard Worker+#else 74*635a8641SAndroid Build Coastguard Worker+ 75*635a8641SAndroid Build Coastguard Worker #include "base/compiler_specific.h" 76*635a8641SAndroid Build Coastguard Worker #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 77*635a8641SAndroid Build Coastguard Worker 78*635a8641SAndroid Build Coastguard Worker@@ -86,4 +102,5 @@ class BASE_EXPORT HeapProfilerScopedIgno 79*635a8641SAndroid Build Coastguard Worker 80*635a8641SAndroid Build Coastguard Worker } // namespace trace_event_internal 81*635a8641SAndroid Build Coastguard Worker 82*635a8641SAndroid Build Coastguard Worker+#endif 83*635a8641SAndroid Build Coastguard Worker #endif // BASE_TRACE_EVENT_HEAP_PROFILER_H 84*635a8641SAndroid Build Coastguard Worker--- a/base/test/test_pending_task.h 85*635a8641SAndroid Build Coastguard Worker+++ b/base/test/test_pending_task.h 86*635a8641SAndroid Build Coastguard Worker@@ -10,7 +10,8 @@ 87*635a8641SAndroid Build Coastguard Worker #include "base/callback.h" 88*635a8641SAndroid Build Coastguard Worker #include "base/location.h" 89*635a8641SAndroid Build Coastguard Worker #include "base/time/time.h" 90*635a8641SAndroid Build Coastguard Worker-#include "base/trace_event/trace_event_argument.h" 91*635a8641SAndroid Build Coastguard Worker+// Unsupported in libchrome. 92*635a8641SAndroid Build Coastguard Worker+// #include "base/trace_event/trace_event_argument.h" 93*635a8641SAndroid Build Coastguard Worker 94*635a8641SAndroid Build Coastguard Worker namespace base { 95*635a8641SAndroid Build Coastguard Worker 96*635a8641SAndroid Build Coastguard Worker@@ -58,10 +59,13 @@ struct TestPendingTask { 97*635a8641SAndroid Build Coastguard Worker TimeDelta delay; 98*635a8641SAndroid Build Coastguard Worker TestNestability nestability; 99*635a8641SAndroid Build Coastguard Worker 100*635a8641SAndroid Build Coastguard Worker+// Unsupported in libchrome. 101*635a8641SAndroid Build Coastguard Worker+#if 0 102*635a8641SAndroid Build Coastguard Worker // Functions for using test pending task with tracing, useful in unit 103*635a8641SAndroid Build Coastguard Worker // testing. 104*635a8641SAndroid Build Coastguard Worker void AsValueInto(base::trace_event::TracedValue* state) const; 105*635a8641SAndroid Build Coastguard Worker std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 106*635a8641SAndroid Build Coastguard Worker+#endif 107*635a8641SAndroid Build Coastguard Worker std::string ToString() const; 108*635a8641SAndroid Build Coastguard Worker 109*635a8641SAndroid Build Coastguard Worker private: 110*635a8641SAndroid Build Coastguard Worker--- a/base/test/test_pending_task.cc 111*635a8641SAndroid Build Coastguard Worker+++ b/base/test/test_pending_task.cc 112*635a8641SAndroid Build Coastguard Worker@@ -38,6 +38,8 @@ bool TestPendingTask::ShouldRunBefore(co 113*635a8641SAndroid Build Coastguard Worker 114*635a8641SAndroid Build Coastguard Worker TestPendingTask::~TestPendingTask() {} 115*635a8641SAndroid Build Coastguard Worker 116*635a8641SAndroid Build Coastguard Worker+// Unsupported in libchrome. 117*635a8641SAndroid Build Coastguard Worker+#if 0 118*635a8641SAndroid Build Coastguard Worker void TestPendingTask::AsValueInto(base::trace_event::TracedValue* state) const { 119*635a8641SAndroid Build Coastguard Worker state->SetInteger("run_at", GetTimeToRun().ToInternalValue()); 120*635a8641SAndroid Build Coastguard Worker state->SetString("posting_function", location.ToString()); 121*635a8641SAndroid Build Coastguard Worker@@ -61,10 +63,14 @@ TestPendingTask::AsValue() const { 122*635a8641SAndroid Build Coastguard Worker AsValueInto(state.get()); 123*635a8641SAndroid Build Coastguard Worker return std::move(state); 124*635a8641SAndroid Build Coastguard Worker } 125*635a8641SAndroid Build Coastguard Worker+#endif 126*635a8641SAndroid Build Coastguard Worker 127*635a8641SAndroid Build Coastguard Worker std::string TestPendingTask::ToString() const { 128*635a8641SAndroid Build Coastguard Worker std::string output("TestPendingTask("); 129*635a8641SAndroid Build Coastguard Worker+// Unsupported in libchrome. 130*635a8641SAndroid Build Coastguard Worker+#if 0 131*635a8641SAndroid Build Coastguard Worker AsValue()->AppendAsTraceFormat(&output); 132*635a8641SAndroid Build Coastguard Worker+#endif 133*635a8641SAndroid Build Coastguard Worker output += ")"; 134*635a8641SAndroid Build Coastguard Worker return output; 135*635a8641SAndroid Build Coastguard Worker } 136*635a8641SAndroid Build Coastguard Worker---- a/base/threading/thread_id_name_manager.cc 137*635a8641SAndroid Build Coastguard Worker+++ b/base/threading/thread_id_name_manager.cc 138*635a8641SAndroid Build Coastguard Worker@@ -12,7 +12,8 @@ 139*635a8641SAndroid Build Coastguard Worker #include "base/no_destructor.h" 140*635a8641SAndroid Build Coastguard Worker #include "base/strings/string_util.h" 141*635a8641SAndroid Build Coastguard Worker #include "base/threading/thread_local.h" 142*635a8641SAndroid Build Coastguard Worker-#include "base/trace_event/heap_profiler_allocation_context_tracker.h" 143*635a8641SAndroid Build Coastguard Worker+// Unsupported in libchrome. 144*635a8641SAndroid Build Coastguard Worker+// #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 145*635a8641SAndroid Build Coastguard Worker 146*635a8641SAndroid Build Coastguard Worker namespace base { 147*635a8641SAndroid Build Coastguard Worker namespace { 148*635a8641SAndroid Build Coastguard Worker@@ -94,8 +95,9 @@ void ThreadIdNameManager::SetName(const std::string& name) { 149*635a8641SAndroid Build Coastguard Worker // call GetName(which holds a lock) during the first allocation because it can 150*635a8641SAndroid Build Coastguard Worker // cause a deadlock when the first allocation happens in the 151*635a8641SAndroid Build Coastguard Worker // ThreadIdNameManager itself when holding the lock. 152*635a8641SAndroid Build Coastguard Worker- trace_event::AllocationContextTracker::SetCurrentThreadName( 153*635a8641SAndroid Build Coastguard Worker- leaked_str->c_str()); 154*635a8641SAndroid Build Coastguard Worker+ // Unsupported in libchrome. 155*635a8641SAndroid Build Coastguard Worker+ // trace_event::AllocationContextTracker::SetCurrentThreadName( 156*635a8641SAndroid Build Coastguard Worker+ // leaked_str->c_str()); 157*635a8641SAndroid Build Coastguard Worker } 158*635a8641SAndroid Build Coastguard Worker 159*635a8641SAndroid Build Coastguard Worker const char* ThreadIdNameManager::GetName(PlatformThreadId id) { 160*635a8641SAndroid Build Coastguard Worker--- a/base/memory/shared_memory_posix.cc 161*635a8641SAndroid Build Coastguard Worker+++ b/base/memory/shared_memory_posix.cc 162*635a8641SAndroid Build Coastguard Worker@@ -16,7 +16,8 @@ 163*635a8641SAndroid Build Coastguard Worker #include "base/logging.h" 164*635a8641SAndroid Build Coastguard Worker #include "base/macros.h" 165*635a8641SAndroid Build Coastguard Worker #include "base/memory/shared_memory_helper.h" 166*635a8641SAndroid Build Coastguard Worker-#include "base/memory/shared_memory_tracker.h" 167*635a8641SAndroid Build Coastguard Worker+// Unsupported in libchrome. 168*635a8641SAndroid Build Coastguard Worker+// #include "base/memory/shared_memory_tracker.h" 169*635a8641SAndroid Build Coastguard Worker #include "base/posix/eintr_wrapper.h" 170*635a8641SAndroid Build Coastguard Worker #include "base/posix/safe_strerror.h" 171*635a8641SAndroid Build Coastguard Worker #include "base/process/process_metrics.h" 172*635a8641SAndroid Build Coastguard Worker@@ -302,7 +305,8 @@ bool SharedMemory::MapAt(off_t offset, size_t bytes) { 173*635a8641SAndroid Build Coastguard Worker DCHECK_EQ(0U, 174*635a8641SAndroid Build Coastguard Worker reinterpret_cast<uintptr_t>(memory_) & 175*635a8641SAndroid Build Coastguard Worker (SharedMemory::MAP_MINIMUM_ALIGNMENT - 1)); 176*635a8641SAndroid Build Coastguard Worker- SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this); 177*635a8641SAndroid Build Coastguard Worker+ // Unsupported in libchrome. 178*635a8641SAndroid Build Coastguard Worker+ // SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this); 179*635a8641SAndroid Build Coastguard Worker } else { 180*635a8641SAndroid Build Coastguard Worker memory_ = nullptr; 181*635a8641SAndroid Build Coastguard Worker } 182*635a8641SAndroid Build Coastguard Worker@@ -314,7 +318,8 @@ bool SharedMemory::Unmap() { 183*635a8641SAndroid Build Coastguard Worker if (!memory_) 184*635a8641SAndroid Build Coastguard Worker return false; 185*635a8641SAndroid Build Coastguard Worker 186*635a8641SAndroid Build Coastguard Worker- SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this); 187*635a8641SAndroid Build Coastguard Worker+ // Unsupported in libchrome. 188*635a8641SAndroid Build Coastguard Worker+ // SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this); 189*635a8641SAndroid Build Coastguard Worker munmap(memory_, mapped_size_); 190*635a8641SAndroid Build Coastguard Worker memory_ = nullptr; 191*635a8641SAndroid Build Coastguard Worker mapped_size_ = 0; 192