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

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

Issue 2638093002: Don't crash debug builds for full allocator. (Closed)
Patch Set: added comment Created 3 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 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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 CreateHistogramResultType result; 396 CreateHistogramResultType result;
397 if (memory_allocator_->IsCorrupt()) { 397 if (memory_allocator_->IsCorrupt()) {
398 RecordCreateHistogramResult(CREATE_HISTOGRAM_ALLOCATOR_NEWLY_CORRUPT); 398 RecordCreateHistogramResult(CREATE_HISTOGRAM_ALLOCATOR_NEWLY_CORRUPT);
399 result = CREATE_HISTOGRAM_ALLOCATOR_CORRUPT; 399 result = CREATE_HISTOGRAM_ALLOCATOR_CORRUPT;
400 } else if (memory_allocator_->IsFull()) { 400 } else if (memory_allocator_->IsFull()) {
401 result = CREATE_HISTOGRAM_ALLOCATOR_FULL; 401 result = CREATE_HISTOGRAM_ALLOCATOR_FULL;
402 } else { 402 } else {
403 result = CREATE_HISTOGRAM_ALLOCATOR_ERROR; 403 result = CREATE_HISTOGRAM_ALLOCATOR_ERROR;
404 } 404 }
405 RecordCreateHistogramResult(result); 405 RecordCreateHistogramResult(result);
406 NOTREACHED() << "error=" << result; 406
407 // Crash for failures caused by internal bugs but not "full" which is
408 // dependent on outside code.
409 if (result != CREATE_HISTOGRAM_ALLOCATOR_FULL)
410 NOTREACHED() << memory_allocator_->Name() << ", error=" << result;
407 411
408 return nullptr; 412 return nullptr;
409 } 413 }
410 414
411 void PersistentHistogramAllocator::FinalizeHistogram(Reference ref, 415 void PersistentHistogramAllocator::FinalizeHistogram(Reference ref,
412 bool registered) { 416 bool registered) {
413 if (registered) { 417 if (registered) {
414 // If the created persistent histogram was registered then it needs to 418 // If the created persistent histogram was registered then it needs to
415 // be marked as "iterable" in order to be found by other processes. This 419 // be marked as "iterable" in order to be found by other processes. This
416 // happens only after the histogram is fully formed so it's impossible for 420 // happens only after the histogram is fully formed so it's impossible for
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 while (true) { 936 while (true) {
933 std::unique_ptr<HistogramBase> histogram = 937 std::unique_ptr<HistogramBase> histogram =
934 import_iterator_.GetNextWithIgnore(record_to_ignore); 938 import_iterator_.GetNextWithIgnore(record_to_ignore);
935 if (!histogram) 939 if (!histogram)
936 break; 940 break;
937 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); 941 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release());
938 } 942 }
939 } 943 }
940 944
941 } // namespace base 945 } // namespace base
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