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

Side by Side Diff: base/trace_event/trace_buffer.h

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « base/trace_event/process_memory_dump_unittest.cc ('k') | base/trace_event/trace_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TRACE_EVENT_TRACE_BUFFER_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_BUFFER_H_
6 #define BASE_TRACE_EVENT_TRACE_BUFFER_H_ 6 #define BASE_TRACE_EVENT_TRACE_BUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); 42 void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead);
43 43
44 // These values must be kept consistent with the numbers of bits of 44 // These values must be kept consistent with the numbers of bits of
45 // chunk_index and event_index fields in TraceEventHandle 45 // chunk_index and event_index fields in TraceEventHandle
46 // (in trace_event_impl.h). 46 // (in trace_event_impl.h).
47 static const size_t kMaxChunkIndex = (1u << 26) - 1; 47 static const size_t kMaxChunkIndex = (1u << 26) - 1;
48 static const size_t kTraceBufferChunkSize = 64; 48 static const size_t kTraceBufferChunkSize = 64;
49 49
50 private: 50 private:
51 size_t next_free_; 51 size_t next_free_;
52 scoped_ptr<TraceEventMemoryOverhead> cached_overhead_estimate_; 52 std::unique_ptr<TraceEventMemoryOverhead> cached_overhead_estimate_;
53 TraceEvent chunk_[kTraceBufferChunkSize]; 53 TraceEvent chunk_[kTraceBufferChunkSize];
54 uint32_t seq_; 54 uint32_t seq_;
55 }; 55 };
56 56
57 // TraceBuffer holds the events as they are collected. 57 // TraceBuffer holds the events as they are collected.
58 class BASE_EXPORT TraceBuffer { 58 class BASE_EXPORT TraceBuffer {
59 public: 59 public:
60 virtual ~TraceBuffer() {} 60 virtual ~TraceBuffer() {}
61 61
62 virtual scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) = 0; 62 virtual std::unique_ptr<TraceBufferChunk> GetChunk(size_t* index) = 0;
63 virtual void ReturnChunk(size_t index, 63 virtual void ReturnChunk(size_t index,
64 scoped_ptr<TraceBufferChunk> chunk) = 0; 64 std::unique_ptr<TraceBufferChunk> chunk) = 0;
65 65
66 virtual bool IsFull() const = 0; 66 virtual bool IsFull() const = 0;
67 virtual size_t Size() const = 0; 67 virtual size_t Size() const = 0;
68 virtual size_t Capacity() const = 0; 68 virtual size_t Capacity() const = 0;
69 virtual TraceEvent* GetEventByHandle(TraceEventHandle handle) = 0; 69 virtual TraceEvent* GetEventByHandle(TraceEventHandle handle) = 0;
70 70
71 // For iteration. Each TraceBuffer can only be iterated once. 71 // For iteration. Each TraceBuffer can only be iterated once.
72 virtual const TraceBufferChunk* NextChunk() = 0; 72 virtual const TraceBufferChunk* NextChunk() = 0;
73 73
74 74
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 private: 122 private:
123 OutputCallback output_callback_; 123 OutputCallback output_callback_;
124 bool append_comma_; 124 bool append_comma_;
125 }; 125 };
126 126
127 } // namespace trace_event 127 } // namespace trace_event
128 } // namespace base 128 } // namespace base
129 129
130 #endif // BASE_TRACE_EVENT_TRACE_BUFFER_H_ 130 #endif // BASE_TRACE_EVENT_TRACE_BUFFER_H_
OLDNEW
« no previous file with comments | « base/trace_event/process_memory_dump_unittest.cc ('k') | base/trace_event/trace_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698