diff options
Diffstat (limited to 'chrome/browser/sync/sessions')
-rw-r--r-- | chrome/browser/sync/sessions/ordered_commit_set.cc | 7 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/ordered_commit_set.h | 6 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/session_state.cc | 61 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/session_state.h | 41 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/status_controller.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/status_controller.h | 1 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/sync_session.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/sync_session.h | 1 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/sync_session_context.cc | 41 | ||||
-rw-r--r-- | chrome/browser/sync/sessions/sync_session_context.h | 29 |
10 files changed, 50 insertions, 141 deletions
diff --git a/chrome/browser/sync/sessions/ordered_commit_set.cc b/chrome/browser/sync/sessions/ordered_commit_set.cc index d700494..104bafb 100644 --- a/chrome/browser/sync/sessions/ordered_commit_set.cc +++ b/chrome/browser/sync/sessions/ordered_commit_set.cc @@ -11,13 +11,6 @@ namespace browser_sync { namespace sessions { -OrderedCommitSet::OrderedCommitSet( - const browser_sync::ModelSafeRoutingInfo& routes) - : routes_(routes) { -} - -OrderedCommitSet::~OrderedCommitSet() {} - void OrderedCommitSet::AddCommitItem(const int64 metahandle, const syncable::Id& commit_id, syncable::ModelType type) { diff --git a/chrome/browser/sync/sessions/ordered_commit_set.h b/chrome/browser/sync/sessions/ordered_commit_set.h index bce2246..50f3e97 100644 --- a/chrome/browser/sync/sessions/ordered_commit_set.h +++ b/chrome/browser/sync/sessions/ordered_commit_set.h @@ -30,8 +30,10 @@ class OrderedCommitSet { typedef std::vector<size_t> Projection; // TODO(chron): Reserve space according to batch size? - explicit OrderedCommitSet(const browser_sync::ModelSafeRoutingInfo& routes); - ~OrderedCommitSet(); + explicit OrderedCommitSet(const browser_sync::ModelSafeRoutingInfo& routes) + : routes_(routes) {} + + ~OrderedCommitSet() {} bool HaveCommitItem(const int64 metahandle) const { return inserted_metahandles_.count(metahandle) > 0; diff --git a/chrome/browser/sync/sessions/session_state.cc b/chrome/browser/sync/sessions/session_state.cc index 644d2f6..f28a7dc 100644 --- a/chrome/browser/sync/sessions/session_state.cc +++ b/chrome/browser/sync/sessions/session_state.cc @@ -13,39 +13,6 @@ using std::vector; namespace browser_sync { namespace sessions { -SyncSessionSnapshot::SyncSessionSnapshot( - const SyncerStatus& syncer_status, - const ErrorCounters& errors, - 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, - int num_conflicting_updates, - bool did_commit_items) - : syncer_status(syncer_status), - errors(errors), - 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), - num_conflicting_updates(num_conflicting_updates), - did_commit_items(did_commit_items) { -} - -SyncSessionSnapshot::~SyncSessionSnapshot() {} - -ConflictProgress::ConflictProgress(bool* dirty_flag) : dirty_(dirty_flag) {} - -ConflictProgress::~ConflictProgress() { - CleanupSets(); -} - IdToConflictSetMap::const_iterator ConflictProgress::IdToConflictSetFind( const syncable::Id& the_id) const { return id_to_conflict_set_.find(the_id); @@ -164,10 +131,6 @@ void ConflictProgress::CleanupSets() { id_to_conflict_set_.clear(); } -UpdateProgress::UpdateProgress() {} - -UpdateProgress::~UpdateProgress() {} - void UpdateProgress::AddVerifyResult(const VerifyResult& verify_result, const sync_pb::SyncEntity& entity) { verified_updates_.push_back(std::make_pair(verify_result, entity)); @@ -221,29 +184,5 @@ bool UpdateProgress::HasConflictingUpdates() const { return false; } -AllModelTypeState::AllModelTypeState(bool* dirty_flag) - : unsynced_handles(dirty_flag), - syncer_status(dirty_flag), - error_counters(dirty_flag), - num_server_changes_remaining(dirty_flag, 0), - commit_set(ModelSafeRoutingInfo()) { -} - -AllModelTypeState::~AllModelTypeState() {} - -PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) - : conflict_progress(dirty_flag) { -} - -PerModelSafeGroupState::~PerModelSafeGroupState() { -} - -PerModelTypeState::PerModelTypeState(bool* dirty_flag) - : current_download_timestamp(dirty_flag, 0) { -} - -PerModelTypeState::~PerModelTypeState() { -} - } // namespace sessions } // namespace browser_sync diff --git a/chrome/browser/sync/sessions/session_state.h b/chrome/browser/sync/sessions/session_state.h index c345fb4..3f1e721 100644 --- a/chrome/browser/sync/sessions/session_state.h +++ b/chrome/browser/sync/sessions/session_state.h @@ -80,9 +80,18 @@ struct SyncSessionSnapshot { bool is_silenced, int64 unsynced_count, int num_conflicting_updates, - bool did_commit_items); - ~SyncSessionSnapshot(); - + bool did_commit_items) + : syncer_status(syncer_status), + errors(errors), + 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), + num_conflicting_updates(num_conflicting_updates), + did_commit_items(did_commit_items) {} const SyncerStatus syncer_status; const ErrorCounters errors; const int64 num_server_changes_remaining; @@ -99,8 +108,8 @@ struct SyncSessionSnapshot { // Tracks progress of conflicts and their resolution using conflict sets. class ConflictProgress { public: - explicit ConflictProgress(bool* dirty_flag); - ~ConflictProgress(); + explicit ConflictProgress(bool* dirty_flag) : dirty_(dirty_flag) {} + ~ConflictProgress() { CleanupSets(); } // Various iterators, size, and retrieval functions for conflict sets. IdToConflictSetMap::const_iterator IdToConflictSetBegin() const; IdToConflictSetMap::const_iterator IdToConflictSetEnd() const; @@ -141,9 +150,6 @@ typedef std::pair<UpdateAttemptResponse, syncable::Id> AppliedUpdate; // Tracks update application and verification. class UpdateProgress { public: - UpdateProgress(); - ~UpdateProgress(); - void AddVerifyResult(const VerifyResult& verify_result, const sync_pb::SyncEntity& entity); @@ -226,9 +232,12 @@ class DirtyOnWrite { // scope control (such as OrderedCommitSet), but the top level entity is still // a singleton with respect to model types. struct AllModelTypeState { - explicit AllModelTypeState(bool* dirty_flag); - ~AllModelTypeState(); - + explicit AllModelTypeState(bool* dirty_flag) + : unsynced_handles(dirty_flag), + syncer_status(dirty_flag), + error_counters(dirty_flag), + num_server_changes_remaining(dirty_flag, 0), + commit_set(ModelSafeRoutingInfo()) {} // Commits for all model types are bundled together into a single message. ClientToServerMessage commit_message; ClientToServerResponse commit_response; @@ -247,18 +256,16 @@ struct AllModelTypeState { // Grouping of all state that applies to a single ModelSafeGroup. struct PerModelSafeGroupState { - explicit PerModelSafeGroupState(bool* dirty_flag); - ~PerModelSafeGroupState(); - + explicit PerModelSafeGroupState(bool* dirty_flag) + : conflict_progress(dirty_flag) {} UpdateProgress update_progress; ConflictProgress conflict_progress; }; // Grouping of all state that applies to a single ModelType. struct PerModelTypeState { - explicit PerModelTypeState(bool* dirty_flag); - ~PerModelTypeState(); - + explicit PerModelTypeState(bool* dirty_flag) + : current_download_timestamp(dirty_flag, 0) {} DirtyOnWrite<int64> current_download_timestamp; }; diff --git a/chrome/browser/sync/sessions/status_controller.cc b/chrome/browser/sync/sessions/status_controller.cc index f7e159c..21159d8 100644 --- a/chrome/browser/sync/sessions/status_controller.cc +++ b/chrome/browser/sync/sessions/status_controller.cc @@ -23,8 +23,6 @@ StatusController::StatusController(const ModelSafeRoutingInfo& routes) routing_info_(routes) { } -StatusController::~StatusController() {} - bool StatusController::TestAndClearIsDirty() { bool is_dirty = is_dirty_; is_dirty_ = false; diff --git a/chrome/browser/sync/sessions/status_controller.h b/chrome/browser/sync/sessions/status_controller.h index d038ed5..f367b50 100644 --- a/chrome/browser/sync/sessions/status_controller.h +++ b/chrome/browser/sync/sessions/status_controller.h @@ -45,7 +45,6 @@ namespace sessions { class StatusController { public: explicit StatusController(const ModelSafeRoutingInfo& routes); - ~StatusController(); // Returns true if some portion of the session state has changed (is dirty) // since it was created or was last reset. diff --git a/chrome/browser/sync/sessions/sync_session.cc b/chrome/browser/sync/sessions/sync_session.cc index a861b2c..8e5064c 100644 --- a/chrome/browser/sync/sessions/sync_session.cc +++ b/chrome/browser/sync/sessions/sync_session.cc @@ -22,8 +22,6 @@ SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate) status_controller_.reset(new StatusController(routing_info_)); } -SyncSession::~SyncSession() {} - SyncSessionSnapshot SyncSession::TakeSnapshot() const { syncable::ScopedDirLookup dir(context_->directory_manager(), context_->account_name()); diff --git a/chrome/browser/sync/sessions/sync_session.h b/chrome/browser/sync/sessions/sync_session.h index 568c1f4..d3320ca 100644 --- a/chrome/browser/sync/sessions/sync_session.h +++ b/chrome/browser/sync/sessions/sync_session.h @@ -77,7 +77,6 @@ class SyncSession { // Creates a new SyncSession with mandatory context and delegate. SyncSession(SyncSessionContext* context, Delegate* delegate); - ~SyncSession(); // Builds a thread-safe and read-only copy of the current session state. SyncSessionSnapshot TakeSnapshot() const; diff --git a/chrome/browser/sync/sessions/sync_session_context.cc b/chrome/browser/sync/sessions/sync_session_context.cc deleted file mode 100644 index 7b69568..0000000 --- a/chrome/browser/sync/sessions/sync_session_context.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/sync/sessions/sync_session_context.h" - -#include "chrome/browser/chrome_thread.h" -#include "chrome/browser/sync/util/extensions_activity_monitor.h" -#include "chrome/browser/sync/sessions/session_state.h" - -namespace browser_sync { -namespace sessions { - -SyncSessionContext::SyncSessionContext( - ServerConnectionManager* connection_manager, - syncable::DirectoryManager* directory_manager, - ModelSafeWorkerRegistrar* model_safe_worker_registrar) - : resolver_(NULL), - syncer_event_channel_(NULL), - connection_manager_(connection_manager), - directory_manager_(directory_manager), - registrar_(model_safe_worker_registrar), - extensions_activity_monitor_(new ExtensionsActivityMonitor()), - notifications_enabled_(false) { -} - -SyncSessionContext::~SyncSessionContext() { - // In unittests, there may be no UI thread, so the above will fail. - if (!ChromeThread::DeleteSoon(ChromeThread::UI, FROM_HERE, - extensions_activity_monitor_)) { - delete extensions_activity_monitor_; - } -} - -void SyncSessionContext::set_last_snapshot( - const SyncSessionSnapshot& snapshot) { - previous_session_snapshot_.reset(new SyncSessionSnapshot(snapshot)); -} - -} // namespace sessions -} // namespace browser_sync diff --git a/chrome/browser/sync/sessions/sync_session_context.h b/chrome/browser/sync/sessions/sync_session_context.h index b782876..4c6b63f 100644 --- a/chrome/browser/sync/sessions/sync_session_context.h +++ b/chrome/browser/sync/sessions/sync_session_context.h @@ -20,10 +20,10 @@ #pragma once #include <string> - -#include "base/scoped_ptr.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/sync/engine/model_safe_worker.h" #include "chrome/browser/sync/engine/syncer_types.h" +#include "chrome/browser/sync/util/extensions_activity_monitor.h" namespace syncable { class DirectoryManager; @@ -32,21 +32,34 @@ class DirectoryManager; namespace browser_sync { class ConflictResolver; -class ExtensionsActivityMonitor; class ModelSafeWorkerRegistrar; class ServerConnectionManager; namespace sessions { class ScopedSessionContextConflictResolver; class ScopedSessionContextSyncerEventChannel; -struct SyncSessionSnapshot; class SyncSessionContext { public: SyncSessionContext(ServerConnectionManager* connection_manager, syncable::DirectoryManager* directory_manager, - ModelSafeWorkerRegistrar* model_safe_worker_registrar); - ~SyncSessionContext(); + ModelSafeWorkerRegistrar* model_safe_worker_registrar) + : resolver_(NULL), + syncer_event_channel_(NULL), + connection_manager_(connection_manager), + directory_manager_(directory_manager), + registrar_(model_safe_worker_registrar), + extensions_activity_monitor_(new ExtensionsActivityMonitor()), + notifications_enabled_(false) { + } + + ~SyncSessionContext() { + // In unittests, there may be no UI thread, so the above will fail. + if (!ChromeThread::DeleteSoon(ChromeThread::UI, FROM_HERE, + extensions_activity_monitor_)) { + delete extensions_activity_monitor_; + } + } ConflictResolver* resolver() { return resolver_; } ServerConnectionManager* connection_manager() { @@ -90,7 +103,9 @@ class SyncSessionContext { return previous_session_snapshot_.get(); } - void set_last_snapshot(const SyncSessionSnapshot& snapshot); + void set_last_snapshot(const SyncSessionSnapshot& snapshot) { + previous_session_snapshot_.reset(new SyncSessionSnapshot(snapshot)); + } private: // Rather than force clients to set and null-out various context members, we |