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

Side by Side Diff: base/trace_event/trace_log.cc

Issue 2101263003: base: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « base/trace_event/trace_event_argument.cc ('k') | no next file » | 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 #include "base/trace_event/trace_log.h" 5 #include "base/trace_event/trace_log.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 void TraceLog::InitializeThreadLocalEventBufferIfSupported() { 396 void TraceLog::InitializeThreadLocalEventBufferIfSupported() {
397 // A ThreadLocalEventBuffer needs the message loop 397 // A ThreadLocalEventBuffer needs the message loop
398 // - to know when the thread exits; 398 // - to know when the thread exits;
399 // - to handle the final flush. 399 // - to handle the final flush.
400 // For a thread without a message loop or the message loop may be blocked, the 400 // For a thread without a message loop or the message loop may be blocked, the
401 // trace events will be added into the main buffer directly. 401 // trace events will be added into the main buffer directly.
402 if (thread_blocks_message_loop_.Get() || !MessageLoop::current()) 402 if (thread_blocks_message_loop_.Get() || !MessageLoop::current())
403 return; 403 return;
404 HEAP_PROFILER_SCOPED_IGNORE; 404 HEAP_PROFILER_SCOPED_IGNORE;
405 auto thread_local_event_buffer = thread_local_event_buffer_.Get(); 405 auto* thread_local_event_buffer = thread_local_event_buffer_.Get();
406 if (thread_local_event_buffer && 406 if (thread_local_event_buffer &&
407 !CheckGeneration(thread_local_event_buffer->generation())) { 407 !CheckGeneration(thread_local_event_buffer->generation())) {
408 delete thread_local_event_buffer; 408 delete thread_local_event_buffer;
409 thread_local_event_buffer = NULL; 409 thread_local_event_buffer = NULL;
410 } 410 }
411 if (!thread_local_event_buffer) { 411 if (!thread_local_event_buffer) {
412 thread_local_event_buffer = new ThreadLocalEventBuffer(this); 412 thread_local_event_buffer = new ThreadLocalEventBuffer(this);
413 thread_local_event_buffer_.Set(thread_local_event_buffer); 413 thread_local_event_buffer_.Set(thread_local_event_buffer);
414 } 414 }
415 } 415 }
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 bind_id = MangleEventId(bind_id); 1220 bind_id = MangleEventId(bind_id);
1221 id = MangleEventId(id); 1221 id = MangleEventId(id);
1222 } 1222 }
1223 1223
1224 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); 1224 TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp);
1225 ThreadTicks thread_now = ThreadNow(); 1225 ThreadTicks thread_now = ThreadNow();
1226 1226
1227 // |thread_local_event_buffer_| can be null if the current thread doesn't have 1227 // |thread_local_event_buffer_| can be null if the current thread doesn't have
1228 // a message loop or the message loop is blocked. 1228 // a message loop or the message loop is blocked.
1229 InitializeThreadLocalEventBufferIfSupported(); 1229 InitializeThreadLocalEventBufferIfSupported();
1230 auto thread_local_event_buffer = thread_local_event_buffer_.Get(); 1230 auto* thread_local_event_buffer = thread_local_event_buffer_.Get();
1231 1231
1232 // Check and update the current thread name only if the event is for the 1232 // Check and update the current thread name only if the event is for the
1233 // current thread to avoid locks in most cases. 1233 // current thread to avoid locks in most cases.
1234 if (thread_id == static_cast<int>(PlatformThread::CurrentId())) { 1234 if (thread_id == static_cast<int>(PlatformThread::CurrentId())) {
1235 const char* new_name = 1235 const char* new_name =
1236 ThreadIdNameManager::GetInstance()->GetName(thread_id); 1236 ThreadIdNameManager::GetInstance()->GetName(thread_id);
1237 // Check if the thread name has been set or changed since the previous 1237 // Check if the thread name has been set or changed since the previous
1238 // call (if any), but don't bother if the new name is empty. Note this will 1238 // call (if any), but don't bother if the new name is empty. Note this will
1239 // not detect a thread name change within the same char* buffer address: we 1239 // not detect a thread name change within the same char* buffer address: we
1240 // favor common case performance over corner case correctness. 1240 // favor common case performance over corner case correctness.
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 } 1792 }
1793 1793
1794 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 1794 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
1795 if (*category_group_enabled_) { 1795 if (*category_group_enabled_) {
1796 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, 1796 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_,
1797 event_handle_); 1797 event_handle_);
1798 } 1798 }
1799 } 1799 }
1800 1800
1801 } // namespace trace_event_internal 1801 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_argument.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698