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

Side by Side Diff: base/metrics/persistent_histogram_allocator.cc

Issue 1885933002: Ensure that DLOG(FATAL) also asserts in release-with-asserts builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment with installer fix Created 4 years, 8 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/message_loop/incoming_task_queue.cc ('k') | base/threading/platform_thread_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/metrics/persistent_histogram_allocator.h" 5 #include "base/metrics/persistent_histogram_allocator.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (!histogram_pointer) { 153 if (!histogram_pointer) {
154 // It's possible for multiple threads to make it here in parallel but 154 // It's possible for multiple threads to make it here in parallel but
155 // they'll always return the same result as there is a mutex in the Get. 155 // they'll always return the same result as there is a mutex in the Get.
156 // The purpose of the "initialized" variable is just to ensure that 156 // The purpose of the "initialized" variable is just to ensure that
157 // the same thread doesn't recurse which is also why it doesn't have 157 // the same thread doesn't recurse which is also why it doesn't have
158 // to be atomic. 158 // to be atomic.
159 static bool initialized = false; 159 static bool initialized = false;
160 if (!initialized) { 160 if (!initialized) {
161 initialized = true; 161 initialized = true;
162 if (g_allocator) { 162 if (g_allocator) {
163 // Don't log in release-with-asserts builds, otherwise the test_installer step
164 // fails because this code writes to a log file before the installer code had a
165 // chance to set the log file's location.
166 #if !defined(DCHECK_ALWAYS_ON)
163 DLOG(WARNING) << "Creating the results-histogram inside persistent" 167 DLOG(WARNING) << "Creating the results-histogram inside persistent"
164 << " memory can cause future allocations to crash if" 168 << " memory can cause future allocations to crash if"
165 << " that memory is ever released (for testing)."; 169 << " that memory is ever released (for testing).";
170 #endif
166 } 171 }
167 172
168 histogram_pointer = LinearHistogram::FactoryGet( 173 histogram_pointer = LinearHistogram::FactoryGet(
169 kResultHistogram, 1, CREATE_HISTOGRAM_MAX, CREATE_HISTOGRAM_MAX + 1, 174 kResultHistogram, 1, CREATE_HISTOGRAM_MAX, CREATE_HISTOGRAM_MAX + 1,
170 HistogramBase::kUmaTargetedHistogramFlag); 175 HistogramBase::kUmaTargetedHistogramFlag);
171 base::subtle::Release_Store( 176 base::subtle::Release_Store(
172 &atomic_histogram_pointer, 177 &atomic_histogram_pointer,
173 reinterpret_cast<base::subtle::AtomicWord>(histogram_pointer)); 178 reinterpret_cast<base::subtle::AtomicWord>(histogram_pointer));
174 } 179 }
175 } 180 }
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 while (true) { 588 while (true) {
584 std::unique_ptr<HistogramBase> histogram = 589 std::unique_ptr<HistogramBase> histogram =
585 import_iterator_.GetNextWithIgnore(record_to_ignore); 590 import_iterator_.GetNextWithIgnore(record_to_ignore);
586 if (!histogram) 591 if (!histogram)
587 break; 592 break;
588 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); 593 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release());
589 } 594 }
590 } 595 }
591 596
592 } // namespace base 597 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/incoming_task_queue.cc ('k') | base/threading/platform_thread_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698