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

Unified Diff: base/trace_event/thread_local_event_buffer.h

Issue 2503473002: tracing: split out ThreadLocalEventBuffer
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/thread_local_event_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/thread_local_event_buffer.h
diff --git a/base/trace_event/thread_local_event_buffer.h b/base/trace_event/thread_local_event_buffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..274638ed5b1f8f7cc52955dbea64b48a7e3a9978
--- /dev/null
+++ b/base/trace_event/thread_local_event_buffer.h
@@ -0,0 +1,44 @@
+ // Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TRACE_EVENT_THREAD_LOCAL_EVENT_BUFFER_H_
+#define BASE_TRACE_EVENT_THREAD_LOCAL_EVENT_BUFFER_H_
+
+#include <memory>
+
+#include "base/base_export.h"
+#include "base/macros.h"
+#include "base/threading/thread_checker.h"
+
+namespace base {
+namespace trace_event {
+
+class TraceBufferChunk;
+struct TraceEventHandle;
+class TraceEvent;
+
+class BASE_EXPORT ThreadLocalEventBuffer {
+ public:
+ ThreadLocalEventBuffer(int generation);
+ ~ThreadLocalEventBuffer();
+
+ TraceEvent* AddTraceEvent(TraceEventHandle* handle);
+ TraceEvent* GetEventByHandle(TraceEventHandle handle);
+ void Flush();
+ int generation() const { return generation_; }
+ TraceBufferChunk* chunk() const { return chunk_.get(); }
+
+ private:
+ std::unique_ptr<TraceBufferChunk> chunk_;
+ ThreadChecker thread_checker_;
+ size_t chunk_index_;
+ const int generation_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadLocalEventBuffer);
+};
+
+} // namespace trace_event
+} // namespace base
+
+#endif // BASE_TRACE_EVENT_THREAD_LOCAL_EVENT_BUFFER_H_
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/thread_local_event_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698