Roll Perfetto forward, adapting to proto_library changes

This patch rolls v8 to the latest Perfetto revision. Since Perfetto has
changed the way the GN protobuf integration works, we need to make some
corresponding changes in V8.

Bug: chromium:639003
Change-Id: I263c591560503c9779bbab3ec266cfb2708fc51f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2085175
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66583}
This commit is contained in:
Sami Kyostila 2020-03-04 11:35:45 +00:00 committed by Commit Bot
parent 22afaacd47
commit e4b5dfed0d
7 changed files with 44 additions and 25 deletions

View File

@ -308,6 +308,7 @@ config("internal_config") {
"//build/config/compiler:wexit_time_destructors", "//build/config/compiler:wexit_time_destructors",
":internal_config_base", ":internal_config_base",
":v8_header_features", ":v8_header_features",
":v8_tracing_config",
] ]
if (is_component_build) { if (is_component_build) {
@ -315,6 +316,17 @@ config("internal_config") {
} }
} }
# Should be applied to all targets that write trace events.
config("v8_tracing_config") {
if (v8_use_perfetto) {
include_dirs = [
"third_party/perfetto/include",
"$root_gen_dir/third_party/perfetto",
"$root_gen_dir/third_party/perfetto/build_config",
]
}
}
# This config should be applied to code using the libplatform. # This config should be applied to code using the libplatform.
config("libplatform_config") { config("libplatform_config") {
include_dirs = [ "include" ] include_dirs = [ "include" ]
@ -4275,6 +4287,7 @@ v8_executable("d8") {
# the :external_config applied to it by virtue of depending on :v8, and # the :external_config applied to it by virtue of depending on :v8, and
# you can't have both applied to the same target. # you can't have both applied to the same target.
":internal_config_base", ":internal_config_base",
":v8_tracing_config",
] ]
deps = [ deps = [
@ -4301,7 +4314,7 @@ v8_executable("d8") {
} }
if (v8_use_perfetto) { if (v8_use_perfetto) {
deps += [ "//third_party/perfetto/include/perfetto/tracing" ] deps += [ "//third_party/perfetto/src/tracing:in_process_backend" ]
} }
} }

2
DEPS
View File

@ -266,7 +266,7 @@ deps = {
'dep_type': 'cipd', 'dep_type': 'cipd',
}, },
'v8/third_party/perfetto': 'v8/third_party/perfetto':
Var('android_url') + '/platform/external/perfetto.git' + '@' + '12dc10e0278cded35205cf84f80a821348cb6c56', Var('android_url') + '/platform/external/perfetto.git' + '@' + 'b9b24d1b0b80aafec393af085067e9eae829412f',
'v8/third_party/protobuf': 'v8/third_party/protobuf':
Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + 'b68a347f56137b4b1a746e8c7438495a6ac1bd91', Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + 'b68a347f56137b4b1a746e8c7438495a6ac1bd91',
'v8/third_party/zlib': 'v8/third_party/zlib':

View File

