OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // An implementation of SyncNotifier that wraps InvalidationNotifier | 5 // An implementation of SyncNotifier that wraps InvalidationNotifier |
6 // on its own thread. | 6 // on its own thread. |
7 | 7 |
8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ | 8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ |
9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ | 9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "jingle/notifier/base/notifier_options.h" | 17 #include "jingle/notifier/base/notifier_options.h" |
| 18 #include "sync/base/sync_export.h" |
18 #include "sync/internal_api/public/util/weak_handle.h" | 19 #include "sync/internal_api/public/util/weak_handle.h" |
19 #include "sync/notifier/invalidation_handler.h" | 20 #include "sync/notifier/invalidation_handler.h" |
20 #include "sync/notifier/invalidation_state_tracker.h" | 21 #include "sync/notifier/invalidation_state_tracker.h" |
21 #include "sync/notifier/invalidator.h" | 22 #include "sync/notifier/invalidator.h" |
22 #include "sync/notifier/invalidator_registrar.h" | 23 #include "sync/notifier/invalidator_registrar.h" |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class SingleThreadTaskRunner; | 26 class SingleThreadTaskRunner; |
26 } // namespace base | 27 } // namespace base |
27 | 28 |
28 namespace syncer { | 29 namespace syncer { |
29 | 30 |
30 // TODO(akalin): Generalize the interface so it can use any Invalidator. | 31 // TODO(akalin): Generalize the interface so it can use any Invalidator. |
31 // (http://crbug.com/140409). | 32 // (http://crbug.com/140409). |
32 class NonBlockingInvalidator | 33 class SYNC_EXPORT_PRIVATE NonBlockingInvalidator |
33 : public Invalidator, | 34 : public Invalidator, |
34 // InvalidationHandler to "observe" our Core via WeakHandle. | 35 // InvalidationHandler to "observe" our Core via WeakHandle. |
35 public InvalidationHandler { | 36 public InvalidationHandler { |
36 public: | 37 public: |
37 // |invalidation_state_tracker| must be initialized. | 38 // |invalidation_state_tracker| must be initialized. |
38 NonBlockingInvalidator( | 39 NonBlockingInvalidator( |
39 const notifier::NotifierOptions& notifier_options, | 40 const notifier::NotifierOptions& notifier_options, |
40 const InvalidationStateMap& initial_invalidation_state_map, | 41 const InvalidationStateMap& initial_invalidation_state_map, |
41 const std::string& invalidation_bootstrap_data, | 42 const std::string& invalidation_bootstrap_data, |
42 const WeakHandle<InvalidationStateTracker>& | 43 const WeakHandle<InvalidationStateTracker>& |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 scoped_refptr<Core> core_; | 77 scoped_refptr<Core> core_; |
77 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_; | 78 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_; |
78 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 79 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
79 | 80 |
80 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidator); | 81 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidator); |
81 }; | 82 }; |
82 | 83 |
83 } // namespace syncer | 84 } // namespace syncer |
84 | 85 |
85 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ | 86 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ |
OLD | NEW |