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

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

Issue 1319183002: [ETW] Fix wrong index in UpdateETWCategoryGroupEnabledFlags resulting in overflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 void TraceLog::UpdateETWCategoryGroupEnabledFlags() { 1711 void TraceLog::UpdateETWCategoryGroupEnabledFlags() {
1712 AutoLock lock(lock_); 1712 AutoLock lock(lock_);
1713 size_t category_index = base::subtle::NoBarrier_Load(&g_category_index); 1713 size_t category_index = base::subtle::NoBarrier_Load(&g_category_index);
1714 // Go through each category and set/clear the ETW bit depending on whether the 1714 // Go through each category and set/clear the ETW bit depending on whether the
1715 // category is enabled. 1715 // category is enabled.
1716 for (size_t i = 0; i < category_index; i++) { 1716 for (size_t i = 0; i < category_index; i++) {
1717 const char* category_group = g_category_groups[i]; 1717 const char* category_group = g_category_groups[i];
1718 DCHECK(category_group); 1718 DCHECK(category_group);
1719 if (base::trace_event::TraceEventETWExport::IsCategoryGroupEnabled( 1719 if (base::trace_event::TraceEventETWExport::IsCategoryGroupEnabled(
1720 category_group)) { 1720 category_group)) {
1721 g_category_group_enabled[category_index] |= ENABLED_FOR_ETW_EXPORT; 1721 g_category_group_enabled[i] |= ENABLED_FOR_ETW_EXPORT;
1722 } else { 1722 } else {
1723 g_category_group_enabled[category_index] &= ~ENABLED_FOR_ETW_EXPORT; 1723 g_category_group_enabled[i] &= ~ENABLED_FOR_ETW_EXPORT;
1724 } 1724 }
1725 } 1725 }
1726 } 1726 }
1727 #endif // defined(OS_WIN) 1727 #endif // defined(OS_WIN)
1728 1728
1729 void ConvertableToTraceFormat::EstimateTraceMemoryOverhead( 1729 void ConvertableToTraceFormat::EstimateTraceMemoryOverhead(
1730 TraceEventMemoryOverhead* overhead) { 1730 TraceEventMemoryOverhead* overhead) {
1731 overhead->Add("ConvertableToTraceFormat(Unknown)", sizeof(*this)); 1731 overhead->Add("ConvertableToTraceFormat(Unknown)", sizeof(*this));
1732 } 1732 }
1733 1733
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 } 1765 }
1766 1766
1767 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 1767 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
1768 if (*category_group_enabled_) { 1768 if (*category_group_enabled_) {
1769 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, 1769 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_,
1770 event_handle_); 1770 event_handle_);
1771 } 1771 }
1772 } 1772 }
1773 1773
1774 } // namespace trace_event_internal 1774 } // 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