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

Side by Side Diff: components/metrics/metrics_log_manager.cc

Issue 2521063004: Replace ptr.reset with std::move in src/components (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/metrics/metrics_log_manager.h" 5 #include "components/metrics/metrics_log_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 DCHECK(!has_staged_log()); 87 DCHECK(!has_staged_log());
88 } 88 }
89 89
90 void MetricsLogManager::DiscardCurrentLog() { 90 void MetricsLogManager::DiscardCurrentLog() {
91 current_log_->CloseLog(); 91 current_log_->CloseLog();
92 current_log_.reset(); 92 current_log_.reset();
93 } 93 }
94 94
95 void MetricsLogManager::PauseCurrentLog() { 95 void MetricsLogManager::PauseCurrentLog() {
96 DCHECK(!paused_log_.get()); 96 DCHECK(!paused_log_.get());
97 paused_log_.reset(current_log_.release()); 97 paused_log_ = std::move(current_log_);
98 } 98 }
99 99
100 void MetricsLogManager::ResumePausedLog() { 100 void MetricsLogManager::ResumePausedLog() {
101 DCHECK(!current_log_.get()); 101 DCHECK(!current_log_.get());
102 current_log_.reset(paused_log_.release()); 102 current_log_ = std::move(paused_log_);
103 } 103 }
104 104
105 void MetricsLogManager::StoreLog(const std::string& log_data, 105 void MetricsLogManager::StoreLog(const std::string& log_data,
106 MetricsLog::LogType log_type) { 106 MetricsLog::LogType log_type) {
107 switch (log_type) { 107 switch (log_type) {
108 case MetricsLog::INITIAL_STABILITY_LOG: 108 case MetricsLog::INITIAL_STABILITY_LOG:
109 initial_log_queue_.StoreLog(log_data); 109 initial_log_queue_.StoreLog(log_data);
110 break; 110 break;
111 case MetricsLog::ONGOING_LOG: 111 case MetricsLog::ONGOING_LOG:
112 ongoing_log_queue_.StoreLog(log_data); 112 ongoing_log_queue_.StoreLog(log_data);
(...skipping 10 matching lines...) Expand all
123 ongoing_log_queue_.SerializeLogs(); 123 ongoing_log_queue_.SerializeLogs();
124 } 124 }
125 125
126 void MetricsLogManager::LoadPersistedUnsentLogs() { 126 void MetricsLogManager::LoadPersistedUnsentLogs() {
127 initial_log_queue_.DeserializeLogs(); 127 initial_log_queue_.DeserializeLogs();
128 ongoing_log_queue_.DeserializeLogs(); 128 ongoing_log_queue_.DeserializeLogs();
129 unsent_logs_loaded_ = true; 129 unsent_logs_loaded_ = true;
130 } 130 }
131 131
132 } // namespace metrics 132 } // namespace metrics
OLDNEW
« no previous file with comments | « components/leveldb_proto/proto_database_impl.h ('k') | components/nacl/loader/nacl_ipc_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698