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

Side by Side Diff: sync/tools/sync_listen_notifications.cc

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 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 <cstddef>
msw 2012/08/03 23:30:46 ditto same basictypes nit/q
akalin 2012/08/07 07:25:19 ditto.
5 #include <cstdio> 6 #include <cstdio>
6 #include <string> 7 #include <string>
7 8
8 #include "base/at_exit.h" 9 #include "base/at_exit.h"
9 #include "base/base64.h" 10 #include "base/base64.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 SyncNotifierFactory sync_notifier_factory( 233 SyncNotifierFactory sync_notifier_factory(
233 notifier_options, kClientInfo, 234 notifier_options, kClientInfo,
234 null_invalidation_state_tracker.AsWeakPtr()); 235 null_invalidation_state_tracker.AsWeakPtr());
235 scoped_ptr<SyncNotifier> sync_notifier( 236 scoped_ptr<SyncNotifier> sync_notifier(
236 sync_notifier_factory.CreateSyncNotifier()); 237 sync_notifier_factory.CreateSyncNotifier());
237 NotificationPrinter notification_printer; 238 NotificationPrinter notification_printer;
238 239
239 const char kUniqueId[] = "fake_unique_id"; 240 const char kUniqueId[] = "fake_unique_id";
240 sync_notifier->SetUniqueId(kUniqueId); 241 sync_notifier->SetUniqueId(kUniqueId);
241 sync_notifier->UpdateCredentials(email, token); 242 sync_notifier->UpdateCredentials(email, token);
243
242 // Listen for notifications for all known types. 244 // Listen for notifications for all known types.
245 const char kHandlerName[] = "sync_listen_notifications";
246 sync_notifier->SetHandler(kHandlerName, &notification_printer);
243 sync_notifier->UpdateRegisteredIds( 247 sync_notifier->UpdateRegisteredIds(
244 &notification_printer, ModelTypeSetToObjectIdSet(ModelTypeSet::All())); 248 kHandlerName, ModelTypeSetToObjectIdSet(ModelTypeSet::All()));
245 249
246 ui_loop.Run(); 250 ui_loop.Run();
247 251
248 sync_notifier->UpdateRegisteredIds(&notification_printer, ObjectIdSet()); 252 sync_notifier->SetHandler(kHandlerName, NULL);
249 io_thread.Stop(); 253 io_thread.Stop();
250 return 0; 254 return 0;
251 } 255 }
252 256
253 } // namespace 257 } // namespace
254 } // namespace syncer 258 } // namespace syncer
255 259
256 int main(int argc, char* argv[]) { 260 int main(int argc, char* argv[]) {
257 return syncer::SyncListenNotificationsMain(argc, argv); 261 return syncer::SyncListenNotificationsMain(argc, argv);
258 } 262 }
OLDNEW
« sync/notifier/sync_notifier_helper.cc ('K') | « sync/notifier/sync_notifier_helper_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698