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

Unified Diff: components/sync/sessions_impl/sync_session.cc

Issue 2258873003: [Sync] Move sessions/ to engine/cycle/ and rename things to match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 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 | « components/sync/sessions_impl/sync_session.h ('k') | components/sync/sessions_impl/sync_session_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/sessions_impl/sync_session.cc
diff --git a/components/sync/sessions_impl/sync_session.cc b/components/sync/sessions_impl/sync_session.cc
deleted file mode 100644
index bb6e492df98de50f89de994bba4ca29e2f5f3fd1..0000000000000000000000000000000000000000
--- a/components/sync/sessions_impl/sync_session.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 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.
-
-#include "components/sync/sessions_impl/sync_session.h"
-
-#include <algorithm>
-#include <iterator>
-
-#include "base/logging.h"
-#include "components/sync/base/model_type.h"
-#include "components/sync/engine/model_safe_worker.h"
-#include "components/sync/syncable/directory.h"
-
-namespace syncer {
-namespace sessions {
-
-// static
-SyncSession* SyncSession::Build(SyncSessionContext* context,
- Delegate* delegate) {
- return new SyncSession(context, delegate);
-}
-
-SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate)
- : context_(context), delegate_(delegate) {
- status_controller_.reset(new StatusController());
-}
-
-SyncSession::~SyncSession() {}
-
-SyncSessionSnapshot SyncSession::TakeSnapshot() const {
- return TakeSnapshotWithSource(sync_pb::GetUpdatesCallerInfo::UNKNOWN);
-}
-
-SyncSessionSnapshot SyncSession::TakeSnapshotWithSource(
- sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source)
- const {
- syncable::Directory* dir = context_->directory();
-
- ProgressMarkerMap download_progress_markers;
- for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
- ModelType type(ModelTypeFromInt(i));
- dir->GetDownloadProgressAsString(type, &download_progress_markers[type]);
- }
-
- std::vector<int> num_entries_by_type(MODEL_TYPE_COUNT, 0);
- std::vector<int> num_to_delete_entries_by_type(MODEL_TYPE_COUNT, 0);
- dir->CollectMetaHandleCounts(&num_entries_by_type,
- &num_to_delete_entries_by_type);
-
- SyncSessionSnapshot snapshot(
- status_controller_->model_neutral_state(), download_progress_markers,
- delegate_->IsCurrentlyThrottled(),
- status_controller_->num_encryption_conflicts(),
- status_controller_->num_hierarchy_conflicts(),
- status_controller_->num_server_conflicts(),
- context_->notifications_enabled(), dir->GetEntriesCount(),
- status_controller_->sync_start_time(),
- status_controller_->poll_finish_time(), num_entries_by_type,
- num_to_delete_entries_by_type, legacy_updates_source);
-
- return snapshot;
-}
-
-void SyncSession::SendSyncCycleEndEventNotification(
- sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) {
- SyncCycleEvent event(SyncCycleEvent::SYNC_CYCLE_ENDED);
- event.snapshot = TakeSnapshotWithSource(source);
-
- DVLOG(1) << "Sending cycle end event with snapshot: "
- << event.snapshot.ToString();
- FOR_EACH_OBSERVER(SyncEngineEventListener, *(context_->listeners()),
- OnSyncCycleEvent(event));
-}
-
-void SyncSession::SendEventNotification(SyncCycleEvent::EventCause cause) {
- SyncCycleEvent event(cause);
- event.snapshot = TakeSnapshot();
-
- DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString();
- FOR_EACH_OBSERVER(SyncEngineEventListener, *(context_->listeners()),
- OnSyncCycleEvent(event));
-}
-
-void SyncSession::SendProtocolEvent(const ProtocolEvent& event) {
- FOR_EACH_OBSERVER(SyncEngineEventListener, *(context_->listeners()),
- OnProtocolEvent(event));
-}
-
-} // namespace sessions
-} // namespace syncer
« no previous file with comments | « components/sync/sessions_impl/sync_session.h ('k') | components/sync/sessions_impl/sync_session_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698