| 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 // static | 
|  | 19 SyncSession* SyncSession::BuildForNudge(SyncSessionContext* context, | 
|  | 20                                         Delegate* delegate, | 
|  | 21                                         const SyncSourceInfo& source, | 
|  | 22                                         const NudgeTracker* nudge_tracker) { | 
|  | 23   return new SyncSession(context, delegate, source, nudge_tracker); | 
|  | 24 } | 
|  | 25 | 
|  | 26 // static | 
|  | 27 SyncSession* SyncSession::BuildForNonNudge(SyncSessionContext* context, | 
|  | 28                                            Delegate* delegate, | 
|  | 29                                            const SyncSourceInfo& source) { | 
|  | 30   return new SyncSession(context, delegate, source, NULL); | 
|  | 31 } | 
|  | 32 | 
| 18 SyncSession::SyncSession( | 33 SyncSession::SyncSession( | 
| 19     SyncSessionContext* context, | 34     SyncSessionContext* context, | 
| 20     Delegate* delegate, | 35     Delegate* delegate, | 
| 21     const SyncSourceInfo& source) | 36     const SyncSourceInfo& source, | 
|  | 37     const NudgeTracker* nudge_tracker) | 
| 22     : context_(context), | 38     : context_(context), | 
| 23       source_(source), | 39       source_(source), | 
| 24       delegate_(delegate) { | 40       delegate_(delegate), | 
|  | 41       nudge_tracker_(nudge_tracker) { | 
| 25   status_controller_.reset(new StatusController()); | 42   status_controller_.reset(new StatusController()); | 
| 26 } | 43 } | 
| 27 | 44 | 
| 28 SyncSession::~SyncSession() {} | 45 SyncSession::~SyncSession() {} | 
| 29 | 46 | 
| 30 SyncSessionSnapshot SyncSession::TakeSnapshot() const { | 47 SyncSessionSnapshot SyncSession::TakeSnapshot() const { | 
| 31   syncable::Directory* dir = context_->directory(); | 48   syncable::Directory* dir = context_->directory(); | 
| 32 | 49 | 
| 33   ProgressMarkerMap download_progress_markers; | 50   ProgressMarkerMap download_progress_markers; | 
| 34   for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 51   for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 61 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { | 78 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { | 
| 62   SyncEngineEvent event(cause); | 79   SyncEngineEvent event(cause); | 
| 63   event.snapshot = TakeSnapshot(); | 80   event.snapshot = TakeSnapshot(); | 
| 64 | 81 | 
| 65   DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); | 82   DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); | 
| 66   context()->NotifyListeners(event); | 83   context()->NotifyListeners(event); | 
| 67 } | 84 } | 
| 68 | 85 | 
| 69 }  // namespace sessions | 86 }  // namespace sessions | 
| 70 }  // namespace syncer | 87 }  // namespace syncer | 
| OLD | NEW | 
|---|