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/notifier/non_blocking_invalidator.h" | 5 #include "sync/notifier/non_blocking_invalidator.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 DestroyInvalidator(); | 32 DestroyInvalidator(); |
33 } | 33 } |
34 | 34 |
35 void CreateInvalidator( | 35 void CreateInvalidator( |
36 const std::string& invalidator_client_id, | 36 const std::string& invalidator_client_id, |
37 const std::string& initial_state, | 37 const std::string& initial_state, |
38 const base::WeakPtr<InvalidationStateTracker>& | 38 const base::WeakPtr<InvalidationStateTracker>& |
39 invalidation_state_tracker) { | 39 invalidation_state_tracker) { |
40 DCHECK(!invalidator_.get()); | 40 DCHECK(!invalidator_.get()); |
41 base::Thread::Options options; | 41 base::Thread::Options options; |
42 options.message_loop_type = MessageLoop::TYPE_IO; | 42 options.message_loop_type = base::MessageLoop::TYPE_IO; |
43 io_thread_.StartWithOptions(options); | 43 io_thread_.StartWithOptions(options); |
44 request_context_getter_ = | 44 request_context_getter_ = |
45 new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); | 45 new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); |
46 notifier::NotifierOptions invalidator_options; | 46 notifier::NotifierOptions invalidator_options; |
47 invalidator_options.request_context_getter = request_context_getter_; | 47 invalidator_options.request_context_getter = request_context_getter_; |
48 invalidator_.reset( | 48 invalidator_.reset( |
49 new NonBlockingInvalidator( | 49 new NonBlockingInvalidator( |
50 invalidator_options, | 50 invalidator_options, |
51 invalidator_client_id, | 51 invalidator_client_id, |
52 InvalidationStateMap(), | 52 InvalidationStateMap(), |
(...skipping 26 matching lines...) Expand all Loading... |
79 void TriggerOnInvalidatorStateChange(InvalidatorState state) { | 79 void TriggerOnInvalidatorStateChange(InvalidatorState state) { |
80 invalidator_->OnInvalidatorStateChange(state); | 80 invalidator_->OnInvalidatorStateChange(state); |
81 } | 81 } |
82 | 82 |
83 void TriggerOnIncomingInvalidation( | 83 void TriggerOnIncomingInvalidation( |
84 const ObjectIdInvalidationMap& invalidation_map) { | 84 const ObjectIdInvalidationMap& invalidation_map) { |
85 invalidator_->OnIncomingInvalidation(invalidation_map); | 85 invalidator_->OnIncomingInvalidation(invalidation_map); |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 MessageLoop message_loop_; | 89 base::MessageLoop message_loop_; |
90 base::Thread io_thread_; | 90 base::Thread io_thread_; |
91 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 91 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
92 scoped_ptr<NonBlockingInvalidator> invalidator_; | 92 scoped_ptr<NonBlockingInvalidator> invalidator_; |
93 }; | 93 }; |
94 | 94 |
95 INSTANTIATE_TYPED_TEST_CASE_P( | 95 INSTANTIATE_TYPED_TEST_CASE_P( |
96 NonBlockingInvalidatorTest, InvalidatorTest, | 96 NonBlockingInvalidatorTest, InvalidatorTest, |
97 NonBlockingInvalidatorTestDelegate); | 97 NonBlockingInvalidatorTestDelegate); |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 } // namespace syncer | 101 } // namespace syncer |
OLD | NEW |