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

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: 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
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" 10 #include "jingle/notifier/listener/push_client.h"
11 #include "jingle/notifier/listener/talk_mediator_impl.h"
12 #include "sync/notifier/non_blocking_invalidation_notifier.h" 11 #include "sync/notifier/non_blocking_invalidation_notifier.h"
13 #include "sync/notifier/p2p_notifier.h" 12 #include "sync/notifier/p2p_notifier.h"
14 #include "sync/notifier/sync_notifier.h" 13 #include "sync/notifier/sync_notifier.h"
15 14
16 namespace sync_notifier { 15 namespace sync_notifier {
17 namespace { 16 namespace {
18 17
19 SyncNotifier* CreateDefaultSyncNotifier( 18 SyncNotifier* CreateDefaultSyncNotifier(
20 const notifier::NotifierOptions& notifier_options, 19 const notifier::NotifierOptions& notifier_options,
21 const InvalidationVersionMap& initial_max_invalidation_versions, 20 const InvalidationVersionMap& initial_max_invalidation_versions,
22 const browser_sync::WeakHandle<InvalidationVersionTracker>& 21 const browser_sync::WeakHandle<InvalidationVersionTracker>&
23 invalidation_version_tracker, 22 invalidation_version_tracker,
24 const std::string& client_info) { 23 const std::string& client_info) {
25 if (notifier_options.notification_method == notifier::NOTIFICATION_P2P) { 24 if (notifier_options.notification_method == notifier::NOTIFICATION_P2P) {
26 notifier::TalkMediator* const talk_mediator = 25 notifier::PushClient* const mediator_thread =
27 new notifier::TalkMediatorImpl( 26 new notifier::PushClient(notifier_options);
28 new notifier::MediatorThreadImpl(notifier_options),
29 notifier_options);
30 // TODO(rlarocque): Ideally, the notification target would be 27 // TODO(rlarocque): Ideally, the notification target would be
31 // NOTIFY_OTHERS. There's no good reason to notify ourselves of our own 28 // 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 29 // commits. We self-notify for now only because the integration tests rely
33 // on this behaviour. See crbug.com/97780. 30 // on this behaviour. See crbug.com/97780.
34 // 31 //
35 // Takes ownership of |talk_mediator|. 32 // Takes ownership of |mediator_thread|.
36 return new P2PNotifier(talk_mediator, NOTIFY_ALL); 33 return new P2PNotifier(mediator_thread, NOTIFY_ALL);
37 } 34 }
38 35
39 return new NonBlockingInvalidationNotifier( 36 return new NonBlockingInvalidationNotifier(
40 notifier_options, initial_max_invalidation_versions, 37 notifier_options, initial_max_invalidation_versions,
41 invalidation_version_tracker, client_info); 38 invalidation_version_tracker, client_info);
42 } 39 }
43 40
44 } // namespace 41 } // namespace
45 42
46 // TODO(akalin): Remove the dependency on jingle if OS_ANDROID is defined. 43 // TODO(akalin): Remove the dependency on jingle if OS_ANDROID is defined.
(...skipping 19 matching lines...) Expand all
66 // Android uses ChromeSyncNotificationBridge exclusively. 63 // Android uses ChromeSyncNotificationBridge exclusively.
67 return NULL; 64 return NULL;
68 #else 65 #else
69 return CreateDefaultSyncNotifier(notifier_options_, 66 return CreateDefaultSyncNotifier(notifier_options_,
70 initial_max_invalidation_versions_, 67 initial_max_invalidation_versions_,
71 invalidation_version_tracker_, 68 invalidation_version_tracker_,
72 client_info_); 69 client_info_);
73 #endif 70 #endif
74 } 71 }
75 } // namespace sync_notifier 72 } // namespace sync_notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698