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

Side by Side Diff: chrome/browser/sync/test/integration/quiesce_status_change_checker.cc

Issue 2767893002: Remove ScopedVector from chrome/browser/. (Closed)
Patch Set: Address comments from zea@ Created 3 years, 9 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
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 "chrome/browser/sync/test/integration/quiesce_status_change_checker.h" 5 #include "chrome/browser/sync/test/integration/quiesce_status_change_checker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ptr_util.h"
10 #include "base/scoped_observer.h" 11 #include "base/scoped_observer.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
13 #include "components/browser_sync/profile_sync_service.h" 14 #include "components/browser_sync/profile_sync_service.h"
14 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" 15 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
15 16
16 namespace { 17 namespace {
17 18
18 // Returns true if this service is disabled. 19 // Returns true if this service is disabled.
19 bool IsSyncDisabled(browser_sync::ProfileSyncService* service) { 20 bool IsSyncDisabled(browser_sync::ProfileSyncService* service) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 147
147 bool ProgressMarkerWatcher::IsSyncDisabled() { 148 bool ProgressMarkerWatcher::IsSyncDisabled() {
148 return ::IsSyncDisabled(service_); 149 return ::IsSyncDisabled(service_);
149 } 150 }
150 151
151 QuiesceStatusChangeChecker::QuiesceStatusChangeChecker( 152 QuiesceStatusChangeChecker::QuiesceStatusChangeChecker(
152 std::vector<browser_sync::ProfileSyncService*> services) 153 std::vector<browser_sync::ProfileSyncService*> services)
153 : services_(services) { 154 : services_(services) {
154 DCHECK_LE(1U, services_.size()); 155 DCHECK_LE(1U, services_.size());
155 for (size_t i = 0; i < services_.size(); ++i) { 156 for (size_t i = 0; i < services_.size(); ++i) {
156 observers_.push_back(new ProgressMarkerWatcher(services[i], this)); 157 observers_.push_back(
158 base::MakeUnique<ProgressMarkerWatcher>(services[i], this));
157 } 159 }
158 } 160 }
159 161
160 QuiesceStatusChangeChecker::~QuiesceStatusChangeChecker() {} 162 QuiesceStatusChangeChecker::~QuiesceStatusChangeChecker() {}
161 163
162 bool QuiesceStatusChangeChecker::IsExitConditionSatisfied() { 164 bool QuiesceStatusChangeChecker::IsExitConditionSatisfied() {
163 // Check that all progress markers are up to date. 165 // Check that all progress markers are up to date.
164 for (ScopedVector<ProgressMarkerWatcher>::const_iterator it = 166 for (auto it = observers_.begin(); it != observers_.end(); ++it) {
165 observers_.begin(); it != observers_.end(); ++it) {
166 if ((*it)->IsSyncDisabled()) { 167 if ((*it)->IsSyncDisabled()) {
167 continue; // Skip disabled services. 168 continue; // Skip disabled services.
168 } 169 }
169 170
170 if (!(*it)->HasLatestProgressMarkers()) { 171 if (!(*it)->HasLatestProgressMarkers()) {
171 DVLOG(1) << "Not quiesced: Progress markers are old."; 172 DVLOG(1) << "Not quiesced: Progress markers are old.";
172 return false; 173 return false;
173 } 174 }
174 } 175 }
175 176
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 209
209 std::string QuiesceStatusChangeChecker::GetDebugMessage() const { 210 std::string QuiesceStatusChangeChecker::GetDebugMessage() const {
210 return base::StringPrintf("Waiting for quiescence of %" PRIuS " clients", 211 return base::StringPrintf("Waiting for quiescence of %" PRIuS " clients",
211 services_.size()); 212 services_.size());
212 } 213 }
213 214
214 void QuiesceStatusChangeChecker::OnServiceStateChanged( 215 void QuiesceStatusChangeChecker::OnServiceStateChanged(
215 browser_sync::ProfileSyncService* service) { 216 browser_sync::ProfileSyncService* service) {
216 CheckExitCondition(); 217 CheckExitCondition();
217 } 218 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/quiesce_status_change_checker.h ('k') | chrome/browser/sync/test/integration/sync_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698