Chromium Code Reviews| Index: chrome/browser/sync/sessions/sync_session.h |
| diff --git a/chrome/browser/sync/sessions/sync_session.h b/chrome/browser/sync/sessions/sync_session.h |
| index ce7c9e5dd11da04267ce648cf907b058190a2673..5226fb41267dd7262d0144a90801d3ab8598cadd 100644 |
| --- a/chrome/browser/sync/sessions/sync_session.h |
| +++ b/chrome/browser/sync/sessions/sync_session.h |
| @@ -19,6 +19,7 @@ |
| #include <vector> |
| #include "base/basictypes.h" |
| +#include "base/ref_counted.h" |
| #include "base/scoped_ptr.h" |
| #include "base/time.h" |
| #include "chrome/browser/sync/sessions/ordered_commit_set.h" |
| @@ -38,7 +39,7 @@ namespace sessions { |
| typedef std::pair<sync_pb::GetUpdatesCallerInfo::GetUpdatesSource, |
| syncable::ModelTypeBitSet> SyncSourceInfo; |
| -class SyncSession { |
| +class SyncSession : public base::RefCountedThreadSafe<SyncSession> { |
|
akalin
2011/01/13 00:36:34
Why does this have to be refcounted?
tim (not reviewing)
2011/01/13 18:26:56
I discussed this tradeoff in the design doc (linke
|
| public: |
| // The Delegate services events that occur during the session requiring an |
| // explicit (and session-global) action, as opposed to events that are simply |
| @@ -92,8 +93,19 @@ class SyncSession { |
| // engine again. |
| bool HasMoreToSync() const; |
| - SyncSessionContext* context() { return context_; } |
| - Delegate* delegate() { return delegate_; } |
| + // Collects all state pertaining to how and why |s| originated and unions it |
| + // with corresponding state in |this|, leaving |s| unchanged. Allows |this| |
| + // to take on the responsibilities |s| had (e.g. certain data types) in the |
| + // next SyncShare operation using |this|, rather than needed two separate |
| + // sessions. |
| + void Coalesce(const SyncSession* s); |
| + |
| + // Should be called any time |this| is being re-used in a new call to |
| + // SyncShare (e.g., HasMoreToSync returned true). |
| + void ResetTransientState(); |
| + |
| + SyncSessionContext* context() const { return context_; } |
| + Delegate* delegate() const { return delegate_; } |
| syncable::WriteTransaction* write_transaction() { return write_transaction_; } |
| StatusController* status_controller() { return status_controller_.get(); } |