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

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

Issue 1588563004: tracing: Fix AddMetadataEvent race in presence of Convertable arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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 <utility> 9 #include <utility>
10 10
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 1343
1344 void TraceLog::AddMetadataEvent( 1344 void TraceLog::AddMetadataEvent(
1345 const char* name, 1345 const char* name,
1346 int num_args, 1346 int num_args,
1347 const char** arg_names, 1347 const char** arg_names,
1348 const unsigned char* arg_types, 1348 const unsigned char* arg_types,
1349 const unsigned long long* arg_values, 1349 const unsigned long long* arg_values,
1350 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, 1350 const scoped_refptr<ConvertableToTraceFormat>* convertable_values,
1351 unsigned int flags) { 1351 unsigned int flags) {
1352 scoped_ptr<TraceEvent> trace_event(new TraceEvent); 1352 scoped_ptr<TraceEvent> trace_event(new TraceEvent);
1353 AutoLock lock(lock_);
1353 trace_event->Initialize( 1354 trace_event->Initialize(
1354 0, // thread_id 1355 0, // thread_id
1355 TimeTicks(), ThreadTicks(), TRACE_EVENT_PHASE_METADATA, 1356 TimeTicks(), ThreadTicks(), TRACE_EVENT_PHASE_METADATA,
1356 &g_category_group_enabled[g_category_metadata], name, 1357 &g_category_group_enabled[g_category_metadata], name,
1357 trace_event_internal::kNoId, // id 1358 trace_event_internal::kNoId, // id
1358 trace_event_internal::kNoId, // bind_id 1359 trace_event_internal::kNoId, // bind_id
1359 num_args, arg_names, arg_types, arg_values, convertable_values, flags); 1360 num_args, arg_names, arg_types, arg_values, convertable_values, flags);
1360 AutoLock lock(lock_);
1361 metadata_events_.push_back(std::move(trace_event)); 1361 metadata_events_.push_back(std::move(trace_event));
1362 } 1362 }
1363 1363
1364 // May be called when a COMPELETE event ends and the unfinished event has been 1364 // May be called when a COMPELETE event ends and the unfinished event has been
1365 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). 1365 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL).
1366 std::string TraceLog::EventToConsoleMessage(unsigned char phase, 1366 std::string TraceLog::EventToConsoleMessage(unsigned char phase,
1367 const TimeTicks& timestamp, 1367 const TimeTicks& timestamp,
1368 TraceEvent* trace_event) { 1368 TraceEvent* trace_event) {
1369 AutoLock thread_info_lock(thread_info_lock_); 1369 AutoLock thread_info_lock(thread_info_lock_);
1370 1370
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 } 1738 }
1739 1739
1740 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 1740 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
1741 if (*category_group_enabled_) { 1741 if (*category_group_enabled_) {
1742 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, 1742 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_,
1743 event_handle_); 1743 event_handle_);
1744 } 1744 }
1745 } 1745 }
1746 1746
1747 } // namespace trace_event_internal 1747 } // namespace trace_event_internal
OLDNEW
« 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