| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_ |
| 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_ | 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "remoting/jingle_glue/xmpp_proxy.h" | 10 #include "remoting/jingle_glue/xmpp_proxy.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // Registered the callback class with this object. | 27 // Registered the callback class with this object. |
| 28 // | 28 // |
| 29 // - This method has subtle thread semantics! - | 29 // - This method has subtle thread semantics! - |
| 30 // | 30 // |
| 31 // It must be called on the callback thread itself. The weak pointer also | 31 // It must be called on the callback thread itself. The weak pointer also |
| 32 // must be constructed on the callback thread. That means, you cannot just | 32 // must be constructed on the callback thread. That means, you cannot just |
| 33 // create a WeakPtr on, say the pepper thread, and then pass execution of | 33 // create a WeakPtr on, say the pepper thread, and then pass execution of |
| 34 // this function callback with the weak pointer bound as a parameter. That | 34 // this function callback with the weak pointer bound as a parameter. That |
| 35 // will fail because the WeakPtr will have been created on the wrong thread. | 35 // will fail because the WeakPtr will have been created on the wrong thread. |
| 36 virtual void AttachCallback(base::WeakPtr<ResponseCallback> callback); | 36 virtual void AttachCallback( |
| 37 virtual void DetachCallback(); | 37 base::WeakPtr<ResponseCallback> callback) OVERRIDE; |
| 38 virtual void DetachCallback() OVERRIDE; |
| 38 | 39 |
| 39 virtual void SendIq(const std::string& request_xml); | 40 virtual void SendIq(const std::string& request_xml) OVERRIDE; |
| 40 virtual void OnIq(const std::string& response_xml); | 41 virtual void OnIq(const std::string& response_xml); |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 virtual ~PepperXmppProxy(); | 44 virtual ~PepperXmppProxy(); |
| 44 | 45 |
| 45 base::WeakPtr<ChromotingScriptableObject> scriptable_object_; | 46 base::WeakPtr<ChromotingScriptableObject> scriptable_object_; |
| 46 | 47 |
| 47 scoped_refptr<base::MessageLoopProxy> plugin_message_loop_; | 48 scoped_refptr<base::MessageLoopProxy> plugin_message_loop_; |
| 48 scoped_refptr<base::MessageLoopProxy> callback_message_loop_; | 49 scoped_refptr<base::MessageLoopProxy> callback_message_loop_; |
| 49 | 50 |
| 50 // Must only be access on callback_message_loop_. | 51 // Must only be access on callback_message_loop_. |
| 51 base::WeakPtr<ResponseCallback> callback_; | 52 base::WeakPtr<ResponseCallback> callback_; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(PepperXmppProxy); | 54 DISALLOW_COPY_AND_ASSIGN(PepperXmppProxy); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 } // namespace remoting | 57 } // namespace remoting |
| 57 | 58 |
| 58 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_ | 59 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_XMPP_PROXY_H_ |
| OLD | NEW |