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

Side by Side Diff: chrome/common/metrics/metrics_log_manager.cc

Issue 10692059: Make metrics state machine more lenient about OLD vs. CURRENT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing return Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/metrics/metrics_service.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/metrics/metrics_log_manager.h" 5 #include "chrome/common/metrics/metrics_log_manager.h"
6 6
7 #if defined(USE_SYSTEM_LIBBZ2) 7 #if defined(USE_SYSTEM_LIBBZ2)
8 #include <bzlib.h> 8 #include <bzlib.h>
9 #else 9 #else
10 #include "third_party/bzip2/bzlib.h" 10 #include "third_party/bzip2/bzlib.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 current_log_type_ = NO_LOG; 68 current_log_type_ = NO_LOG;
69 } 69 }
70 70
71 void MetricsLogManager::StageNextLogForUpload() { 71 void MetricsLogManager::StageNextLogForUpload() {
72 // Prioritize initial logs for uploading. 72 // Prioritize initial logs for uploading.
73 std::vector<SerializedLog>* source_list = 73 std::vector<SerializedLog>* source_list =
74 unsent_initial_logs_.empty() ? &unsent_ongoing_logs_ 74 unsent_initial_logs_.empty() ? &unsent_ongoing_logs_
75 : &unsent_initial_logs_; 75 : &unsent_initial_logs_;
76 LogType source_type = (source_list == &unsent_ongoing_logs_) ? ONGOING_LOG 76 LogType source_type = (source_list == &unsent_ongoing_logs_) ? ONGOING_LOG
77 : INITIAL_LOG; 77 : INITIAL_LOG;
78 DCHECK(!source_list->empty()); 78 // CHECK, rather than DCHECK, because swap()ing with an empty list causes
79 // hard-to-identify crashes much later.
80 CHECK(!source_list->empty());
79 DCHECK(staged_log_text_.empty()); 81 DCHECK(staged_log_text_.empty());
80 DCHECK(staged_log_type_ == NO_LOG); 82 DCHECK(staged_log_type_ == NO_LOG);
81 staged_log_text_.swap(source_list->back()); 83 staged_log_text_.swap(source_list->back());
82 staged_log_type_ = source_type; 84 staged_log_type_ = source_type;
83 source_list->pop_back(); 85 source_list->pop_back();
84 86
85 // If the staged log was the last provisional store, clear that. 87 // If the staged log was the last provisional store, clear that.
86 if (last_provisional_store_index_ != -1) { 88 if (last_provisional_store_index_ != -1) {
87 if (source_type == last_provisional_store_type_ && 89 if (source_type == last_provisional_store_type_ &&
88 static_cast<unsigned int>(last_provisional_store_index_) == 90 static_cast<unsigned int>(last_provisional_store_index_) ==
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // TODO(jar): See if it would be better to do a CHECK() here. 281 // TODO(jar): See if it would be better to do a CHECK() here.
280 return false; 282 return false;
281 } 283 }
282 result = BZ2_bzCompressEnd(&stream); 284 result = BZ2_bzCompressEnd(&stream);
283 DCHECK(result == BZ_OK); 285 DCHECK(result == BZ_OK);
284 286
285 output->resize(stream.total_out_lo32); 287 output->resize(stream.total_out_lo32);
286 288
287 return true; 289 return true;
288 } 290 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698