diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 16:04:38 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 16:04:38 +0000 |
commit | a17eef828c8fbd19c646915c7b13b9b7f917f0ad (patch) | |
tree | 471f0ed225ef111f6edb7fbfe60184d2344702d8 /chrome/browser/sync/sessions | |
parent | 653b1d328e5e5272712db54f3c02ab812c6224d9 (diff) | |
download | chromium_src-a17eef828c8fbd19c646915c7b13b9b7f917f0ad.zip chromium_src-a17eef828c8fbd19c646915c7b13b9b7f917f0ad.tar.gz chromium_src-a17eef828c8fbd19c646915c7b13b9b7f917f0ad.tar.bz2 |
Update routing info and nudge syncer in ConfigureDataTypes().
Here is an incomplete change that will reconfigure the routing info when the DTM calls ConfigureDataTypes. Some open questions:
- How will the SBH actually nudge the syncer? I can add a SyncManager::Nudge method if that makes sense.
- Looking at the nudge code, it looks like it is possible for nudges to get dropped on the floor. This could be really bad since sync can't start until the syncer thread runs and downloads updates for new data types. Is there a better way to make sure the syncer thread runs at this point?
Also, I changed the callback method used for the SBH to notify the DTM that downloads are ready by switching the raw CancelableTask instance with a RunnableMethod. The previous version has the DTM touching the CancelableTask pointer after it was handed over to the SBH which was bad. This should be better.
Review URL: http://codereview.chromium.org/1484001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/sessions')
-rw-r--r-- | chrome/browser/sync/sessions/session_state.h | 4 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/sync_session.cc | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/sync/sessions/session_state.h b/chrome/browser/sync/sessions/session_state.h index 6ac8971..6a2fa67 100644 --- a/chrome/browser/sync/sessions/session_state.h +++ b/chrome/browser/sync/sessions/session_state.h @@ -19,6 +19,7 @@ #include "chrome/browser/sync/engine/syncer_types.h" #include "chrome/browser/sync/engine/syncproto.h" #include "chrome/browser/sync/sessions/ordered_commit_set.h" +#include "chrome/browser/sync/syncable/model_type.h" #include "chrome/browser/sync/syncable/syncable.h" namespace syncable { @@ -73,6 +74,7 @@ struct SyncSessionSnapshot { int64 num_server_changes_remaining, int64 max_local_timestamp, bool is_share_usable, + const syncable::ModelTypeBitSet& initial_sync_ended, bool more_to_sync, bool is_silenced, int64 unsynced_count, @@ -83,6 +85,7 @@ struct SyncSessionSnapshot { num_server_changes_remaining(num_server_changes_remaining), max_local_timestamp(max_local_timestamp), is_share_usable(is_share_usable), + initial_sync_ended(initial_sync_ended), has_more_to_sync(more_to_sync), is_silenced(is_silenced), unsynced_count(unsynced_count), @@ -93,6 +96,7 @@ struct SyncSessionSnapshot { const int64 num_server_changes_remaining; const int64 max_local_timestamp; const bool is_share_usable; + const syncable::ModelTypeBitSet initial_sync_ended; const bool has_more_to_sync; const bool is_silenced; const int64 unsynced_count; diff --git a/chrome/browser/sync/sessions/sync_session.cc b/chrome/browser/sync/sessions/sync_session.cc index 0c50d4d..8e5064c 100644 --- a/chrome/browser/sync/sessions/sync_session.cc +++ b/chrome/browser/sync/sessions/sync_session.cc @@ -4,6 +4,7 @@ #include "chrome/browser/sync/sessions/sync_session.h" #include "chrome/browser/sync/syncable/directory_manager.h" +#include "chrome/browser/sync/syncable/model_type.h" namespace browser_sync { namespace sessions { @@ -27,13 +28,15 @@ SyncSessionSnapshot SyncSession::TakeSnapshot() const { if (!dir.good()) LOG(ERROR) << "Scoped dir lookup failed!"; - // TODO(ncarter): Either move this to a function in the status controller, - // or else make the session snapshot have per-type initialsyncendedness. bool is_share_useable = true; + syncable::ModelTypeBitSet initial_sync_ended; for (int i = 0; i < syncable::MODEL_TYPE_COUNT; ++i) { - if (routing_info_.count(syncable::ModelTypeFromInt(i)) != 0 && - !dir->initial_sync_ended_for_type(syncable::ModelTypeFromInt(i))) { - is_share_useable = false; + syncable::ModelType type(syncable::ModelTypeFromInt(i)); + if (routing_info_.count(type) != 0) { + if (dir->initial_sync_ended_for_type(type)) + initial_sync_ended.set(type); + else + is_share_useable = false; } } @@ -43,6 +46,7 @@ SyncSessionSnapshot SyncSession::TakeSnapshot() const { status_controller_->num_server_changes_remaining(), status_controller_->ComputeMaxLocalTimestamp(), is_share_useable, + initial_sync_ended, HasMoreToSync(), delegate_->IsSyncingCurrentlySilenced(), status_controller_->unsynced_handles().size(), |