| Index: components/sync/engine_impl/cycle/sync_cycle.h
|
| diff --git a/components/sync/sessions_impl/sync_session.h b/components/sync/engine_impl/cycle/sync_cycle.h
|
| similarity index 66%
|
| rename from components/sync/sessions_impl/sync_session.h
|
| rename to components/sync/engine_impl/cycle/sync_cycle.h
|
| index 1d633347f300c86ed91ed03c775dbf3c3035292e..2e0860687aece9c3bb0234524902b6be9d1f829b 100644
|
| --- a/components/sync/sessions_impl/sync_session.h
|
| +++ b/components/sync/engine_impl/cycle/sync_cycle.h
|
| @@ -3,12 +3,12 @@
|
| // found in the LICENSE file.
|
|
|
| // A class representing an attempt to synchronize the local syncable data
|
| -// store with a sync server. A SyncSession instance is passed as a stateful
|
| -// bundle throughout the sync cycle. The SyncSession is not reused across
|
| +// store with a sync server. A SyncCycle instance is passed as a stateful
|
| +// bundle throughout the sync cycle. The SyncCycle is not reused across
|
| // sync cycles; each cycle starts with a new one.
|
|
|
| -#ifndef COMPONENTS_SYNC_SESSIONS_IMPL_SYNC_SESSION_H_
|
| -#define COMPONENTS_SYNC_SESSIONS_IMPL_SYNC_SESSION_H_
|
| +#ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_SYNC_CYCLE_H_
|
| +#define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_SYNC_CYCLE_H_
|
|
|
| #include <map>
|
| #include <memory>
|
| @@ -20,26 +20,24 @@
|
| #include "base/macros.h"
|
| #include "base/time/time.h"
|
| #include "components/sync/base/model_type.h"
|
| +#include "components/sync/engine/cycle/sync_cycle_snapshot.h"
|
| #include "components/sync/engine/model_safe_worker.h"
|
| +#include "components/sync/engine_impl/cycle/status_controller.h"
|
| +#include "components/sync/engine_impl/cycle/sync_cycle_context.h"
|
| #include "components/sync/engine_impl/sync_cycle_event.h"
|
| #include "components/sync/protocol/sync_protocol_error.h"
|
| -#include "components/sync/sessions/sync_session_snapshot.h"
|
| -#include "components/sync/sessions_impl/status_controller.h"
|
| -#include "components/sync/sessions_impl/sync_session_context.h"
|
|
|
| namespace syncer {
|
| -class ModelSafeWorker;
|
| -class ProtocolEvent;
|
| -
|
| -namespace sessions {
|
|
|
| +class ModelSafeWorker;
|
| class NudgeTracker;
|
| +class ProtocolEvent;
|
|
|
| -class SyncSession {
|
| +class SyncCycle {
|
| public:
|
| - // The Delegate services events that occur during the session requiring an
|
| - // explicit (and session-global) action, as opposed to events that are simply
|
| - // recorded in per-session state.
|
| + // The Delegate services events that occur during the cycle requiring an
|
| + // explicit (and cycle-global) action, as opposed to events that are simply
|
| + // recorded in per-cycle state.
|
| class Delegate {
|
| public:
|
| // The client was throttled and should cease-and-desist syncing activity
|
| @@ -50,14 +48,14 @@ class SyncSession {
|
| virtual void OnTypesThrottled(ModelTypeSet types,
|
| const base::TimeDelta& throttle_duration) = 0;
|
|
|
| - // Silenced intervals can be out of phase with individual sessions, so the
|
| + // Silenced intervals can be out of phase with individual cycles, so the
|
| // delegate is the only thing that can give an authoritative answer for
|
| // "is syncing silenced right now". This shouldn't be necessary very often
|
| - // as the delegate ensures no session is started if syncing is silenced.
|
| + // as the delegate ensures no cycle is started if syncing is silenced.
|
| // ** Note ** This will return true if silencing commenced during this
|
| - // session and the interval has not yet elapsed, but the contract here is
|
| + // cycle and the interval has not yet elapsed, but the contract here is
|
| // solely based on absolute time values. So, this cannot be used to infer
|
| - // that any given session _instance_ is silenced. An example of reasonable
|
| + // that any given cycle _instance_ is silenced. An example of reasonable
|
| // use is for UI reporting.
|
| virtual bool IsCurrentlyThrottled() = 0;
|
|
|
| @@ -91,18 +89,18 @@ class SyncSession {
|
| virtual ~Delegate() {}
|
| };
|
|
|
| - // Build a session without a nudge tracker. Used for poll or configure type
|
| + // Build a cycle without a nudge tracker. Used for poll or configure type
|
| // sync cycles.
|
| - static SyncSession* Build(SyncSessionContext* context, Delegate* delegate);
|
| - ~SyncSession();
|
| + static SyncCycle* Build(SyncCycleContext* context, Delegate* delegate);
|
| + ~SyncCycle();
|
|
|
| - // Builds a thread-safe and read-only copy of the current session state.
|
| - SyncSessionSnapshot TakeSnapshot() const;
|
| - SyncSessionSnapshot TakeSnapshotWithSource(
|
| + // Builds a thread-safe and read-only copy of the current cycle state.
|
| + SyncCycleSnapshot TakeSnapshot() const;
|
| + SyncCycleSnapshot TakeSnapshotWithSource(
|
| sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source)
|
| const;
|
|
|
| - // Builds and sends a snapshot to the session context's listeners.
|
| + // Builds and sends a snapshot to the cycle context's listeners.
|
| void SendSyncCycleEndEventNotification(
|
| sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
|
| void SendEventNotification(SyncCycleEvent::EventCause cause);
|
| @@ -110,7 +108,7 @@ class SyncSession {
|
| void SendProtocolEvent(const ProtocolEvent& event);
|
|
|
| // TODO(akalin): Split this into context() and mutable_context().
|
| - SyncSessionContext* context() const { return context_; }
|
| + SyncCycleContext* context() const { return context_; }
|
| Delegate* delegate() const { return delegate_; }
|
| const StatusController& status_controller() const {
|
| return *status_controller_.get();
|
| @@ -120,21 +118,20 @@ class SyncSession {
|
| }
|
|
|
| private:
|
| - SyncSession(SyncSessionContext* context, Delegate* delegate);
|
| + SyncCycle(SyncCycleContext* context, Delegate* delegate);
|
|
|
| - // The context for this session, guaranteed to outlive |this|.
|
| - SyncSessionContext* const context_;
|
| + // The context for this cycle, guaranteed to outlive |this|.
|
| + SyncCycleContext* const context_;
|
|
|
| - // The delegate for this session, must never be NULL.
|
| + // The delegate for this cycle, must never be NULL.
|
| Delegate* const delegate_;
|
|
|
| // Our controller for various status and error counters.
|
| std::unique_ptr<StatusController> status_controller_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(SyncSession);
|
| + DISALLOW_COPY_AND_ASSIGN(SyncCycle);
|
| };
|
|
|
| -} // namespace sessions
|
| } // namespace syncer
|
|
|
| -#endif // COMPONENTS_SYNC_SESSIONS_IMPL_SYNC_SESSION_H_
|
| +#endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_SYNC_CYCLE_H_
|
|
|