| 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 "sync/internal_api/sync_manager.h" | 5 #include "sync/internal_api/sync_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "net/base/network_change_notifier.h" | 20 #include "net/base/network_change_notifier.h" |
| 21 #include "sync/engine/throttled_data_type_tracker.h" |
| 21 #include "sync/engine/net/server_connection_manager.h" | 22 #include "sync/engine/net/server_connection_manager.h" |
| 22 #include "sync/engine/nigori_util.h" | 23 #include "sync/engine/nigori_util.h" |
| 23 #include "sync/engine/polling_constants.h" | 24 #include "sync/engine/polling_constants.h" |
| 24 #include "sync/engine/sync_scheduler.h" | 25 #include "sync/engine/sync_scheduler.h" |
| 25 #include "sync/engine/syncer_types.h" | 26 #include "sync/engine/syncer_types.h" |
| 26 #include "sync/internal_api/all_status.h" | 27 #include "sync/internal_api/all_status.h" |
| 27 #include "sync/internal_api/base_node.h" | 28 #include "sync/internal_api/base_node.h" |
| 28 #include "sync/internal_api/change_reorder_buffer.h" | 29 #include "sync/internal_api/change_reorder_buffer.h" |
| 29 #include "sync/internal_api/configure_reason.h" | 30 #include "sync/internal_api/configure_reason.h" |
| 30 #include "sync/internal_api/debug_info_event_listener.h" | 31 #include "sync/internal_api/debug_info_event_listener.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 public syncable::DirectoryChangeDelegate { | 140 public syncable::DirectoryChangeDelegate { |
| 140 public: | 141 public: |
| 141 explicit SyncInternal(const std::string& name) | 142 explicit SyncInternal(const std::string& name) |
| 142 : name_(name), | 143 : name_(name), |
| 143 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 144 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 144 registrar_(NULL), | 145 registrar_(NULL), |
| 145 change_delegate_(NULL), | 146 change_delegate_(NULL), |
| 146 initialized_(false), | 147 initialized_(false), |
| 147 testing_mode_(NON_TEST), | 148 testing_mode_(NON_TEST), |
| 148 observing_ip_address_changes_(false), | 149 observing_ip_address_changes_(false), |
| 150 throttled_data_type_tracker_(&allstatus_), |
| 149 traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord), | 151 traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord), |
| 150 encryptor_(NULL), | 152 encryptor_(NULL), |
| 151 unrecoverable_error_handler_(NULL), | 153 unrecoverable_error_handler_(NULL), |
| 152 report_unrecoverable_error_function_(NULL), | 154 report_unrecoverable_error_function_(NULL), |
| 153 created_on_loop_(MessageLoop::current()), | 155 created_on_loop_(MessageLoop::current()), |
| 154 nigori_overwrite_count_(0) { | 156 nigori_overwrite_count_(0) { |
| 155 // Pre-fill |notification_info_map_|. | 157 // Pre-fill |notification_info_map_|. |
| 156 for (int i = syncable::FIRST_REAL_MODEL_TYPE; | 158 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
| 157 i < syncable::MODEL_TYPE_COUNT; ++i) { | 159 i < syncable::MODEL_TYPE_COUNT; ++i) { |
| 158 notification_info_map_.insert( | 160 notification_info_map_.insert( |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 // Map used to store the notification info to be displayed in | 603 // Map used to store the notification info to be displayed in |
| 602 // about:sync page. | 604 // about:sync page. |
| 603 NotificationInfoMap notification_info_map_; | 605 NotificationInfoMap notification_info_map_; |
| 604 | 606 |
| 605 // These are for interacting with chrome://sync-internals. | 607 // These are for interacting with chrome://sync-internals. |
| 606 JsMessageHandlerMap js_message_handlers_; | 608 JsMessageHandlerMap js_message_handlers_; |
| 607 WeakHandle<JsEventHandler> js_event_handler_; | 609 WeakHandle<JsEventHandler> js_event_handler_; |
| 608 JsSyncManagerObserver js_sync_manager_observer_; | 610 JsSyncManagerObserver js_sync_manager_observer_; |
| 609 JsMutationEventObserver js_mutation_event_observer_; | 611 JsMutationEventObserver js_mutation_event_observer_; |
| 610 | 612 |
| 613 browser_sync::ThrottledDataTypeTracker throttled_data_type_tracker_; |
| 614 |
| 611 // This is for keeping track of client events to send to the server. | 615 // This is for keeping track of client events to send to the server. |
| 612 DebugInfoEventListener debug_info_event_listener_; | 616 DebugInfoEventListener debug_info_event_listener_; |
| 613 | 617 |
| 614 browser_sync::TrafficRecorder traffic_recorder_; | 618 browser_sync::TrafficRecorder traffic_recorder_; |
| 615 | 619 |
| 616 Encryptor* encryptor_; | 620 Encryptor* encryptor_; |
| 617 UnrecoverableErrorHandler* unrecoverable_error_handler_; | 621 UnrecoverableErrorHandler* unrecoverable_error_handler_; |
| 618 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; | 622 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; |
| 619 | 623 |
| 620 MessageLoop* const created_on_loop_; | 624 MessageLoop* const created_on_loop_; |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 // Build a SyncSessionContext and store the worker in it. | 949 // Build a SyncSessionContext and store the worker in it. |
| 946 DVLOG(1) << "Sync is bringing up SyncSessionContext."; | 950 DVLOG(1) << "Sync is bringing up SyncSessionContext."; |
| 947 std::vector<SyncEngineEventListener*> listeners; | 951 std::vector<SyncEngineEventListener*> listeners; |
| 948 listeners.push_back(&allstatus_); | 952 listeners.push_back(&allstatus_); |
| 949 listeners.push_back(this); | 953 listeners.push_back(this); |
| 950 SyncSessionContext* context = new SyncSessionContext( | 954 SyncSessionContext* context = new SyncSessionContext( |
| 951 connection_manager_.get(), | 955 connection_manager_.get(), |
| 952 directory(), | 956 directory(), |
| 953 model_safe_worker_registrar, | 957 model_safe_worker_registrar, |
| 954 extensions_activity_monitor, | 958 extensions_activity_monitor, |
| 959 &throttled_data_type_tracker_, |
| 955 listeners, | 960 listeners, |
| 956 &debug_info_event_listener_, | 961 &debug_info_event_listener_, |
| 957 &traffic_recorder_); | 962 &traffic_recorder_); |
| 958 context->set_account_name(credentials.email); | 963 context->set_account_name(credentials.email); |
| 959 // The SyncScheduler takes ownership of |context|. | 964 // The SyncScheduler takes ownership of |context|. |
| 960 scheduler_.reset(new SyncScheduler(name_, context, new Syncer())); | 965 scheduler_.reset(new SyncScheduler(name_, context, new Syncer())); |
| 961 } | 966 } |
| 962 | 967 |
| 963 bool signed_in = SignIn(credentials); | 968 bool signed_in = SignIn(credentials); |
| 964 | 969 |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 share->directory->GetDownloadProgress(i.Get(), &marker); | 2514 share->directory->GetDownloadProgress(i.Get(), &marker); |
| 2510 | 2515 |
| 2511 if (marker.token().empty()) | 2516 if (marker.token().empty()) |
| 2512 result.Put(i.Get()); | 2517 result.Put(i.Get()); |
| 2513 | 2518 |
| 2514 } | 2519 } |
| 2515 return result; | 2520 return result; |
| 2516 } | 2521 } |
| 2517 | 2522 |
| 2518 } // namespace sync_api | 2523 } // namespace sync_api |
| OLD | NEW |