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

Side by Side Diff: sync/notifier/sync_notifier_factory.cc

Issue 10398051: [Sync] Replace TalkMediator*/MediatorThread* with PushClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, fix test Created 8 years, 7 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/notifier/p2p_notifier_unittest.cc ('k') | sync/protocol/service_constants.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/notifier/sync_notifier_factory.h" 5 #include "sync/notifier/sync_notifier_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "jingle/notifier/listener/mediator_thread_impl.h"
11 #include "jingle/notifier/listener/talk_mediator_impl.h"
12 #include "sync/notifier/non_blocking_invalidation_notifier.h" 10 #include "sync/notifier/non_blocking_invalidation_notifier.h"
13 #include "sync/notifier/p2p_notifier.h" 11 #include "sync/notifier/p2p_notifier.h"
14 #include "sync/notifier/sync_notifier.h" 12 #include "sync/notifier/sync_notifier.h"
15 13
16 namespace sync_notifier { 14 namespace sync_notifier {
17 namespace { 15 namespace {
18 16
19 SyncNotifier* CreateDefaultSyncNotifier( 17 SyncNotifier* CreateDefaultSyncNotifier(
20 const notifier::NotifierOptions& notifier_options, 18 const notifier::NotifierOptions& notifier_options,
21 const InvalidationVersionMap& initial_max_invalidation_versions, 19 const InvalidationVersionMap& initial_max_invalidation_versions,
22 const browser_sync::WeakHandle<InvalidationVersionTracker>& 20 const browser_sync::WeakHandle<InvalidationVersionTracker>&
23 invalidation_version_tracker, 21 invalidation_version_tracker,
24 const std::string& client_info) { 22 const std::string& client_info) {
25 if (notifier_options.notification_method == notifier::NOTIFICATION_P2P) { 23 if (notifier_options.notification_method == notifier::NOTIFICATION_P2P) {
26 notifier::TalkMediator* const talk_mediator =
27 new notifier::TalkMediatorImpl(
28 new notifier::MediatorThreadImpl(notifier_options),
29 notifier_options);
30 // TODO(rlarocque): Ideally, the notification target would be 24 // TODO(rlarocque): Ideally, the notification target would be
31 // NOTIFY_OTHERS. There's no good reason to notify ourselves of our own 25 // NOTIFY_OTHERS. There's no good reason to notify ourselves of our own
32 // commits. We self-notify for now only because the integration tests rely 26 // commits. We self-notify for now only because the integration tests rely
33 // on this behaviour. See crbug.com/97780. 27 // on this behaviour. See crbug.com/97780.
34 // 28 return new P2PNotifier(notifier_options, NOTIFY_ALL);
35 // Takes ownership of |talk_mediator|.
36 return new P2PNotifier(talk_mediator, NOTIFY_ALL);
37 } 29 }
38 30
39 return new NonBlockingInvalidationNotifier( 31 return new NonBlockingInvalidationNotifier(
40 notifier_options, initial_max_invalidation_versions, 32 notifier_options, initial_max_invalidation_versions,
41 invalidation_version_tracker, client_info); 33 invalidation_version_tracker, client_info);
42 } 34 }
43 35
44 } // namespace 36 } // namespace
45 37
46 // TODO(akalin): Remove the dependency on jingle if OS_ANDROID is defined. 38 // TODO(akalin): Remove the dependency on jingle if OS_ANDROID is defined.
(...skipping 19 matching lines...) Expand all
66 // Android uses ChromeSyncNotificationBridge exclusively. 58 // Android uses ChromeSyncNotificationBridge exclusively.
67 return NULL; 59 return NULL;
68 #else 60 #else
69 return CreateDefaultSyncNotifier(notifier_options_, 61 return CreateDefaultSyncNotifier(notifier_options_,
70 initial_max_invalidation_versions_, 62 initial_max_invalidation_versions_,
71 invalidation_version_tracker_, 63 invalidation_version_tracker_,
72 client_info_); 64 client_info_);
73 #endif 65 #endif
74 } 66 }
75 } // namespace sync_notifier 67 } // namespace sync_notifier
OLDNEW
« no previous file with comments | « sync/notifier/p2p_notifier_unittest.cc ('k') | sync/protocol/service_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698