| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 virtual scoped_ptr<TraceBuffer> CloneForIteration() const override { | 215 virtual scoped_ptr<TraceBuffer> CloneForIteration() const override { |
| 216 scoped_ptr<ClonedTraceBuffer> cloned_buffer(new ClonedTraceBuffer()); | 216 scoped_ptr<ClonedTraceBuffer> cloned_buffer(new ClonedTraceBuffer()); |
| 217 for (size_t queue_index = queue_head_; queue_index != queue_tail_; | 217 for (size_t queue_index = queue_head_; queue_index != queue_tail_; |
| 218 queue_index = NextQueueIndex(queue_index)) { | 218 queue_index = NextQueueIndex(queue_index)) { |
| 219 size_t chunk_index = recyclable_chunks_queue_[queue_index]; | 219 size_t chunk_index = recyclable_chunks_queue_[queue_index]; |
| 220 if (chunk_index >= chunks_.size()) // Skip uninitialized chunks. | 220 if (chunk_index >= chunks_.size()) // Skip uninitialized chunks. |
| 221 continue; | 221 continue; |
| 222 TraceBufferChunk* chunk = chunks_[chunk_index]; | 222 TraceBufferChunk* chunk = chunks_[chunk_index]; |
| 223 cloned_buffer->chunks_.push_back(chunk ? chunk->Clone().release() : NULL); | 223 cloned_buffer->chunks_.push_back(chunk ? chunk->Clone().release() : NULL); |
| 224 } | 224 } |
| 225 return cloned_buffer.PassAs<TraceBuffer>(); | 225 return cloned_buffer.Pass(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 private: | 228 private: |
| 229 class ClonedTraceBuffer : public TraceBuffer { | 229 class ClonedTraceBuffer : public TraceBuffer { |
| 230 public: | 230 public: |
| 231 ClonedTraceBuffer() : current_iteration_index_(0) {} | 231 ClonedTraceBuffer() : current_iteration_index_(0) {} |
| 232 | 232 |
| 233 // The only implemented method. | 233 // The only implemented method. |
| 234 virtual const TraceBufferChunk* NextChunk() override { | 234 virtual const TraceBufferChunk* NextChunk() override { |
| 235 return current_iteration_index_ < chunks_.size() ? | 235 return current_iteration_index_ < chunks_.size() ? |
| (...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2571 } | 2571 } |
| 2572 | 2572 |
| 2573 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2573 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 2574 if (*category_group_enabled_) { | 2574 if (*category_group_enabled_) { |
| 2575 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2575 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
| 2576 name_, event_handle_); | 2576 name_, event_handle_); |
| 2577 } | 2577 } |
| 2578 } | 2578 } |
| 2579 | 2579 |
| 2580 } // namespace trace_event_internal | 2580 } // namespace trace_event_internal |
| OLD | NEW |