Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4173)

Unified Diff: base/trace_event/trace_event_impl.h

Issue 1239593002: Implement a new flow event API that allows binding flow events and regular events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove a redundant macro. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/trace_event/trace_event_impl.h
diff --git a/base/trace_event/trace_event_impl.h b/base/trace_event/trace_event_impl.h
index ccb850033e1926d59ff4396b8a9bb36acf61a109..f89f53a1e0bee3b002098d19452717f97fb3746a 100644
--- a/base/trace_event/trace_event_impl.h
+++ b/base/trace_event/trace_event_impl.h
@@ -104,6 +104,10 @@ class BASE_EXPORT TraceEvent {
TraceEvent();
~TraceEvent();
+ void appendFlowEvent(TraceEvent *flowEvent) {
+ flowEvent_ = flowEvent;
+ }
+
// We don't need to copy TraceEvent except when TraceEventBuffer is cloned.
// Use explicit copy method to avoid accidentally misuse of copy.
void CopyFrom(const TraceEvent& other);
@@ -149,6 +153,7 @@ class BASE_EXPORT TraceEvent {
TimeDelta thread_duration() const { return thread_duration_; }
unsigned long long id() const { return id_; }
unsigned char flags() const { return flags_; }
+ bool isFlowEvent() const;
// Exposed for unittesting:
@@ -185,6 +190,7 @@ class BASE_EXPORT TraceEvent {
char phase_;
unsigned char flags_;
unsigned char arg_types_[kTraceMaxNumArgs];
+ TraceEvent *flowEvent_;
DISALLOW_COPY_AND_ASSIGN(TraceEvent);
};
@@ -709,6 +715,32 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
DISALLOW_COPY_AND_ASSIGN(TraceLog);
};
+class TraceEventHandleWrapper {
+public:
+ TraceEventHandleWrapper() {
+ handle_ = {0, 0, 0};
+ event_ = NULL;
+ }
+ TraceEventHandleWrapper(TraceEventHandle h) {
+ handle_ = h;
+ TraceLog* tracer = base::trace_event::TraceLog::GetInstance();
+ event_ = tracer->GetEventByHandle(h);
+ }
+
+ void appendFlowEvent(TraceEventHandle h) {
+ if (event_) {
+ TraceLog* tracer = base::trace_event::TraceLog::GetInstance();
+ TraceEvent *flowEvent = tracer->GetEventByHandle(h);
+ event_->appendFlowEvent(flowEvent);
+ }
+ }
+
+private:
+ TraceEventHandle handle_;
+ TraceEvent *event_;
+};
+
+
} // namespace trace_event
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698