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

Unified Diff: sync/tools/sync_listen_notifications.cc

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More review fixes Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sync/tools/sync_listen_notifications.cc
diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc
index 92fde0ea05474c6cf6d38e737c9c03fb5c5f743e..74159274df8774a365ae54de0ad65756a53c6a25 100644
--- a/sync/tools/sync_listen_notifications.cc
+++ b/sync/tools/sync_listen_notifications.cc
@@ -13,6 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
+#include "base/rand_util.h"
#include "base/threading/thread.h"
#include "jingle/notifier/base/notification_method.h"
#include "jingle/notifier/base/notifier_options.h"
@@ -27,7 +28,7 @@
#include "sync/notifier/invalidation_state_tracker.h"
#include "sync/notifier/invalidation_util.h"
#include "sync/notifier/invalidator.h"
-#include "sync/notifier/invalidator_factory.h"
+#include "sync/notifier/non_blocking_invalidator.h"
#include "sync/tools/null_invalidation_state_tracker.h"
#if defined(OS_MACOSX)
@@ -134,12 +135,6 @@ notifier::NotifierOptions ParseNotifierOptions(
LOG_IF(INFO, notifier_options.allow_insecure_connection)
<< "Allowing insecure XMPP connections.";
- if (command_line.HasSwitch(kNotificationMethodSwitch)) {
- notifier_options.notification_method =
- notifier::StringToNotificationMethod(
- command_line.GetSwitchValueASCII(kNotificationMethodSwitch));
- }
-
return notifier_options;
}
@@ -172,15 +167,13 @@ int SyncListenNotificationsMain(int argc, char* argv[]) {
if (email.empty() || token.empty()) {
std::printf("Usage: %s --%s=foo@bar.com --%s=token\n"
"[--%s=host:port] [--%s] [--%s]\n"
- "[--%s=(server|p2p)]\n\n"
"Run chrome and set a breakpoint on\n"
"syncer::SyncManagerImpl::UpdateCredentials() "
"after logging into\n"
"sync to get the token to pass into this utility.\n",
argv[0],
kEmailSwitch, kTokenSwitch, kHostPortSwitch,
- kTrySslTcpFirstSwitch, kAllowInsecureConnectionSwitch,
- kNotificationMethodSwitch);
+ kTrySslTcpFirstSwitch, kAllowInsecureConnectionSwitch);
return -1;
}
@@ -194,11 +187,16 @@ int SyncListenNotificationsMain(int argc, char* argv[]) {
new MyTestURLRequestContextGetter(io_thread.message_loop_proxy()));
const char kClientInfo[] = "sync_listen_notifications";
NullInvalidationStateTracker null_invalidation_state_tracker;
- InvalidatorFactory invalidator_factory(
- notifier_options, kClientInfo,
- null_invalidation_state_tracker.AsWeakPtr());
scoped_ptr<Invalidator> invalidator(
- invalidator_factory.CreateInvalidator());
+ new NonBlockingInvalidator(
+ notifier_options,
+ base::RandBytesAsString(8),
+ null_invalidation_state_tracker.GetAllInvalidationStates(),
+ null_invalidation_state_tracker.GetBootstrapData(),
+ WeakHandle<InvalidationStateTracker>(
+ null_invalidation_state_tracker.AsWeakPtr()),
+ kClientInfo));
+
NotificationPrinter notification_printer;
invalidator->UpdateCredentials(email, token);

Powered by Google App Engine
This is Rietveld 408576698