Commit efbba2c9 authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Revert "Add fake typed TRACE_EVENT macros for IOS and NACL builds."

This reverts commit 60dfcf2f.

Reason for revert:

FAILED: 
../../third_party/perfetto/src/protozero/message_unittest.cc:298:40: error: expected '(' for function-style cast or type construction
        MessageHandle<FakeRootMessage> handle(msg);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
../../third_party/perfetto/src/base/test/utils.h:34:30: note: expanded from macro 'EXPECT_DCHECK_DEATH'
    GTEST_EXECUTE_STATEMENT_(statement, "PERFETTO_CHECK")
                             ^~~~~~~~~
1 error generated.

https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8891267197314487504/+/steps/compile/0/stdout

Original change's description:
> Add fake typed TRACE_EVENT macros for IOS and NACL builds.
> 
> This allows users to not care if tracing is supported on their system.
> 
> Bug: 916074
> Change-Id: I69aa8178bb19f1a65186a2aba4f08699b6ba6ee3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1953210
> Reviewed-by: Stephen Nusko <nuskos@chromium.org>
> Reviewed-by: Eric Seckler <eseckler@chromium.org>
> Commit-Queue: Stephen Nusko <nuskos@chromium.org>
> Auto-Submit: Stephen Nusko <nuskos@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#731514}

TBR=eseckler@chromium.org,nuskos@chromium.org

