| 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 "components/sync/engine_impl/sync_manager_impl.h" | 5 #include "components/sync/engine_impl/sync_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 case CONFIGURE_REASON_UNKNOWN: | 77 case CONFIGURE_REASON_UNKNOWN: |
| 78 NOTREACHED(); | 78 NOTREACHED(); |
| 79 } | 79 } |
| 80 return GetUpdatesCallerInfo::UNKNOWN; | 80 return GetUpdatesCallerInfo::UNKNOWN; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace |
| 84 | 84 |
| 85 SyncManagerImpl::SyncManagerImpl(const std::string& name) | 85 SyncManagerImpl::SyncManagerImpl(const std::string& name) |
| 86 : name_(name), | 86 : name_(name), |
| 87 change_delegate_(NULL), | 87 change_delegate_(nullptr), |
| 88 initialized_(false), | 88 initialized_(false), |
| 89 observing_network_connectivity_changes_(false), | 89 observing_network_connectivity_changes_(false), |
| 90 weak_ptr_factory_(this) { | 90 weak_ptr_factory_(this) { |
| 91 // Pre-fill |notification_info_map_|. | 91 // Pre-fill |notification_info_map_|. |
| 92 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 92 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 93 notification_info_map_.insert( | 93 notification_info_map_.insert( |
| 94 std::make_pair(ModelTypeFromInt(i), NotificationInfo())); | 94 std::make_pair(ModelTypeFromInt(i), NotificationInfo())); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 if (sync_encryption_handler_) { | 518 if (sync_encryption_handler_) { |
| 519 sync_encryption_handler_->RemoveObserver(&debug_info_event_listener_); | 519 sync_encryption_handler_->RemoveObserver(&debug_info_event_listener_); |
| 520 sync_encryption_handler_->RemoveObserver(this); | 520 sync_encryption_handler_->RemoveObserver(this); |
| 521 } | 521 } |
| 522 | 522 |
| 523 SetJsEventHandler(WeakHandle<JsEventHandler>()); | 523 SetJsEventHandler(WeakHandle<JsEventHandler>()); |
| 524 RemoveObserver(&js_sync_manager_observer_); | 524 RemoveObserver(&js_sync_manager_observer_); |
| 525 | 525 |
| 526 RemoveObserver(&debug_info_event_listener_); | 526 RemoveObserver(&debug_info_event_listener_); |
| 527 | 527 |
| 528 // |connection_manager_| may end up being NULL here in tests (in synchronous | 528 // |connection_manager_| may end up being null here in tests (in synchronous |
| 529 // initialization mode). | 529 // initialization mode). |
| 530 // | 530 // |
| 531 // TODO(akalin): Fix this behavior. | 531 // TODO(akalin): Fix this behavior. |
| 532 if (connection_manager_) | 532 if (connection_manager_) |
| 533 connection_manager_->RemoveListener(this); | 533 connection_manager_->RemoveListener(this); |
| 534 connection_manager_.reset(); | 534 connection_manager_.reset(); |
| 535 | 535 |
| 536 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 536 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 537 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 537 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
| 538 observing_network_connectivity_changes_ = false; | 538 observing_network_connectivity_changes_ = false; |
| 539 | 539 |
| 540 if (initialized_ && directory()) { | 540 if (initialized_ && directory()) { |
| 541 directory()->SaveChanges(); | 541 directory()->SaveChanges(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 share_.directory.reset(); | 544 share_.directory.reset(); |
| 545 | 545 |
| 546 change_delegate_ = NULL; | 546 change_delegate_ = nullptr; |
| 547 | 547 |
| 548 initialized_ = false; | 548 initialized_ = false; |
| 549 | 549 |
| 550 // We reset these here, since only now we know they will not be | 550 // We reset these here, since only now we know they will not be |
| 551 // accessed from other threads (since we shut down everything). | 551 // accessed from other threads (since we shut down everything). |
| 552 change_observer_.Reset(); | 552 change_observer_.Reset(); |
| 553 weak_handle_this_.Reset(); | 553 weak_handle_this_.Reset(); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void SyncManagerImpl::OnIPAddressChanged() { | 556 void SyncManagerImpl::OnIPAddressChanged() { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 } | 995 } |
| 996 | 996 |
| 997 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch, | 997 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch, |
| 998 bool empty_jar) { | 998 bool empty_jar) { |
| 999 DCHECK(thread_checker_.CalledOnValidThread()); | 999 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1000 cycle_context_->set_cookie_jar_mismatch(account_mismatch); | 1000 cycle_context_->set_cookie_jar_mismatch(account_mismatch); |
| 1001 cycle_context_->set_cookie_jar_empty(empty_jar); | 1001 cycle_context_->set_cookie_jar_empty(empty_jar); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 } // namespace syncer | 1004 } // namespace syncer |
| OLD | NEW |