| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sync/sessions/sync_session.h" | 5 #include "sync/sessions/sync_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "sync/internal_api/public/base/model_type.h" | 11 #include "sync/internal_api/public/base/model_type.h" |
| 12 #include "sync/internal_api/public/engine/model_safe_worker.h" | 12 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 13 #include "sync/syncable/directory.h" | 13 #include "sync/syncable/directory.h" |
| 14 | 14 |
| 15 namespace syncer { | 15 namespace syncer { |
| 16 namespace sessions { | 16 namespace sessions { |
| 17 | 17 |
| 18 SyncSession::SyncSession( | 18 SyncSession::SyncSession( |
| 19 SyncSessionContext* context, | 19 SyncSessionContext* context, |
| 20 Delegate* delegate, | 20 Delegate* delegate, |
| 21 const SyncSourceInfo& source) | 21 const SyncSourceInfo& source) |
| 22 : context_(context), | 22 : context_(context), |
| 23 source_(source), | 23 source_(source), |
| 24 delegate_(delegate) { | 24 delegate_(delegate), |
| 25 nudge_tracker_(NULL) { |
| 25 status_controller_.reset(new StatusController()); | 26 status_controller_.reset(new StatusController()); |
| 26 } | 27 } |
| 27 | 28 |
| 29 SyncSession::SyncSession( |
| 30 SyncSessionContext* context, |
| 31 Delegate* delegate, |
| 32 const SyncSourceInfo& source, |
| 33 const NudgeTracker* nudge_tracker) |
| 34 : context_(context), |
| 35 source_(source), |
| 36 delegate_(delegate), |
| 37 nudge_tracker_(nudge_tracker) { |
| 38 status_controller_.reset(new StatusController()); |
| 39 } |
| 40 |
| 28 SyncSession::~SyncSession() {} | 41 SyncSession::~SyncSession() {} |
| 29 | 42 |
| 30 SyncSessionSnapshot SyncSession::TakeSnapshot() const { | 43 SyncSessionSnapshot SyncSession::TakeSnapshot() const { |
| 31 syncable::Directory* dir = context_->directory(); | 44 syncable::Directory* dir = context_->directory(); |
| 32 | 45 |
| 33 ProgressMarkerMap download_progress_markers; | 46 ProgressMarkerMap download_progress_markers; |
| 34 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 47 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 35 ModelType type(ModelTypeFromInt(i)); | 48 ModelType type(ModelTypeFromInt(i)); |
| 36 dir->GetDownloadProgressAsString(type, &download_progress_markers[type]); | 49 dir->GetDownloadProgressAsString(type, &download_progress_markers[type]); |
| 37 } | 50 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 61 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { | 74 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { |
| 62 SyncEngineEvent event(cause); | 75 SyncEngineEvent event(cause); |
| 63 event.snapshot = TakeSnapshot(); | 76 event.snapshot = TakeSnapshot(); |
| 64 | 77 |
| 65 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); | 78 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); |
| 66 context()->NotifyListeners(event); | 79 context()->NotifyListeners(event); |
| 67 } | 80 } |
| 68 | 81 |
| 69 } // namespace sessions | 82 } // namespace sessions |
| 70 } // namespace syncer | 83 } // namespace syncer |
| OLD | NEW |