OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "jingle/notifier/listener/mediator_thread_impl.h" | 5 #include "jingle/notifier/listener/mediator_thread_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/task.h" | |
10 #include "jingle/notifier/base/task_pump.h" | 9 #include "jingle/notifier/base/task_pump.h" |
11 #include "jingle/notifier/communicator/connection_options.h" | 10 #include "jingle/notifier/communicator/connection_options.h" |
12 #include "jingle/notifier/communicator/const_communicator.h" | 11 #include "jingle/notifier/communicator/const_communicator.h" |
13 #include "jingle/notifier/communicator/xmpp_connection_generator.h" | 12 #include "jingle/notifier/communicator/xmpp_connection_generator.h" |
14 #include "jingle/notifier/listener/listen_task.h" | 13 #include "jingle/notifier/listener/listen_task.h" |
15 #include "jingle/notifier/listener/send_update_task.h" | 14 #include "jingle/notifier/listener/send_update_task.h" |
16 #include "jingle/notifier/listener/subscribe_task.h" | 15 #include "jingle/notifier/listener/subscribe_task.h" |
17 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
18 #include "net/base/host_resolver.h" | 17 #include "net/base/host_resolver.h" |
19 #include "talk/xmpp/xmppclientsettings.h" | 18 #include "talk/xmpp/xmppclientsettings.h" |
20 | 19 |
21 // We manage the lifetime of notifier::MediatorThreadImpl ourselves. | |
22 DISABLE_RUNNABLE_METHOD_REFCOUNT(notifier::MediatorThreadImpl); | |
23 | |
24 namespace notifier { | 20 namespace notifier { |
25 | 21 |
26 MediatorThreadImpl::MediatorThreadImpl(const NotifierOptions& notifier_options) | 22 MediatorThreadImpl::MediatorThreadImpl(const NotifierOptions& notifier_options) |
27 : observers_(new ObserverListThreadSafe<Observer>()), | 23 : observers_(new ObserverListThreadSafe<Observer>()), |
28 parent_message_loop_(MessageLoop::current()), | 24 parent_message_loop_(MessageLoop::current()), |
29 notifier_options_(notifier_options), | 25 notifier_options_(notifier_options), |
30 worker_thread_("MediatorThread worker thread") { | 26 worker_thread_("MediatorThread worker thread") { |
31 DCHECK(parent_message_loop_); | 27 DCHECK(parent_message_loop_); |
32 } | 28 } |
33 | 29 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 base_task_.reset(); | 229 base_task_.reset(); |
234 observers_->Notify(&Observer::OnConnectionStateChange, false); | 230 observers_->Notify(&Observer::OnConnectionStateChange, false); |
235 } | 231 } |
236 | 232 |
237 void MediatorThreadImpl::OnSubscriptionStateChange(bool success) { | 233 void MediatorThreadImpl::OnSubscriptionStateChange(bool success) { |
238 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 234 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
239 observers_->Notify(&Observer::OnSubscriptionStateChange, success); | 235 observers_->Notify(&Observer::OnSubscriptionStateChange, success); |
240 } | 236 } |
241 | 237 |
242 } // namespace notifier | 238 } // namespace notifier |
OLD | NEW |