Chromium Code Reviews| Index: remoting/signaling/delegating_signal_strategy.h |
| diff --git a/remoting/signaling/delegating_signal_strategy.h b/remoting/signaling/delegating_signal_strategy.h |
| index 0b6d927687d4bb2f14378087b0d912f6327d5587..049b4554b899b99b010ec7a6d2360ee6423520ee 100644 |
| --- a/remoting/signaling/delegating_signal_strategy.h |
| +++ b/remoting/signaling/delegating_signal_strategy.h |
| @@ -21,25 +21,25 @@ namespace remoting { |
| // |
| // Notes on thread safety: |
| // 1. This object can be created on any thread. |
| -// 2. OnIncomingMessage() must be called on the same thread on which this object |
| -// is created. |
| -// 3. |send_iq_callback| will always be called on the thread that it is created. |
| +// 2. |send_iq_callback| will always be called on the thread that it is created. |
| // Note that |send_iq_callback| may be called after this object is destroyed. |
| -// 4. The caller should invoke all methods on the SignalStrategy interface on |
| +// 3. The caller should invoke all methods on the SignalStrategy interface on |
| // the |client_task_runner|. |
| -// 5. All listeners will be called on |client_task_runner| as well. |
| -// 6. The destructor should always be called on the |client_task_runner|. |
| +// 4. All listeners will be called on |client_task_runner| as well. |
| +// 5. The destructor should always be called on the |client_task_runner|. |
| +// 6. As a result of (5), use MakeIncomingMessageCallback() to obtain a callback |
| +// when passing incoming signaling messages from the delegate. |
| class DelegatingSignalStrategy : public SignalStrategy { |
| public: |
| - typedef base::Callback<void(const std::string&)> SendIqCallback; |
| + typedef base::Callback<void(const std::string&)> IqCallback; |
|
Sergey Ulanov
2017/03/14 19:20:59
Please use base::RepeatingCallback instead of base
kelvinp
2017/03/15 21:56:46
Done.
|
| DelegatingSignalStrategy( |
| std::string local_jid, |
| scoped_refptr<base::SingleThreadTaskRunner> client_task_runner, |
| - const SendIqCallback& send_iq_callback); |
| + const IqCallback& send_iq_callback); |
| ~DelegatingSignalStrategy() override; |
| - void OnIncomingMessage(const std::string& message); |
| + IqCallback MakeIncomingMessageCallback(); |
|
Sergey Ulanov
2017/03/14 19:20:59
s/Make/Get/
(potentially this function could just
|
| // SignalStrategy interface. |
| void Connect() override; |
| @@ -53,11 +53,18 @@ class DelegatingSignalStrategy : public SignalStrategy { |
| std::string GetNextId() override; |
| private: |
| + static void OnIncomingMessageFromDelegate( |
| + base::WeakPtr<DelegatingSignalStrategy> weak_ptr, |
| + scoped_refptr<base::SingleThreadTaskRunner> client_task_runner, |
| + const std::string& message); |
| + |
| + void OnIncomingMessage(const std::string& message); |
| + |
| std::string local_jid_; |
| scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_; |
| scoped_refptr<base::SingleThreadTaskRunner> client_task_runner_; |
| - SendIqCallback send_iq_callback_; |
| + IqCallback send_iq_callback_; |
| base::ObserverList<Listener> listeners_; |
| base::WeakPtrFactory<DelegatingSignalStrategy> weak_factory_; |