Change-Id: Ia0cc5d2a330a408898c6248378726e43ddd8a732
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 916074
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2000964Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731531}
parent 1a2a5d0e
...@@ -17,42 +17,14 @@ source_set("traced_process") { ...@@ -17,42 +17,14 @@ source_set("traced_process") {
public_deps = [ "//services/tracing/public/mojom" ] public_deps = [ "//services/tracing/public/mojom" ]
deps = [ ":cpp" ] if (!is_nacl && !is_ios) {
deps = [ ":cpp" ]
}
} }
# On IOS and NACL we don't support tracing so we only include the minimum needed
# to support a fake typed TRACE_EVENT macro. However this means we don't have
# any .cc files and thus on iOS and NaCl it needs to be a source_set and not a
# component. |tracing_lib_type| decides which version to build.
if (!is_nacl && !is_ios) { if (!is_nacl && !is_ios) {
tracing_lib_type = "component" component("cpp") {
} else { sources = [
tracing_lib_type = "source_set"
}
target(tracing_lib_type, "cpp") {
sources = [
"perfetto/event_context.h",
"perfetto/macros.h",
"perfetto/macros_internal.h",
]
defines = [ "IS_TRACING_CPP_IMPL" ]
output_name = "tracing_cpp"
configs += [ "//build/config/compiler:wexit_time_destructors" ]
public_deps = [
"//base",
"//third_party/perfetto:libperfetto",
]
deps = [ "//third_party/perfetto/include/perfetto/protozero" ]
all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ]
if (!is_nacl && !is_ios) {
sources += [
"base_agent.cc", "base_agent.cc",
"base_agent.h", "base_agent.h",
"perfetto/dummy_producer.cc", "perfetto/dummy_producer.cc",
...@@ -68,7 +40,9 @@ target(tracing_lib_type, "cpp") { ...@@ -68,7 +40,9 @@ target(tracing_lib_type, "cpp") {
"perfetto/java_heap_profiler/hprof_parser_android.h", "perfetto/java_heap_profiler/hprof_parser_android.h",
"perfetto/java_heap_profiler/java_heap_profiler_android.cc", "perfetto/java_heap_profiler/java_heap_profiler_android.cc",
"perfetto/java_heap_profiler/java_heap_profiler_android.h", "perfetto/java_heap_profiler/java_heap_profiler_android.h",
"perfetto/macros.h",
"perfetto/macros_internal.cc", "perfetto/macros_internal.cc",
"perfetto/macros_internal.h",
"perfetto/perfetto_config.cc", "perfetto/perfetto_config.cc",
"perfetto/perfetto_config.h", "perfetto/perfetto_config.h",
"perfetto/perfetto_producer.cc", "perfetto/perfetto_producer.cc",
...@@ -105,14 +79,24 @@ target(tracing_lib_type, "cpp") { ...@@ -105,14 +79,24 @@ target(tracing_lib_type, "cpp") {
"tracing_features.h", "tracing_features.h",
] ]
public_deps += [ defines = [ "IS_TRACING_CPP_IMPL" ]
output_name = "tracing_cpp"
configs += [ "//build/config/compiler:wexit_time_destructors" ]
public_deps = [
"//base",
"//components/tracing:startup_tracing", "//components/tracing:startup_tracing",
"//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings",
"//services/tracing/public/mojom", "//services/tracing/public/mojom",
"//third_party/perfetto:libperfetto",
] ]
deps += [ all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ]
deps = [
"//build:chromecast_buildflags", "//build:chromecast_buildflags",
"//third_party/perfetto/include/perfetto/protozero",
"//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite",
] ]
...@@ -138,5 +122,5 @@ target(tracing_lib_type, "cpp") { ...@@ -138,5 +122,5 @@ target(tracing_lib_type, "cpp") {
# stack_unwinder_android.cc overrides the dl_unwind_find_exidx function. # stack_unwinder_android.cc overrides the dl_unwind_find_exidx function.
all_dependent_configs += [ ":wrap_find_exidx" ] all_dependent_configs += [ ":wrap_find_exidx" ]
} }
} # !is_ios && !is_nacl }
} } # !is_nacl && !is_ios
...@@ -8,11 +8,6 @@ ...@@ -8,11 +8,6 @@
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "services/tracing/public/cpp/perfetto/macros_internal.h" #include "services/tracing/public/cpp/perfetto/macros_internal.h"
// Needed not for this file but for every user of the TRACE_EVENT macros for the
// lambda definition. So included here for convenience.
#include "services/tracing/public/cpp/perfetto/event_context.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/track_event.pbzero.h"
#if defined(TRACE_EVENT_BEGIN) #if defined(TRACE_EVENT_BEGIN)
#error "Another copy of perfetto tracing macros have been included" #error "Another copy of perfetto tracing macros have been included"
#endif #endif
......
...@@ -5,18 +5,14 @@ ...@@ -5,18 +5,14 @@
#ifndef SERVICES_TRACING_PUBLIC_CPP_PERFETTO_MACROS_INTERNAL_H_ #ifndef SERVICES_TRACING_PUBLIC_CPP_PERFETTO_MACROS_INTERNAL_H_
#define SERVICES_TRACING_PUBLIC_CPP_PERFETTO_MACROS_INTERNAL_H_ #define SERVICES_TRACING_PUBLIC_CPP_PERFETTO_MACROS_INTERNAL_H_
#include "build/build_config.h"
namespace perfetto {
class EventContext;
}
#if !defined(OS_IOS) && !defined(OS_NACL)
#include "base/component_export.h" #include "base/component_export.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "services/tracing/public/cpp/perfetto/trace_event_data_source.h" #include "services/tracing/public/cpp/perfetto/trace_event_data_source.h"
namespace perfetto {
class TrackEventContext;
}
namespace tracing { namespace tracing {
namespace internal { namespace internal {
base::Optional<base::trace_event::TraceEvent> COMPONENT_EXPORT(TRACING_CPP) base::Optional<base::trace_event::TraceEvent> COMPONENT_EXPORT(TRACING_CPP)
...@@ -28,7 +24,7 @@ base::Optional<base::trace_event::TraceEvent> COMPONENT_EXPORT(TRACING_CPP) ...@@ -28,7 +24,7 @@ base::Optional<base::trace_event::TraceEvent> COMPONENT_EXPORT(TRACING_CPP)
// A simple function that will add the TraceEvent requested and will call the // A simple function that will add the TraceEvent requested and will call the
// |argument_func| after the track_event has been filled in. // |argument_func| after the track_event has been filled in.
template < template <
typename TrackEventArgumentFunction = void (*)(perfetto::EventContext)> typename TrackEventArgumentFunction = void (*)(perfetto::TrackEventContext)>
static inline base::trace_event::TraceEventHandle AddTraceEvent( static inline base::trace_event::TraceEventHandle AddTraceEvent(
char phase, char phase,
const unsigned char* category_group_enabled, const unsigned char* category_group_enabled,
...@@ -91,33 +87,4 @@ static inline base::trace_event::TraceEventHandle AddTraceEvent( ...@@ -91,33 +87,4 @@ static inline base::trace_event::TraceEventHandle AddTraceEvent(
return 0; \ return 0; \
}()}; }()};
#else // !defined(OS_IOS) && !defined(OS_NACL)
// Tracing isn't supported on IOS or NACL so we just black hole all the
// parameters into a function that doesn't do anything. This ensures that no
// warnings about unused parameters are generated.
namespace tracing {
namespace internal {
template <
typename TrackEventArgumentFunction = void (*)(perfetto::EventContext)>
static inline base::trace_event::TraceEventHandle AddTraceEvent(
char,
const unsigned char*,
const char*,
unsigned int,
TrackEventArgumentFunction) {
return {0, 0, 0};
}
} // namespace internal
} // namespace tracing
#define TRACING_INTERNAL_ADD_TRACE_EVENT(phase, category, name, flags, ...) \
tracing::internal::AddTraceEvent(phase, nullptr, name, flags, ##__VA_ARGS__);
#define TRACING_INTERNAL_SCOPED_ADD_TRACE_EVENT(category, name, ...) \
TRACING_INTERNAL_ADD_TRACE_EVENT('B', category, name, TRACE_EVENT_FLAG_NONE, \
##__VA_ARGS__);
#endif // else of !defined(OS_IOS) && !defined(OS_NACL)
#endif // SERVICES_TRACING_PUBLIC_CPP_PERFETTO_MACROS_INTERNAL_H_ #endif // SERVICES_TRACING_PUBLIC_CPP_PERFETTO_MACROS_INTERNAL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment