summaryrefslogtreecommitdiffstats
path: root/libchrome_tools
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@google.com>2018-05-28 22:10:54 +0900
committerHidehiko Abe <hidehiko@google.com>2018-06-01 16:37:08 +0900
commitad62a8245af1d123a106c870203a777260d231f8 (patch)
tree3c20b00d2e41637aceb9bd58acc79a0ec787922a /libchrome_tools
parent0c4351892b6ce29a34474b164d301cae78d6c0ac (diff)
downloadplatform_external_libchrome-ad62a8245af1d123a106c870203a777260d231f8.tar.gz
platform_external_libchrome-ad62a8245af1d123a106c870203a777260d231f8.tar.bz2
platform_external_libchrome-ad62a8245af1d123a106c870203a777260d231f8.zip
trace_event is a feature to measure profiling. However, it won't be usable in standard library like libchrome, so remove it. For build compatibility, small stub and trace_event_common.h are kept. Bug: 80375012 Test: Built locally. Change-Id: Ie2a87d2fa0d3cdbd856044498d0dd2072da2e9ab
Diffstat (limited to 'libchrome_tools')
-rw-r--r--libchrome_tools/patch/task_scheduler.patch31
-rw-r--r--libchrome_tools/patch/trace_event.patch191
2 files changed, 191 insertions, 31 deletions
diff --git a/libchrome_tools/patch/task_scheduler.patch b/libchrome_tools/patch/task_scheduler.patch
index c32520ba4..39a4ead16 100644
--- a/libchrome_tools/patch/task_scheduler.patch
+++ b/libchrome_tools/patch/task_scheduler.patch
@@ -119,34 +119,3 @@
} else {
inner_->CleanupForTesting();
}
---- a/base/trace_event/trace_log.cc
-+++ b/base/trace_event/trace_log.cc
-@@ -27,7 +27,10 @@
- #include "base/strings/string_tokenizer.h"
- #include "base/strings/stringprintf.h"
- #include "base/sys_info.h"
-+// post_task.h pulls in a lot of code not needed on Arc++.
-+#if 0
- #include "base/task_scheduler/post_task.h"
-+#endif
- #include "base/threading/platform_thread.h"
- #include "base/threading/thread_id_name_manager.h"
- #include "base/threading/thread_task_runner_handle.h"
-@@ -968,6 +971,7 @@ void TraceLog::FinishFlush(int generatio
- }
-
- if (use_worker_thread_) {
-+#if 0
- base::PostTaskWithTraits(
- FROM_HERE, base::TaskTraits()
- .MayBlock()
-@@ -978,6 +982,9 @@ void TraceLog::FinishFlush(int generatio
- Passed(&previous_logged_events), flush_output_callback,
- argument_filter_predicate));
- return;
-+#else
-+ NOTREACHED();
-+#endif
- }
-
- ConvertTraceEventsToTraceFormat(std::move(previous_logged_events),
diff --git a/libchrome_tools/patch/trace_event.patch b/libchrome_tools/patch/trace_event.patch
new file mode 100644
index 000000000..514ef53bb
--- /dev/null
+++ b/libchrome_tools/patch/trace_event.patch
@@ -0,0 +1,191 @@
+--- a/base/trace_event/trace_event.h
++++ b/base/trace_event/trace_event.h
+@@ -5,6 +5,43 @@
+ #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_
+ #define BASE_TRACE_EVENT_TRACE_EVENT_H_
+
++// Replace with stub implementation.
++#if 1
++#include "base/trace_event/common/trace_event_common.h"
++#include "base/trace_event/heap_profiler.h"
++
++// To avoid -Wunused-* errors, eat expression by macro.
++namespace libchrome_internal {
++template <typename... Args> void Ignore(Args&&... args) {}
++}
++#define INTERNAL_IGNORE(...) \
++ (false ? libchrome_internal::Ignore(__VA_ARGS__) : (void) 0)
++
++// Body is effectively empty.
++#define INTERNAL_TRACE_EVENT_ADD_SCOPED(...) INTERNAL_IGNORE(__VA_ARGS__)
++#define INTERNAL_TRACE_TASK_EXECUTION(...)
++#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(...) \
++ INTERNAL_IGNORE(__VA_ARGS__)
++#define TRACE_ID_MANGLE(val) (val)
++
++namespace base {
++namespace trace_event {
++
++class TraceLog {
++ public:
++ static TraceLog* GetInstance() {
++ static TraceLog instance;
++ return &instance;
++ }
++
++ pid_t process_id() { return 0; }
++ void SetCurrentThreadBlocksMessageLoop() {}
++};
++
++} // namespace trace_event
++} // namespace base
++#else
++
+ // 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.
+@@ -1115,4 +1152,5 @@ template<typename IDType> class TraceSco
+ } // namespace trace_event
+ } // namespace base
+
++#endif
+ #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_
+--- a/base/trace_event/heap_profiler.h
++++ b/base/trace_event/heap_profiler.h
+@@ -5,6 +5,22 @@
+ #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_H
+ #define BASE_TRACE_EVENT_HEAP_PROFILER_H
+
++// Replace with stub implementation.
++#if 1
++#define TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION \
++ trace_event_internal::HeapProfilerScopedTaskExecutionTracker
++
++namespace trace_event_internal {
++
++class HeapProfilerScopedTaskExecutionTracker {
++ public:
++ explicit HeapProfilerScopedTaskExecutionTracker(const char*) {}
++};
++
++} // namespace trace_event_internal
++
++#else
++
+ #include "base/compiler_specific.h"
+ #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
+
+@@ -86,4 +102,5 @@ class BASE_EXPORT HeapProfilerScopedIgno
+
+ } // namespace trace_event_internal
+
++#endif
+ #endif // BASE_TRACE_EVENT_HEAP_PROFILER_H
+--- a/base/test/test_pending_task.h
++++ b/base/test/test_pending_task.h
+@@ -10,7 +10,8 @@
+ #include "base/callback.h"
+ #include "base/location.h"
+ #include "base/time/time.h"
+-#include "base/trace_event/trace_event_argument.h"
++// Unsupported in libchrome.
++// #include "base/trace_event/trace_event_argument.h"
+
+ namespace base {
+
+@@ -58,10 +59,13 @@ struct TestPendingTask {
+ TimeDelta delay;
+ TestNestability nestability;
+
++// Unsupported in libchrome.
++#if 0
+ // Functions for using test pending task with tracing, useful in unit
+ // testing.
+ void AsValueInto(base::trace_event::TracedValue* state) const;
+ std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
++#endif
+ std::string ToString() const;
+
+ private:
+--- a/base/test/test_pending_task.cc
++++ b/base/test/test_pending_task.cc
+@@ -38,6 +38,8 @@ bool TestPendingTask::ShouldRunBefore(co
+
+ TestPendingTask::~TestPendingTask() {}
+
++// Unsupported in libchrome.
++#if 0
+ void TestPendingTask::AsValueInto(base::trace_event::TracedValue* state) const {
+ state->SetInteger("run_at", GetTimeToRun().ToInternalValue());
+ state->SetString("posting_function", location.ToString());
+@@ -61,10 +63,14 @@ TestPendingTask::AsValue() const {
+ AsValueInto(state.get());
+ return std::move(state);
+ }
++#endif
+
+ std::string TestPendingTask::ToString() const {
+ std::string output("TestPendingTask(");
++// Unsupported in libchrome.
++#if 0
+ AsValue()->AppendAsTraceFormat(&output);
++#endif
+ output += ")";
+ return output;
+ }
+--- a/base/threading/thread_id_name_manager.cc
++++ b/base/threading/thread_id_name_manager.cc
+@@ -10,7 +10,8 @@
+ #include "base/logging.h"
+ #include "base/memory/singleton.h"
+ #include "base/strings/string_util.h"
+-#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
++// Unsupported in libchrome.
++// #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
+
+ namespace base {
+ namespace {
+@@ -80,8 +81,9 @@ void ThreadIdNameManager::SetName(Platfo
+ // call GetName(which holds a lock) during the first allocation because it can
+ // cause a deadlock when the first allocation happens in the
+ // ThreadIdNameManager itself when holding the lock.
+- trace_event::AllocationContextTracker::SetCurrentThreadName(
+- leaked_str->c_str());
++ // Unsupported in libchrome.
++ // trace_event::AllocationContextTracker::SetCurrentThreadName(
++ // leaked_str->c_str());
+ }
+
+ const char* ThreadIdNameManager::GetName(PlatformThreadId id) {
+--- a/base/memory/shared_memory_posix.cc
++++ b/base/memory/shared_memory_posix.cc
+@@ -15,7 +15,8 @@
+ #include "base/files/scoped_file.h"
+ #include "base/logging.h"
+ #include "base/memory/shared_memory_helper.h"
+-#include "base/memory/shared_memory_tracker.h"
++// Unsupported in libchrome.
++// #include "base/memory/shared_memory_tracker.h"
+ #include "base/posix/eintr_wrapper.h"
+ #include "base/posix/safe_strerror.h"
+ #include "base/process/process_metrics.h"
+@@ -288,7 +291,8 @@ bool SharedMemory::MapAt(off_t offset, s
+ DCHECK_EQ(0U,
+ reinterpret_cast<uintptr_t>(memory_) &
+ (SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
+- SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this);
++ // Unsupported in libchrome.
++ // SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this);
+ } else {
+ memory_ = NULL;
+ }
+@@ -301,7 +305,8 @@ bool SharedMemory::Unmap() {
+ return false;
+
+ munmap(memory_, mapped_size_);
+- SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this);
++ // Unsupported in libchrome.
++ // SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this);
+ memory_ = NULL;
+ mapped_size_ = 0;
+ return true;