| 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 <stdint.h> |
| 6 |
| 5 #include <cstddef> | 7 #include <cstddef> |
| 6 #include <cstdio> | 8 #include <cstdio> |
| 7 #include <string> | 9 #include <string> |
| 8 | 10 |
| 9 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 12 #include "base/debug/stack_trace.h" | 14 #include "base/debug/stack_trace.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
| 15 #include "base/logging.h" | 17 #include "base/logging.h" |
| 16 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 19 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
| 20 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
| 21 #include "base/task_runner.h" | 23 #include "base/task_runner.h" |
| 22 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
| 25 #include "build/build_config.h" |
| 23 #include "components/invalidation/impl/non_blocking_invalidator.h" | 26 #include "components/invalidation/impl/non_blocking_invalidator.h" |
| 24 #include "components/invalidation/public/object_id_invalidation_map.h" | 27 #include "components/invalidation/public/object_id_invalidation_map.h" |
| 25 #include "components/sync_driver/invalidation_helper.h" | 28 #include "components/sync_driver/invalidation_helper.h" |
| 26 #include "jingle/notifier/base/notification_method.h" | 29 #include "jingle/notifier/base/notification_method.h" |
| 27 #include "jingle/notifier/base/notifier_options.h" | 30 #include "jingle/notifier/base/notifier_options.h" |
| 28 #include "net/base/host_port_pair.h" | 31 #include "net/base/host_port_pair.h" |
| 29 #include "net/base/network_change_notifier.h" | 32 #include "net/base/network_change_notifier.h" |
| 30 #include "net/dns/host_resolver.h" | 33 #include "net/dns/host_resolver.h" |
| 31 #include "net/http/transport_security_state.h" | 34 #include "net/http/transport_security_state.h" |
| 32 #include "net/url_request/url_request_test_util.h" | 35 #include "net/url_request/url_request_test_util.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 std::string str; | 127 std::string str; |
| 125 base::JSONWriter::Write(value, &str); | 128 base::JSONWriter::Write(value, &str); |
| 126 return str; | 129 return str; |
| 127 } | 130 } |
| 128 | 131 |
| 129 class LoggingChangeDelegate : public SyncManager::ChangeDelegate { | 132 class LoggingChangeDelegate : public SyncManager::ChangeDelegate { |
| 130 public: | 133 public: |
| 131 ~LoggingChangeDelegate() override {} | 134 ~LoggingChangeDelegate() override {} |
| 132 | 135 |
| 133 void OnChangesApplied(ModelType model_type, | 136 void OnChangesApplied(ModelType model_type, |
| 134 int64 model_version, | 137 int64_t model_version, |
| 135 const BaseTransaction* trans, | 138 const BaseTransaction* trans, |
| 136 const ImmutableChangeRecordList& changes) override { | 139 const ImmutableChangeRecordList& changes) override { |
| 137 LOG(INFO) << "Changes applied for " | 140 LOG(INFO) << "Changes applied for " |
| 138 << ModelTypeToString(model_type); | 141 << ModelTypeToString(model_type); |
| 139 size_t i = 1; | 142 size_t i = 1; |
| 140 size_t change_count = changes.Get().size(); | 143 size_t change_count = changes.Get().size(); |
| 141 for (ChangeRecordList::const_iterator it = | 144 for (ChangeRecordList::const_iterator it = |
| 142 changes.Get().begin(); it != changes.Get().end(); ++it) { | 145 changes.Get().begin(); it != changes.Get().end(); ++it) { |
| 143 scoped_ptr<base::DictionaryValue> change_value(it->ToValue()); | 146 scoped_ptr<base::DictionaryValue> change_value(it->ToValue()); |
| 144 LOG(INFO) << "Change (" << i << "/" << change_count << "): " | 147 LOG(INFO) << "Change (" << i << "/" << change_count << "): " |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 ~InvalidationAdapter() override {} | 196 ~InvalidationAdapter() override {} |
| 194 | 197 |
| 195 bool IsUnknownVersion() const override { | 198 bool IsUnknownVersion() const override { |
| 196 return invalidation_.is_unknown_version(); | 199 return invalidation_.is_unknown_version(); |
| 197 } | 200 } |
| 198 | 201 |
| 199 const std::string& GetPayload() const override { | 202 const std::string& GetPayload() const override { |
| 200 return invalidation_.payload(); | 203 return invalidation_.payload(); |
| 201 } | 204 } |
| 202 | 205 |
| 203 int64 GetVersion() const override { return invalidation_.version(); } | 206 int64_t GetVersion() const override { return invalidation_.version(); } |
| 204 | 207 |
| 205 void Acknowledge() override { invalidation_.Acknowledge(); } | 208 void Acknowledge() override { invalidation_.Acknowledge(); } |
| 206 | 209 |
| 207 void Drop() override { invalidation_.Drop(); } | 210 void Drop() override { invalidation_.Drop(); } |
| 208 | 211 |
| 209 private: | 212 private: |
| 210 syncer::Invalidation invalidation_; | 213 syncer::Invalidation invalidation_; |
| 211 }; | 214 }; |
| 212 | 215 |
| 213 class InvalidatorShim : public InvalidationHandler { | 216 class InvalidatorShim : public InvalidationHandler { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 io_thread.Stop(); | 458 io_thread.Stop(); |
| 456 return 0; | 459 return 0; |
| 457 } | 460 } |
| 458 | 461 |
| 459 } // namespace | 462 } // namespace |
| 460 } // namespace syncer | 463 } // namespace syncer |
| 461 | 464 |
| 462 int main(int argc, char* argv[]) { | 465 int main(int argc, char* argv[]) { |
| 463 return syncer::SyncClientMain(argc, argv); | 466 return syncer::SyncClientMain(argc, argv); |
| 464 } | 467 } |
| OLD | NEW |