Skip to content

Commit

Permalink
deps: V8: undo header change of 9dbab9bbdb979
Browse files Browse the repository at this point in the history
Refs: v8/v8@9dbab9b

PR-URL: #34356
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
  • Loading branch information
addaleax authored and MylesBorins committed Jul 16, 2020
1 parent 1af8943 commit 2079fef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 39 deletions.
54 changes: 20 additions & 34 deletions deps/v8/include/libplatform/v8-tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include "v8-platform.h" // NOLINT(build/include_directory)

namespace perfetto {
namespace trace_processor {
class TraceProcessorStorage;
}
class TracingSession;
}

Expand All @@ -31,6 +28,7 @@ namespace platform {
namespace tracing {

class TraceEventListener;
class JSONTraceEventListener;

const int kTraceMaxNumArgs = 2;

Expand Down Expand Up @@ -199,9 +197,6 @@ class V8_PLATFORM_EXPORT TraceConfig {

TraceConfig() : enable_systrace_(false), enable_argument_filter_(false) {}
TraceRecordMode GetTraceRecordMode() const { return record_mode_; }
const StringList& GetEnabledCategories() const {
return included_categories_;
}
bool IsSystraceEnabled() const { return enable_systrace_; }
bool IsArgumentFilterEnabled() const { return enable_argument_filter_; }

Expand Down Expand Up @@ -234,17 +229,6 @@ class V8_PLATFORM_EXPORT TraceConfig {
class V8_PLATFORM_EXPORT TracingController
: public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) {
public:
TracingController();
~TracingController() override;

#if defined(V8_USE_PERFETTO)
// Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides
// the output stream for the JSON trace data.
void InitializeForPerfetto(std::ostream* output_stream);
// Provide an optional listener for testing that will receive trace events.
// Must be called before StartTracing().
void SetTraceEventListenerForTesting(TraceEventListener* listener);
#else // defined(V8_USE_PERFETTO)
// The pointer returned from GetCategoryGroupEnabled() points to a value with
// zero or more of the following bits. Used in this class only. The
// TRACE_EVENT macros should only use the value as a bool. These values must
Expand All @@ -258,8 +242,19 @@ class V8_PLATFORM_EXPORT TracingController
ENABLED_FOR_ETW_EXPORT = 1 << 3
};

TracingController();
~TracingController() override;

// Takes ownership of |trace_buffer|.
void Initialize(TraceBuffer* trace_buffer);
#ifdef V8_USE_PERFETTO
// Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides
// the output stream for the JSON trace data.
void InitializeForPerfetto(std::ostream* output_stream);
// Provide an optional listener for testing that will receive trace events.
// Must be called before StartTracing().
void SetTraceEventListenerForTesting(TraceEventListener* listener);
#endif

// v8::TracingController implementation.
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
Expand All @@ -279,10 +274,6 @@ class V8_PLATFORM_EXPORT TracingController
unsigned int flags, int64_t timestamp) override;
void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
const char* name, uint64_t handle) override;

static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
#endif // !defined(V8_USE_PERFETTO)

void AddTraceStateObserver(
v8::TracingController::TraceStateObserver* observer) override;
void RemoveTraceStateObserver(
Expand All @@ -291,32 +282,27 @@ class V8_PLATFORM_EXPORT TracingController
void StartTracing(TraceConfig* trace_config);
void StopTracing();

static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);

protected:
#if !defined(V8_USE_PERFETTO)
virtual int64_t CurrentTimestampMicroseconds();
virtual int64_t CurrentCpuTimestampMicroseconds();
#endif // !defined(V8_USE_PERFETTO)

private:
#if !defined(V8_USE_PERFETTO)
void UpdateCategoryGroupEnabledFlag(size_t category_index);
void UpdateCategoryGroupEnabledFlags();
#endif // !defined(V8_USE_PERFETTO)

std::unique_ptr<base::Mutex> mutex_;
std::unique_ptr<TraceBuffer> trace_buffer_;
std::unique_ptr<TraceConfig> trace_config_;
std::atomic_bool recording_{false};
std::unique_ptr<base::Mutex> mutex_;
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;

#if defined(V8_USE_PERFETTO)
std::atomic_bool recording_{false};
#ifdef V8_USE_PERFETTO
std::ostream* output_stream_ = nullptr;
std::unique_ptr<perfetto::trace_processor::TraceProcessorStorage>
trace_processor_;
std::unique_ptr<JSONTraceEventListener> json_listener_;
TraceEventListener* listener_for_testing_ = nullptr;
std::unique_ptr<perfetto::TracingSession> tracing_session_;
#else // !defined(V8_USE_PERFETTO)
std::unique_ptr<TraceBuffer> trace_buffer_;
#endif // !defined(V8_USE_PERFETTO)
#endif

// Disallow copy and assign
TracingController(const TracingController&) = delete;
Expand Down
5 changes: 0 additions & 5 deletions deps/v8/include/v8-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,6 @@ class TracingController {
public:
virtual ~TracingController() = default;

// In Perfetto mode, trace events are written using Perfetto's Track Event
// API directly without going through the embedder. However, it is still
// possible to observe tracing being enabled and disabled.
#if !defined(V8_USE_PERFETTO)
/**
* Called by TRACE_EVENT* macros, don't call this directly.
* The name parameter is a category group for example:
Expand Down Expand Up @@ -285,7 +281,6 @@ class TracingController {
**/
virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
const char* name, uint64_t handle) {}
#endif // !defined(V8_USE_PERFETTO)

class TraceStateObserver {
public:
Expand Down

0 comments on commit 2079fef

Please sign in to comment.