@ -124,9 +124,13 @@ template("proto_library") {
rebase_path(proto_in_dir, root_build_dir), rebase_path(proto_in_dir, root_build_dir),
] ]
if (generate_cc) { if (generate_cc) {
cc_generator_options_ = ""
if (defined(invoker.cc_generator_options)) {
cc_generator_options_ = invoker.cc_generator_options
}
args += [ args += [
"--cpp_out", "--cpp_out",
rel_cc_out_dir, cc_generator_options_ + rel_cc_out_dir,
] ]
} }
if (generate_descriptor != "") { if (generate_descriptor != "") {
@ -153,13 +157,9 @@ template("proto_library") {
args += rebase_path(proto_sources, root_build_dir) args += rebase_path(proto_sources, root_build_dir)
inputs = [ inputs = [ protoc_path ]
protoc_path,
]
deps = [ deps = [ protoc_label ]
protoc_label,
]
if (generate_with_plugin) { if (generate_with_plugin) {
inputs += [ plugin_path ] inputs += [ plugin_path ]
if (defined(plugin_host_label)) { if (defined(plugin_host_label)) {
@ -201,21 +201,23 @@ template("proto_library") {
public_configs = [] public_configs = []
} }
public_configs += [ public_configs += [ "//:protobuf_gen_config" ]
"//:protobuf_gen_config",
":$config_name", propagate_imports_configs = !defined(invoker.propagate_imports_configs) ||
] invoker.propagate_imports_configs
if (propagate_imports_configs) {
public_configs += [ ":$config_name" ]
} else {
# Embedder handles include directory propagation to dependents.
configs += [ ":$config_name" ]
}
# Use protobuf_full only for tests. # Use protobuf_full only for tests.
if (defined(invoker.use_protobuf_full) && if (defined(invoker.use_protobuf_full) &&
invoker.use_protobuf_full == true) { invoker.use_protobuf_full == true) {
deps = [ deps = [ "//:protobuf_full" ]
"//:protobuf_full",
]
} else { } else {
deps = [ deps = [ "//:protobuf_lite" ]
"//:protobuf_lite",
]
} }
deps += [ ":$action_name" ] deps += [ ":$action_name" ]

View File

@ -1,4 +1,5 @@
include_rules = [ include_rules = [
"+libplatform",
"+perfetto", "+perfetto",
"+protos/perfetto", "+protos/perfetto",
] ]

View File

@ -7,6 +7,7 @@
#include <ostream> #include <ostream>
#include "libplatform/libplatform-export.h"
#include "src/libplatform/tracing/trace-event-listener.h" #include "src/libplatform/tracing/trace-event-listener.h"
namespace perfetto { namespace perfetto {
@ -21,7 +22,8 @@ namespace tracing {
// A listener that converts the proto trace data to JSON and writes it to a // A listener that converts the proto trace data to JSON and writes it to a
// file. // file.
class JSONTraceEventListener final : public TraceEventListener { class V8_PLATFORM_EXPORT JSONTraceEventListener final
: public TraceEventListener {
public: public:
explicit JSONTraceEventListener(std::ostream* stream); explicit JSONTraceEventListener(std::ostream* stream);
~JSONTraceEventListener() override; ~JSONTraceEventListener() override;

View File

@ -7,6 +7,8 @@
#include <vector> #include <vector>
#include "libplatform/libplatform-export.h"
namespace perfetto { namespace perfetto {
namespace protos { namespace protos {
class TracePacket; class TracePacket;
@ -22,7 +24,7 @@ namespace tracing {
// the PerfettoConsumer class has to perform. Clients override ProcessPacket() // the PerfettoConsumer class has to perform. Clients override ProcessPacket()
// to respond to trace events, e.g. to write them to a file as JSON or for // to respond to trace events, e.g. to write them to a file as JSON or for
// testing purposes. // testing purposes.
class TraceEventListener { class V8_PLATFORM_EXPORT TraceEventListener {
public: public:
virtual ~TraceEventListener() = default; virtual ~TraceEventListener() = default;
virtual void ProcessPacket(const ::perfetto::protos::TracePacket& packet) = 0; virtual void ProcessPacket(const ::perfetto::protos::TracePacket& packet) = 0;

View File

@ -29,15 +29,12 @@ v8_executable("cctest") {
configs = [ configs = [
"../..:external_config", "../..:external_config",
"../..:internal_config_base", "../..:internal_config_base",
"../..:v8_tracing_config",
":cctest_config", ":cctest_config",
] ]
ldflags = [] ldflags = []
if (v8_use_perfetto) {
deps += [ "//third_party/perfetto/include/perfetto/tracing" ]
}
# TODO(machenbach): Translate from gyp. # TODO(machenbach): Translate from gyp.
#["OS=="aix"", { #["OS=="aix"", {
# "ldflags": [ "-Wl,-bbigtoc" ], # "ldflags": [ "-Wl,-bbigtoc" ],
@ -378,6 +375,7 @@ v8_source_set("cctest_sources") {
configs = [ configs = [
"../..:external_config", "../..:external_config",
"../..:internal_config_base", "../..:internal_config_base",
"../..:v8_tracing_config",
] ]
public_deps = [ public_deps = [
@ -434,6 +432,7 @@ v8_source_set("cctest_sources") {
"//third_party/perfetto/include/perfetto/tracing", "//third_party/perfetto/include/perfetto/tracing",
"//third_party/perfetto/protos/perfetto/trace/chrome:lite", "//third_party/perfetto/protos/perfetto/trace/chrome:lite",
"//third_party/perfetto/protos/perfetto/trace/chrome:zero", "//third_party/perfetto/protos/perfetto/trace/chrome:zero",
"//third_party/perfetto/src/tracing:in_process_backend",
] ]
} }
} }