| OLD | NEW |
| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "jingle/notifier/base/notification_method.h" | 18 #include "jingle/notifier/base/notification_method.h" |
| 19 #include "jingle/notifier/base/notifier_options.h" | 19 #include "jingle/notifier/base/notifier_options.h" |
| 20 #include "net/base/host_port_pair.h" | 20 #include "net/base/host_port_pair.h" |
| 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/internal_api/public/base/model_type_invalidation_map.h" | |
| 27 #include "sync/notifier/invalidation_handler.h" | 26 #include "sync/notifier/invalidation_handler.h" |
| 28 #include "sync/notifier/invalidation_state_tracker.h" | 27 #include "sync/notifier/invalidation_state_tracker.h" |
| 29 #include "sync/notifier/invalidation_util.h" | 28 #include "sync/notifier/invalidation_util.h" |
| 30 #include "sync/notifier/invalidator.h" | 29 #include "sync/notifier/invalidator.h" |
| 31 #include "sync/notifier/non_blocking_invalidator.h" | 30 #include "sync/notifier/non_blocking_invalidator.h" |
| 32 #include "sync/tools/null_invalidation_state_tracker.h" | 31 #include "sync/tools/null_invalidation_state_tracker.h" |
| 33 | 32 |
| 34 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
| 35 #include "base/mac/scoped_nsautorelease_pool.h" | 34 #include "base/mac/scoped_nsautorelease_pool.h" |
| 36 #endif | 35 #endif |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 public: | 52 public: |
| 54 NotificationPrinter() {} | 53 NotificationPrinter() {} |
| 55 virtual ~NotificationPrinter() {} | 54 virtual ~NotificationPrinter() {} |
| 56 | 55 |
| 57 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE { | 56 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE { |
| 58 LOG(INFO) << "Invalidator state changed to " | 57 LOG(INFO) << "Invalidator state changed to " |
| 59 << InvalidatorStateToString(state); | 58 << InvalidatorStateToString(state); |
| 60 } | 59 } |
| 61 | 60 |
| 62 virtual void OnIncomingInvalidation( | 61 virtual void OnIncomingInvalidation( |
| 63 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE { | 62 const ObjectIdInvalidationMap& object_id_invalidation_map) OVERRIDE { |
| 64 const ModelTypeInvalidationMap& type_invalidation_map = | 63 LOG(INFO) << "Remote invalidation: " |
| 65 ObjectIdInvalidationMapToModelTypeInvalidationMap(invalidation_map); | 64 << object_id_invalidation_map.ToString(); |
| 66 for (ModelTypeInvalidationMap::const_iterator it = | |
| 67 type_invalidation_map.begin(); it != type_invalidation_map.end(); | |
| 68 ++it) { | |
| 69 LOG(INFO) << "Remote invalidation: type = " | |
| 70 << ModelTypeToString(it->first) | |
| 71 << ", payload = " << it->second.payload; | |
| 72 } | |
| 73 } | 65 } |
| 74 | 66 |
| 75 private: | 67 private: |
| 76 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter); | 68 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter); |
| 77 }; | 69 }; |
| 78 | 70 |
| 79 // Needed to use a real host resolver. | 71 // Needed to use a real host resolver. |
| 80 class MyTestURLRequestContext : public net::TestURLRequestContext { | 72 class MyTestURLRequestContext : public net::TestURLRequestContext { |
| 81 public: | 73 public: |
| 82 MyTestURLRequestContext() : TestURLRequestContext(true) { | 74 MyTestURLRequestContext() : TestURLRequestContext(true) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 io_thread.Stop(); | 201 io_thread.Stop(); |
| 210 return 0; | 202 return 0; |
| 211 } | 203 } |
| 212 | 204 |
| 213 } // namespace | 205 } // namespace |
| 214 } // namespace syncer | 206 } // namespace syncer |
| 215 | 207 |
| 216 int main(int argc, char* argv[]) { | 208 int main(int argc, char* argv[]) { |
| 217 return syncer::SyncListenNotificationsMain(argc, argv); | 209 return syncer::SyncListenNotificationsMain(argc, argv); |
| 218 } | 210 } |
| OLD | NEW |