Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Unified Diff: sync/sessions/sync_session.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/sessions/status_controller_unittest.cc ('k') | sync/sessions/sync_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/sync_session.h
diff --git a/sync/sessions/sync_session.h b/sync/sessions/sync_session.h
deleted file mode 100644
index 0763ea68ffbafe51c3ec73e7ffa817d1bb9e7ecf..0000000000000000000000000000000000000000
--- a/sync/sessions/sync_session.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2012 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.
-
-// 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
-// sync cycles; each cycle starts with a new one.
-
-#ifndef SYNC_SESSIONS_SYNC_SESSION_H_
-#define SYNC_SESSIONS_SYNC_SESSION_H_
-
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/time/time.h"
-#include "sync/base/sync_export.h"
-#include "sync/engine/sync_cycle_event.h"
-#include "sync/internal_api/public/base/model_type.h"
-#include "sync/internal_api/public/engine/model_safe_worker.h"
-#include "sync/internal_api/public/sessions/sync_session_snapshot.h"
-#include "sync/protocol/sync_protocol_error.h"
-#include "sync/sessions/status_controller.h"
-#include "sync/sessions/sync_session_context.h"
-
-namespace syncer {
-class ModelSafeWorker;
-class ProtocolEvent;
-
-namespace sessions {
-
-class NudgeTracker;
-
-class SYNC_EXPORT SyncSession {
- 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.
- class SYNC_EXPORT Delegate {
- public:
- // The client was throttled and should cease-and-desist syncing activity
- // until the specified time.
- virtual void OnThrottled(const base::TimeDelta& throttle_duration) = 0;
-
- // Some of the client's types were throttled.
- virtual void OnTypesThrottled(
- ModelTypeSet types,
- const base::TimeDelta& throttle_duration) = 0;
-
- // Silenced intervals can be out of phase with individual sessions, 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.
- // ** Note ** This will return true if silencing commenced during this
- // session 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
- // use is for UI reporting.
- virtual bool IsCurrentlyThrottled() = 0;
-
- // The client has been instructed to change its short poll interval.
- virtual void OnReceivedShortPollIntervalUpdate(
- const base::TimeDelta& new_interval) = 0;
-
- // The client has been instructed to change its long poll interval.
- virtual void OnReceivedLongPollIntervalUpdate(
- const base::TimeDelta& new_interval) = 0;
-
- // The client has been instructed to change a nudge delay.
- virtual void OnReceivedCustomNudgeDelays(
- const std::map<ModelType, base::TimeDelta>& nudge_delays) = 0;
-
- // Called for the syncer to respond to the error sent by the server.
- virtual void OnSyncProtocolError(
- const SyncProtocolError& sync_protocol_error) = 0;
-
- // Called when the server wants to change the number of hints the client
- // will buffer locally.
- virtual void OnReceivedClientInvalidationHintBufferSize(int size) = 0;
-
- // Called when server wants to schedule a retry GU.
- virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) = 0;
-
- // Called when server requests a migration.
- virtual void OnReceivedMigrationRequest(ModelTypeSet types) = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- // Build a session without a nudge tracker. Used for poll or configure type
- // sync cycles.
- static SyncSession* Build(SyncSessionContext* context,
- Delegate* delegate);
- ~SyncSession();
-
- // Builds a thread-safe and read-only copy of the current session state.
- SyncSessionSnapshot TakeSnapshot() const;
- SyncSessionSnapshot TakeSnapshotWithSource(
- sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source)
- const;
-
- // Builds and sends a snapshot to the session context's listeners.
- void SendSyncCycleEndEventNotification(
- sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
- void SendEventNotification(SyncCycleEvent::EventCause cause);
-
- void SendProtocolEvent(const ProtocolEvent& event);
-
- // TODO(akalin): Split this into context() and mutable_context().
- SyncSessionContext* context() const { return context_; }
- Delegate* delegate() const { return delegate_; }
- const StatusController& status_controller() const {
- return *status_controller_.get();
- }
- StatusController* mutable_status_controller() {
- return status_controller_.get();
- }
-
- private:
- SyncSession(SyncSessionContext* context, Delegate* delegate);
-
- // The context for this session, guaranteed to outlive |this|.
- SyncSessionContext* const context_;
-
- // The delegate for this session, 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);
-};
-
-} // namespace sessions
-} // namespace syncer
-
-#endif // SYNC_SESSIONS_SYNC_SESSION_H_
« no previous file with comments | « sync/sessions/status_controller_unittest.cc ('k') | sync/sessions/sync_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698