| 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/base64.h" | 10 #include "base/base64.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "jingle/notifier/base/notification_method.h" | 19 #include "jingle/notifier/base/notification_method.h" |
| 20 #include "jingle/notifier/base/notifier_options.h" | 20 #include "jingle/notifier/base/notifier_options.h" |
| 21 #include "net/base/host_port_pair.h" | 21 #include "net/base/host_port_pair.h" |
| 22 #include "net/base/host_resolver.h" | 22 #include "net/base/host_resolver.h" |
| 23 #include "net/base/network_change_notifier.h" | 23 #include "net/base/network_change_notifier.h" |
| 24 #include "net/base/transport_security_state.h" | 24 #include "net/base/transport_security_state.h" |
| 25 #include "net/url_request/url_request_test_util.h" | 25 #include "net/url_request/url_request_test_util.h" |
| 26 #include "sync/internal_api/public/base/model_type.h" | 26 #include "sync/internal_api/public/base/model_type.h" |
| 27 #include "sync/internal_api/public/base/model_type_state_map.h" | 27 #include "sync/internal_api/public/base/model_type_invalidation_map.h" |
| 28 #include "sync/notifier/invalidation_state_tracker.h" | 28 #include "sync/notifier/invalidation_state_tracker.h" |
| 29 #include "sync/notifier/invalidation_handler.h" | 29 #include "sync/notifier/invalidation_handler.h" |
| 30 #include "sync/notifier/invalidation_util.h" | 30 #include "sync/notifier/invalidation_util.h" |
| 31 #include "sync/notifier/invalidator_factory.h" | 31 #include "sync/notifier/invalidator_factory.h" |
| 32 #include "sync/notifier/invalidator.h" | 32 #include "sync/notifier/invalidator.h" |
| 33 | 33 |
| 34 #if defined(OS_MACOSX) | 34 #if defined(OS_MACOSX) |
| 35 #include "base/mac/scoped_nsautorelease_pool.h" | 35 #include "base/mac/scoped_nsautorelease_pool.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 53 public: | 53 public: |
| 54 NotificationPrinter() {} | 54 NotificationPrinter() {} |
| 55 virtual ~NotificationPrinter() {} | 55 virtual ~NotificationPrinter() {} |
| 56 | 56 |
| 57 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE { | 57 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE { |
| 58 LOG(INFO) << "Invalidator state changed to " | 58 LOG(INFO) << "Invalidator state changed to " |
| 59 << InvalidatorStateToString(state); | 59 << InvalidatorStateToString(state); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void OnIncomingInvalidation( | 62 virtual void OnIncomingInvalidation( |
| 63 const ObjectIdStateMap& id_state_map, | 63 const ObjectIdInvalidationMap& invalidation_map, |
| 64 IncomingInvalidationSource source) OVERRIDE { | 64 IncomingInvalidationSource source) OVERRIDE { |
| 65 const ModelTypeStateMap& type_state_map = | 65 const ModelTypeInvalidationMap& type_invalidation_map = |
| 66 ObjectIdStateMapToModelTypeStateMap(id_state_map); | 66 ObjectIdInvalidationMapToModelTypeInvalidationMap(invalidation_map); |
| 67 for (ModelTypeStateMap::const_iterator it = type_state_map.begin(); | 67 for (ModelTypeInvalidationMap::const_iterator it = |
| 68 it != type_state_map.end(); ++it) { | 68 type_invalidation_map.begin(); it != type_invalidation_map.end(); |
| 69 ++it) { |
| 69 LOG(INFO) << (source == REMOTE_INVALIDATION ? "Remote" : "Local") | 70 LOG(INFO) << (source == REMOTE_INVALIDATION ? "Remote" : "Local") |
| 70 << " Invalidation: type = " | 71 << " Invalidation: type = " |
| 71 << ModelTypeToString(it->first) | 72 << ModelTypeToString(it->first) |
| 72 << ", payload = " << it->second.payload; | 73 << ", payload = " << it->second.payload; |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter); | 78 DISALLOW_COPY_AND_ASSIGN(NotificationPrinter); |
| 78 }; | 79 }; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 io_thread.Stop(); | 257 io_thread.Stop(); |
| 257 return 0; | 258 return 0; |
| 258 } | 259 } |
| 259 | 260 |
| 260 } // namespace | 261 } // namespace |
| 261 } // namespace syncer | 262 } // namespace syncer |
| 262 | 263 |
| 263 int main(int argc, char* argv[]) { | 264 int main(int argc, char* argv[]) { |
| 264 return syncer::SyncListenNotificationsMain(argc, argv); | 265 return syncer::SyncListenNotificationsMain(argc, argv); |
| 265 } | 266 } |
| OLD | NEW |