summaryrefslogtreecommitdiffstats
path: root/sync/sessions/sync_session.h
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-15 06:57:06 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-15 06:57:06 +0000
commit89aeb207730a1315e3c89883dc717f53284f05bf (patch)
tree7e742fae4fa752bb52a722d16c64bce1ac94dadf /sync/sessions/sync_session.h
parent16cea069862a432f798ee6b01d7e4e399c9fddda (diff)
downloadchromium_src-89aeb207730a1315e3c89883dc717f53284f05bf.zip
chromium_src-89aeb207730a1315e3c89883dc717f53284f05bf.tar.gz
chromium_src-89aeb207730a1315e3c89883dc717f53284f05bf.tar.bz2
Remove some members from SyncSession
This is part of the effort to shrink the size of the SyncSession and SyncSessionJob. One of the members to be removed was the write transaction. This was stored in the session in order to share it among various functions that prepare a commit message. The same goal can be accomplished by passing the transaction in to the constructors of the SyncerCommands. There was one complication in this change. The new constructor meant that it was impossible to instantiate a BuildCommitCommand without a transaction, which made it somewhat harder to unit test. Making some of its methods static made it unnecessary to instantiate a BuildCommitCommand object in the test. In addition to giving us better control of the scope of the transaction, this change allows BuildCommitCommand and GetCommitIdsCommand to use a BaseTransaction rather than a WriteTransaction. The other member removed from SyncSession is the ExtensionsActivityMonitor's records. This member was used to buffer the ExtensionsActivityMonitor's records which were pending for commit and to re-add them to the monitor if the commit failed. Since it is only used within the context of a commit, it is safer and simpler to declare it on the stack in BuildAndPostCommitsImpl(). The change should have no noticeable impact on behaviour, though it does move some of the interactions with the ExtensionsActivityMonitor from the UI thread to the sync thread. This should be safe; the monitor's internal data structures are protected with a lock. The move also allows us to remove some of the code from StatusController that was used to trigger the UI-thread-specific processing. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12314103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/sessions/sync_session.h')
-rw-r--r--sync/sessions/sync_session.h42
1 files changed, 0 insertions, 42 deletions
diff --git a/sync/sessions/sync_session.h b/sync/sessions/sync_session.h
index 9272bae..126d57f 100644
--- a/sync/sessions/sync_session.h
+++ b/sync/sessions/sync_session.h
@@ -30,15 +30,10 @@
#include "sync/sessions/ordered_commit_set.h"
#include "sync/sessions/status_controller.h"
#include "sync/sessions/sync_session_context.h"
-#include "sync/util/extensions_activity_monitor.h"
namespace syncer {
class ModelSafeWorker;
-namespace syncable {
-class WriteTransaction;
-}
-
namespace sessions {
class SYNC_EXPORT_PRIVATE SyncSession {
@@ -113,7 +108,6 @@ class SYNC_EXPORT_PRIVATE SyncSession {
// TODO(akalin): Split this into context() and mutable_context().
SyncSessionContext* context() const { return context_; }
Delegate* delegate() const { return delegate_; }
- syncable::WriteTransaction* write_transaction() { return write_transaction_; }
const StatusController& status_controller() const {
return *status_controller_.get();
}
@@ -121,21 +115,9 @@ class SYNC_EXPORT_PRIVATE SyncSession {
return status_controller_.get();
}
- const ExtensionsActivityMonitor::Records& extensions_activity() const {
- return extensions_activity_;
- }
- ExtensionsActivityMonitor::Records* mutable_extensions_activity() {
- return &extensions_activity_;
- }
-
const SyncSourceInfo& source() const { return source_; }
private:
- // Extend the encapsulation boundary to utilities for internal member
- // assignments. This way, the scope of these actions is explicit, they can't
- // be overridden, and assigning is always accompanied by unassigning.
- friend class ScopedSetSessionWriteTransaction;
-
// The context for this session, guaranteed to outlive |this|.
SyncSessionContext* const context_;
@@ -146,12 +128,6 @@ class SYNC_EXPORT_PRIVATE SyncSession {
// Currently used only for logging.
std::vector<SyncSourceInfo> debug_info_sources_list_;
- // Information about extensions activity since the last successful commit.
- ExtensionsActivityMonitor::Records extensions_activity_;
-
- // Used to allow various steps to share a transaction. Can be NULL.
- syncable::WriteTransaction* write_transaction_;
-
// The delegate for this session, must never be NULL.
Delegate* const delegate_;
@@ -161,24 +137,6 @@ class SYNC_EXPORT_PRIVATE SyncSession {
DISALLOW_COPY_AND_ASSIGN(SyncSession);
};
-// Installs a WriteTransaction to a given session and later clears it when the
-// utility falls out of scope. Transactions are not nestable, so it is an error
-// to try and use one of these if the session already has a transaction.
-class ScopedSetSessionWriteTransaction {
- public:
- ScopedSetSessionWriteTransaction(SyncSession* session,
- syncable::WriteTransaction* trans)
- : session_(session) {
- DCHECK(!session_->write_transaction_);
- session_->write_transaction_ = trans;
- }
- ~ScopedSetSessionWriteTransaction() { session_->write_transaction_ = NULL; }
-
- private:
- SyncSession* session_;
- DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction);
-};
-
} // namespace sessions
} // namespace syncer