| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // An implementation of Invalidator that wraps an invalidation | 5 // An implementation of Invalidator that wraps an invalidation |
| 6 // client. Handles the details of connecting to XMPP and hooking it | 6 // client. Handles the details of connecting to XMPP and hooking it |
| 7 // up to the invalidation client. | 7 // up to the invalidation client. |
| 8 // | 8 // |
| 9 // You probably don't want to use this directly; use | 9 // You probably don't want to use this directly; use |
| 10 // NonBlockingInvalidator. | 10 // NonBlockingInvalidator. |
| 11 | 11 |
| 12 #ifndef COMPONENTS_INVALIDATION_IMPL_INVALIDATION_NOTIFIER_H_ | 12 #ifndef COMPONENTS_INVALIDATION_IMPL_INVALIDATION_NOTIFIER_H_ |
| 13 #define COMPONENTS_INVALIDATION_IMPL_INVALIDATION_NOTIFIER_H_ | 13 #define COMPONENTS_INVALIDATION_IMPL_INVALIDATION_NOTIFIER_H_ |
| 14 | 14 |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 #include "base/sequence_checker.h" |
| 22 #include "base/sequenced_task_runner.h" | 23 #include "base/sequenced_task_runner.h" |
| 23 #include "base/single_thread_task_runner.h" | 24 #include "base/single_thread_task_runner.h" |
| 24 #include "base/threading/non_thread_safe.h" | |
| 25 #include "components/invalidation/impl/invalidation_state_tracker.h" | 25 #include "components/invalidation/impl/invalidation_state_tracker.h" |
| 26 #include "components/invalidation/impl/invalidator.h" | 26 #include "components/invalidation/impl/invalidator.h" |
| 27 #include "components/invalidation/impl/invalidator_registrar.h" | 27 #include "components/invalidation/impl/invalidator_registrar.h" |
| 28 #include "components/invalidation/impl/sync_invalidation_listener.h" | 28 #include "components/invalidation/impl/sync_invalidation_listener.h" |
| 29 #include "components/invalidation/public/invalidation_export.h" | 29 #include "components/invalidation/public/invalidation_export.h" |
| 30 | 30 |
| 31 namespace syncer { | 31 namespace syncer { |
| 32 | 32 |
| 33 // This class must live on the IO thread. | 33 // This class must live on the IO thread. |
| 34 class INVALIDATION_EXPORT InvalidationNotifier | 34 class INVALIDATION_EXPORT InvalidationNotifier |
| 35 : public Invalidator, | 35 : public Invalidator, |
| 36 public SyncInvalidationListener::Delegate, | 36 public SyncInvalidationListener::Delegate { |
| 37 public base::NonThreadSafe { | |
| 38 public: | 37 public: |
| 39 // |invalidation_state_tracker| must be initialized. | 38 // |invalidation_state_tracker| must be initialized. |
| 40 InvalidationNotifier( | 39 InvalidationNotifier( |
| 41 std::unique_ptr<SyncNetworkChannel> network_channel, | 40 std::unique_ptr<SyncNetworkChannel> network_channel, |
| 42 const std::string& invalidator_client_id, | 41 const std::string& invalidator_client_id, |
| 43 const UnackedInvalidationsMap& saved_invalidations, | 42 const UnackedInvalidationsMap& saved_invalidations, |
| 44 const std::string& invalidation_bootstrap_data, | 43 const std::string& invalidation_bootstrap_data, |
| 45 const base::WeakPtr<InvalidationStateTracker>& invalidation_state_tracker, | 44 const base::WeakPtr<InvalidationStateTracker>& invalidation_state_tracker, |
| 46 scoped_refptr<base::SingleThreadTaskRunner> | 45 scoped_refptr<base::SingleThreadTaskRunner> |
| 47 invalidation_state_tracker_task_runner, | 46 invalidation_state_tracker_task_runner, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 90 |
| 92 // The client ID to pass to |invalidation_listener_|. | 91 // The client ID to pass to |invalidation_listener_|. |
| 93 const std::string invalidator_client_id_; | 92 const std::string invalidator_client_id_; |
| 94 | 93 |
| 95 // The initial bootstrap data to pass to |invalidation_listener_|. | 94 // The initial bootstrap data to pass to |invalidation_listener_|. |
| 96 const std::string invalidation_bootstrap_data_; | 95 const std::string invalidation_bootstrap_data_; |
| 97 | 96 |
| 98 // The invalidation listener. | 97 // The invalidation listener. |
| 99 SyncInvalidationListener invalidation_listener_; | 98 SyncInvalidationListener invalidation_listener_; |
| 100 | 99 |
| 100 SEQUENCE_CHECKER(sequence_checker_); |
| 101 |
| 101 DISALLOW_COPY_AND_ASSIGN(InvalidationNotifier); | 102 DISALLOW_COPY_AND_ASSIGN(InvalidationNotifier); |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace syncer | 105 } // namespace syncer |
| 105 | 106 |
| 106 #endif // COMPONENTS_INVALIDATION_IMPL_INVALIDATION_NOTIFIER_H_ | 107 #endif // COMPONENTS_INVALIDATION_IMPL_INVALIDATION_NOTIFIER_H_ |
| OLD | NEW |