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

Side by Side Diff: sync/sessions/sync_session.cc

Issue 15764010: Experimental functionize patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync: Expose sync functionality as functions Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/sessions/test_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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::Build(SyncSessionContext* context, 19 SyncSession* SyncSession::Build(SyncSessionContext* context,
28 Delegate* delegate, 20 Delegate* delegate,
29 const SyncSourceInfo& source) { 21 const SyncSourceInfo& source) {
30 return new SyncSession(context, delegate, source, NULL); 22 return new SyncSession(context, delegate, source);
31 } 23 }
32 24
33 SyncSession::SyncSession( 25 SyncSession::SyncSession(
34 SyncSessionContext* context, 26 SyncSessionContext* context,
35 Delegate* delegate, 27 Delegate* delegate,
36 const SyncSourceInfo& source, 28 const SyncSourceInfo& source)
37 const NudgeTracker* nudge_tracker)
38 : context_(context), 29 : context_(context),
39 source_(source), 30 source_(source),
40 delegate_(delegate), 31 delegate_(delegate) {
41 nudge_tracker_(nudge_tracker) {
42 status_controller_.reset(new StatusController()); 32 status_controller_.reset(new StatusController());
43 } 33 }
44 34
45 SyncSession::~SyncSession() {} 35 SyncSession::~SyncSession() {}
46 36
47 SyncSessionSnapshot SyncSession::TakeSnapshot() const { 37 SyncSessionSnapshot SyncSession::TakeSnapshot() const {
48 syncable::Directory* dir = context_->directory(); 38 syncable::Directory* dir = context_->directory();
49 39
50 ProgressMarkerMap download_progress_markers; 40 ProgressMarkerMap download_progress_markers;
51 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { 41 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
(...skipping 26 matching lines...) Expand all
78 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { 68 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) {
79 SyncEngineEvent event(cause); 69 SyncEngineEvent event(cause);
80 event.snapshot = TakeSnapshot(); 70 event.snapshot = TakeSnapshot();
81 71
82 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); 72 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString();
83 context()->NotifyListeners(event); 73 context()->NotifyListeners(event);
84 } 74 }
85 75
86 } // namespace sessions 76 } // namespace sessions
87 } // namespace syncer 77 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/sessions/test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698