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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 10832286: sync: Introduce control data types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to Tim's comments Created 8 years, 4 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
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/sync/glue/sync_backend_host.h" 7 #include "chrome/browser/sync/glue/sync_backend_host.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 using syncer::sessions::SyncSessionSnapshot; 69 using syncer::sessions::SyncSessionSnapshot;
70 using syncer::SyncCredentials; 70 using syncer::SyncCredentials;
71 71
72 // Helper macros to log with the syncer thread name; useful when there 72 // Helper macros to log with the syncer thread name; useful when there
73 // are multiple syncers involved. 73 // are multiple syncers involved.
74 74
75 #define SLOG(severity) LOG(severity) << name_ << ": " 75 #define SLOG(severity) LOG(severity) << name_ << ": "
76 76
77 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " 77 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": "
78 78
79 // static
80 syncer::ModelTypeSet SyncBackendHost::EarlyDownloadTypes() {
81 syncer::ModelTypeSet set;
82 set.Put(syncer::NIGORI);
83 return set;
84 }
85
79 class SyncBackendHost::Core 86 class SyncBackendHost::Core
80 : public base::RefCountedThreadSafe<SyncBackendHost::Core>, 87 : public base::RefCountedThreadSafe<SyncBackendHost::Core>,
81 public syncer::SyncEncryptionHandler::Observer, 88 public syncer::SyncEncryptionHandler::Observer,
82 public syncer::SyncManager::Observer, 89 public syncer::SyncManager::Observer,
83 public syncer::SyncNotifierObserver { 90 public syncer::SyncNotifierObserver {
84 public: 91 public:
85 Core(const std::string& name, 92 Core(const std::string& name,
86 const FilePath& sync_data_folder_path, 93 const FilePath& sync_data_folder_path,
87 const base::WeakPtr<SyncBackendHost>& backend); 94 const base::WeakPtr<SyncBackendHost>& backend);
88 95
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 case NOT_INITIALIZED: 1348 case NOT_INITIALIZED:
1342 // This configuration should result in a download request if the nigori 1349 // This configuration should result in a download request if the nigori
1343 // type's initial_sync_ended bit is unset. If the download request 1350 // type's initial_sync_ended bit is unset. If the download request
1344 // contains progress markers, there is a risk that the server will try to 1351 // contains progress markers, there is a risk that the server will try to
1345 // trigger migration. That would be disastrous, so we must rely on the 1352 // trigger migration. That would be disastrous, so we must rely on the
1346 // sync manager to ensure that this type never has both progress markers 1353 // sync manager to ensure that this type never has both progress markers
1347 // and !initial_sync_ended. 1354 // and !initial_sync_ended.
1348 initialization_state_ = DOWNLOADING_NIGORI; 1355 initialization_state_ = DOWNLOADING_NIGORI;
1349 ConfigureDataTypes( 1356 ConfigureDataTypes(
1350 syncer::CONFIGURE_REASON_NEW_CLIENT, 1357 syncer::CONFIGURE_REASON_NEW_CLIENT,
1351 syncer::ModelTypeSet(syncer::NIGORI), 1358 syncer::ModelTypeSet(EarlyDownloadTypes()),
1352 syncer::ModelTypeSet(), 1359 syncer::ModelTypeSet(),
1353 // Calls back into this function. 1360 // Calls back into this function.
1354 base::Bind( 1361 base::Bind(
1355 &SyncBackendHost:: 1362 &SyncBackendHost::
1356 HandleNigoriConfigurationCompletedOnFrontendLoop, 1363 HandleNigoriConfigurationCompletedOnFrontendLoop,
1357 weak_ptr_factory_.GetWeakPtr()), 1364 weak_ptr_factory_.GetWeakPtr()),
1358 base::Bind(&SyncBackendHost::OnNigoriDownloadRetry, 1365 base::Bind(&SyncBackendHost::OnNigoriDownloadRetry,
1359 weak_ptr_factory_.GetWeakPtr())); 1366 weak_ptr_factory_.GetWeakPtr()));
1360 break; 1367 break;
1361 case DOWNLOADING_NIGORI: 1368 case DOWNLOADING_NIGORI:
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 const syncer::ModelTypeSet failed_configuration_types) { 1546 const syncer::ModelTypeSet failed_configuration_types) {
1540 HandleInitializationCompletedOnFrontendLoop( 1547 HandleInitializationCompletedOnFrontendLoop(
1541 failed_configuration_types.Empty()); 1548 failed_configuration_types.Empty());
1542 } 1549 }
1543 1550
1544 #undef SDVLOG 1551 #undef SDVLOG
1545 1552
1546 #undef SLOG 1553 #undef SLOG
1547 1554
1548 } // namespace browser_sync 1555 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698