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

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

Issue 56113003: Implement new invalidations ack tracking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify drive TODO comment + rebase Created 7 years 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/tools/sync_client.cc ('k') | no next file » | 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 <cstddef> 5 #include <cstddef>
6 #include <cstdio> 6 #include <cstdio>
7 #include <string> 7 #include <string>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 10 matching lines...) Expand all
21 #include "net/base/network_change_notifier.h" 21 #include "net/base/network_change_notifier.h"
22 #include "net/dns/host_resolver.h" 22 #include "net/dns/host_resolver.h"
23 #include "net/http/transport_security_state.h" 23 #include "net/http/transport_security_state.h"
24 #include "net/url_request/url_request_test_util.h" 24 #include "net/url_request/url_request_test_util.h"
25 #include "sync/internal_api/public/base/model_type.h" 25 #include "sync/internal_api/public/base/model_type.h"
26 #include "sync/notifier/invalidation_handler.h" 26 #include "sync/notifier/invalidation_handler.h"
27 #include "sync/notifier/invalidation_state_tracker.h" 27 #include "sync/notifier/invalidation_state_tracker.h"
28 #include "sync/notifier/invalidation_util.h" 28 #include "sync/notifier/invalidation_util.h"
29 #include "sync/notifier/invalidator.h" 29 #include "sync/notifier/invalidator.h"
30 #include "sync/notifier/non_blocking_invalidator.h" 30 #include "sync/notifier/non_blocking_invalidator.h"
31 #include "sync/notifier/object_id_invalidation_map.h"
31 #include "sync/tools/null_invalidation_state_tracker.h" 32 #include "sync/tools/null_invalidation_state_tracker.h"
32 33
33 #if defined(OS_MACOSX) 34 #if defined(OS_MACOSX)
34 #include "base/mac/scoped_nsautorelease_pool.h" 35 #include "base/mac/scoped_nsautorelease_pool.h"
35 #endif 36 #endif
36 37
37 // This is a simple utility that initializes a sync notifier and 38 // This is a simple utility that initializes a sync notifier and
38 // listens to any received notifications. 39 // listens to any received notifications.
39 40
40 namespace syncer { 41 namespace syncer {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const notifier::NotifierOptions& notifier_options = 176 const notifier::NotifierOptions& notifier_options =
176 ParseNotifierOptions( 177 ParseNotifierOptions(
177 command_line, 178 command_line,
178 new MyTestURLRequestContextGetter(io_thread.message_loop_proxy())); 179 new MyTestURLRequestContextGetter(io_thread.message_loop_proxy()));
179 const char kClientInfo[] = "sync_listen_notifications"; 180 const char kClientInfo[] = "sync_listen_notifications";
180 NullInvalidationStateTracker null_invalidation_state_tracker; 181 NullInvalidationStateTracker null_invalidation_state_tracker;
181 scoped_ptr<Invalidator> invalidator( 182 scoped_ptr<Invalidator> invalidator(
182 new NonBlockingInvalidator( 183 new NonBlockingInvalidator(
183 notifier_options, 184 notifier_options,
184 base::RandBytesAsString(8), 185 base::RandBytesAsString(8),
185 null_invalidation_state_tracker.GetAllInvalidationStates(), 186 null_invalidation_state_tracker.GetSavedInvalidations(),
186 null_invalidation_state_tracker.GetBootstrapData(), 187 null_invalidation_state_tracker.GetBootstrapData(),
187 WeakHandle<InvalidationStateTracker>( 188 WeakHandle<InvalidationStateTracker>(
188 null_invalidation_state_tracker.AsWeakPtr()), 189 null_invalidation_state_tracker.AsWeakPtr()),
189 kClientInfo)); 190 kClientInfo));
190 191
191 NotificationPrinter notification_printer; 192 NotificationPrinter notification_printer;
192 193
193 invalidator->UpdateCredentials(email, token); 194 invalidator->UpdateCredentials(email, token);
194 195
195 // Listen for notifications for all known types. 196 // Listen for notifications for all known types.
196 invalidator->RegisterHandler(&notification_printer); 197 invalidator->RegisterHandler(&notification_printer);
197 invalidator->UpdateRegisteredIds( 198 invalidator->UpdateRegisteredIds(
198 &notification_printer, ModelTypeSetToObjectIdSet(ModelTypeSet::All())); 199 &notification_printer, ModelTypeSetToObjectIdSet(ModelTypeSet::All()));
199 200
200 ui_loop.Run(); 201 ui_loop.Run();
201 202
202 invalidator->UnregisterHandler(&notification_printer); 203 invalidator->UnregisterHandler(&notification_printer);
203 io_thread.Stop(); 204 io_thread.Stop();
204 return 0; 205 return 0;
205 } 206 }
206 207
207 } // namespace 208 } // namespace
208 } // namespace syncer 209 } // namespace syncer
209 210
210 int main(int argc, char* argv[]) { 211 int main(int argc, char* argv[]) {
211 return syncer::SyncListenNotificationsMain(argc, argv); 212 return syncer::SyncListenNotificationsMain(argc, argv);
212 } 213 }
OLDNEW
« no previous file with comments | « sync/tools/sync_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698