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

Unified Diff: base/trace_event/trace_buffer.cc

Issue 1459143002: Remove ScopedVector from trace_buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_buffer.cc
diff --git a/base/trace_event/trace_buffer.cc b/base/trace_event/trace_buffer.cc
index a2e4f141ef431941ea0147b3a5e015197f8496f0..81db15d9d510c66505ff98d6a93192242d89461f 100644
--- a/base/trace_event/trace_buffer.cc
+++ b/base/trace_event/trace_buffer.cc
@@ -38,7 +38,7 @@ class TraceBufferRingBuffer : public TraceBuffer {
if (*index >= chunks_.size())
chunks_.resize(*index + 1);
- TraceBufferChunk* chunk = chunks_[*index];
+ TraceBufferChunk* chunk = chunks_[*index].release();
chunks_[*index] = NULL; // Put NULL in the slot of a in-flight chunk.
if (chunk)
chunk->Reset(current_chunk_seq_++);
@@ -55,7 +55,7 @@ class TraceBufferRingBuffer : public TraceBuffer {
DCHECK(chunk);
DCHECK_LT(index, chunks_.size());
DCHECK(!chunks_[index]);
- chunks_[index] = chunk.release();
+ chunks_[index] = std::move(chunk);
recyclable_chunks_queue_[queue_tail_] = index;
queue_tail_ = NextQueueIndex(queue_tail_);
}
@@ -74,7 +74,7 @@ class TraceBufferRingBuffer : public TraceBuffer {
TraceEvent* GetEventByHandle(TraceEventHandle handle) override {
if (handle.chunk_index >= chunks_.size())
return NULL;
- TraceBufferChunk* chunk = chunks_[handle.chunk_index];
+ TraceBufferChunk* chunk = chunks_[handle.chunk_index].get();
if (!chunk || chunk->seq() != handle.chunk_seq)
return NULL;
return chunk->GetEventAt(handle.event_index);
@@ -90,7 +90,7 @@ class TraceBufferRingBuffer : public TraceBuffer {
if (chunk_index >= chunks_.size()) // Skip uninitialized chunks.
continue;
DCHECK(chunks_[chunk_index]);
- return chunks_[chunk_index];
+ return chunks_[chunk_index].get();
}
return NULL;
}
@@ -102,8 +102,9 @@ class TraceBufferRingBuffer : public TraceBuffer {
size_t chunk_index = recyclable_chunks_queue_[queue_index];
if (chunk_index >= chunks_.size()) // Skip uninitialized chunks.
continue;
- TraceBufferChunk* chunk = chunks_[chunk_index];
- cloned_buffer->chunks_.push_back(chunk ? chunk->Clone().release() : NULL);
+ TraceBufferChunk* chunk = chunks_[chunk_index].get();
+ cloned_buffer->chunks_.push_back(chunk ? chunk->Clone()
Primiano Tucci (use gerrit) 2015/11/26 15:47:14 doesn't this fit on one line?
+ : NULL);
}
return cloned_buffer.Pass();
}
@@ -128,7 +129,7 @@ class TraceBufferRingBuffer : public TraceBuffer {
// The only implemented method.
const TraceBufferChunk* NextChunk() override {
return current_iteration_index_ < chunks_.size()
- ? chunks_[current_iteration_index_++]
+ ? chunks_[current_iteration_index_++].get()
: NULL;
}
@@ -155,7 +156,7 @@ class TraceBufferRingBuffer : public TraceBuffer {
}
size_t current_iteration_index_;
- ScopedVector<TraceBufferChunk> chunks_;
+ std::vector<scoped_ptr<TraceBufferChunk>> chunks_;
};
bool QueueIsEmpty() const { return queue_head_ == queue_tail_; }
@@ -181,7 +182,7 @@ class TraceBufferRingBuffer : public TraceBuffer {
}
size_t max_chunks_;
- ScopedVector<TraceBufferChunk> chunks_;
+ std::vector<scoped_ptr<TraceBufferChunk>> chunks_;
scoped_ptr<size_t[]> recyclable_chunks_queue_;
size_t queue_head_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698