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