Skip to content

Commit 2079fef

Browse files
addaleaxMylesBorins
authored andcommitted
deps: V8: undo header change of 9dbab9bbdb979
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>
1 parent 1af8943 commit 2079fef

File tree

2 files changed

+20
-39
lines changed

2 files changed

+20
-39
lines changed

deps/v8/include/libplatform/v8-tracing.h

+20-34
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
#include "v8-platform.h" // NOLINT(build/include_directory)
1616

1717
namespace perfetto {
18-
namespace trace_processor {
19-
class TraceProcessorStorage;
20-
}
2118
class TracingSession;
2219
}
2320

@@ -31,6 +28,7 @@ namespace platform {
3128
namespace tracing {
3229

3330
class TraceEventListener;
31+
class JSONTraceEventListener;
3432

3533
const int kTraceMaxNumArgs = 2;
3634

@@ -199,9 +197,6 @@ class V8_PLATFORM_EXPORT TraceConfig {
199197

200198
TraceConfig() : enable_systrace_(false), enable_argument_filter_(false) {}
201199
TraceRecordMode GetTraceRecordMode() const { return record_mode_; }
202-
const StringList& GetEnabledCategories() const {
203-
return included_categories_;
204-
}
205200
bool IsSystraceEnabled() const { return enable_systrace_; }
206201
bool IsArgumentFilterEnabled() const { return enable_argument_filter_; }
207202

@@ -234,17 +229,6 @@ class V8_PLATFORM_EXPORT TraceConfig {
234229
class V8_PLATFORM_EXPORT TracingController
235230
: public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) {
236231
public:
237-
TracingController();
238-
~TracingController() override;
239-
240-
#if defined(V8_USE_PERFETTO)
241-
// Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides
242-
// the output stream for the JSON trace data.
243-
void InitializeForPerfetto(std::ostream* output_stream);
244-
// Provide an optional listener for testing that will receive trace events.
245-
// Must be called before StartTracing().
246-
void SetTraceEventListenerForTesting(TraceEventListener* listener);
247-
#else // defined(V8_USE_PERFETTO)
248232
// The pointer returned from GetCategoryGroupEnabled() points to a value with
249233
// zero or more of the following bits. Used in this class only. The
250234
// TRACE_EVENT macros should only use the value as a bool. These values must
@@ -258,8 +242,19 @@ class V8_PLATFORM_EXPORT TracingController
258242
ENABLED_FOR_ETW_EXPORT = 1 << 3
259243
};
260244

245+
TracingController();
246+
~TracingController() override;
247+
261248
// Takes ownership of |trace_buffer|.
262249
void Initialize(TraceBuffer* trace_buffer);
250+
#ifdef V8_USE_PERFETTO
251+
// Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides
252+
// the output stream for the JSON trace data.
253+
void InitializeForPerfetto(std::ostream* output_stream);
254+
// Provide an optional listener for testing that will receive trace events.
255+
// Must be called before StartTracing().
256+
void SetTraceEventListenerForTesting(TraceEventListener* listener);
257+
#endif
263258

264259
// v8::TracingController implementation.
265260
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
@@ -279,10 +274,6 @@ class V8_PLATFORM_EXPORT TracingController
279274
unsigned int flags, int64_t timestamp) override;
280275
void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
281276
const char* name, uint64_t handle) override;
282-
283-
static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
284-
#endif // !defined(V8_USE_PERFETTO)
285-
286277
void AddTraceStateObserver(
287278
v8::TracingController::TraceStateObserver* observer) override;
288279
void RemoveTraceStateObserver(
@@ -291,32 +282,27 @@ class V8_PLATFORM_EXPORT TracingController
291282
void StartTracing(TraceConfig* trace_config);
292283
void StopTracing();
293284

285+
static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
286+
294287
protected:
295-
#if !defined(V8_USE_PERFETTO)
296288
virtual int64_t CurrentTimestampMicroseconds();
297289
virtual int64_t CurrentCpuTimestampMicroseconds();
298-
#endif // !defined(V8_USE_PERFETTO)
299290

300291
private:
301-
#if !defined(V8_USE_PERFETTO)
302292
void UpdateCategoryGroupEnabledFlag(size_t category_index);
303293
void UpdateCategoryGroupEnabledFlags();
304-
#endif // !defined(V8_USE_PERFETTO)
305294

306-
std::unique_ptr<base::Mutex> mutex_;
295+
std::unique_ptr<TraceBuffer> trace_buffer_;
307296
std::unique_ptr<TraceConfig> trace_config_;
308-
std::atomic_bool recording_{false};
297+
std::unique_ptr<base::Mutex> mutex_;
309298
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
310-
311-
#if defined(V8_USE_PERFETTO)
299+
std::atomic_bool recording_{false};
300+
#ifdef V8_USE_PERFETTO
312301
std::ostream* output_stream_ = nullptr;
313-
std::unique_ptr<perfetto::trace_processor::TraceProcessorStorage>
314-
trace_processor_;
302+
std::unique_ptr<JSONTraceEventListener> json_listener_;
315303
TraceEventListener* listener_for_testing_ = nullptr;
316304
std::unique_ptr<perfetto::TracingSession> tracing_session_;
317-
#else // !defined(V8_USE_PERFETTO)
318-
std::unique_ptr<TraceBuffer> trace_buffer_;
319-
#endif // !defined(V8_USE_PERFETTO)
305+
#endif
320306

321307
// Disallow copy and assign
322308
TracingController(const TracingController&) = delete;

deps/v8/include/v8-platform.h

-5
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,6 @@ class TracingController {
236236
public:
237237
virtual ~TracingController() = default;
238238

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

290285
class TraceStateObserver {
291286
public:

0 commit comments

Comments
 (0)