Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: remoting/client/plugin/chromoting_scriptable_object.cc

Issue 7730002: Call SendIq() from plugin asynchronously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/plugin/chromoting_scriptable_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/chromoting_scriptable_object.cc
diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc
index 7970785f1b4f6db7e4ecad1d1b884191099bdea5..28c630397145cd0433c2adfeedb56044397ae988 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -272,6 +272,22 @@ void ChromotingScriptableObject::SetDesktopSize(int width, int height) {
LOG(INFO) << "Update desktop size to: " << width << " x " << height;
}
+void ChromotingScriptableObject::SignalLoginChallenge() {
+ plugin_message_loop_->PostTask(
+ FROM_HERE, task_factory_.NewRunnableMethod(
+ &ChromotingScriptableObject::DoSignalLoginChallenge));
+}
+
+void ChromotingScriptableObject::AttachXmppProxy(PepperXmppProxy* xmpp_proxy) {
+ xmpp_proxy_ = xmpp_proxy;
+}
+
+void ChromotingScriptableObject::SendIq(const std::string& message_xml) {
+ plugin_message_loop_->PostTask(
+ FROM_HERE, task_factory_.NewRunnableMethod(
+ &ChromotingScriptableObject::DoSendIq, message_xml));
+}
+
void ChromotingScriptableObject::AddAttribute(const std::string& name,
Var attribute) {
property_names_[name] = properties_.size();
@@ -296,31 +312,22 @@ void ChromotingScriptableObject::SignalDesktopSizeChange() {
&ChromotingScriptableObject::DoSignalDesktopSizeChange));
}
-void ChromotingScriptableObject::SignalLoginChallenge() {
- plugin_message_loop_->PostTask(
- FROM_HERE, task_factory_.NewRunnableMethod(
- &ChromotingScriptableObject::DoSignalLoginChallenge));
-}
-
void ChromotingScriptableObject::DoSignalConnectionInfoChange() {
Var exception;
VarPrivate cb = GetProperty(Var(kConnectionInfoUpdate), &exception);
- // Var() means call the object directly as a function rather than calling
- // a method in the object.
+ // |this| must not be touched after Call() returns.
cb.Call(Var(), &exception);
if (!exception.is_undefined())
LOG(ERROR) << "Exception when invoking connectionInfoUpdate JS callback.";
}
-
void ChromotingScriptableObject::DoSignalDesktopSizeChange() {
Var exception;
VarPrivate cb = GetProperty(Var(kDesktopSizeUpdate), &exception);
- // Var() means call the object directly as a function rather than calling
- // a method in the object.
+ // |this| must not be touched after Call() returns.
cb.Call(Var(), &exception);
if (!exception.is_undefined()) {
@@ -333,24 +340,18 @@ void ChromotingScriptableObject::DoSignalLoginChallenge() {
Var exception;
VarPrivate cb = GetProperty(Var(kLoginChallenge), &exception);
- // Var() means call the object directly as a function rather than calling
- // a method in the object.
+ // |this| must not be touched after Call() returns.
cb.Call(Var(), &exception);
if (!exception.is_undefined())
LOG(ERROR) << "Exception when invoking loginChallenge JS callback.";
}
-void ChromotingScriptableObject::AttachXmppProxy(PepperXmppProxy* xmpp_proxy) {
- xmpp_proxy_ = xmpp_proxy;
-}
-
-void ChromotingScriptableObject::SendIq(const std::string& message_xml) {
+void ChromotingScriptableObject::DoSendIq(const std::string& message_xml) {
Var exception;
VarPrivate cb = GetProperty(Var(kSendIq), &exception);
- // Var() means call the object directly as a function rather than calling
- // a method in the object.
+ // |this| must not be touched after Call() returns.
cb.Call(Var(), Var(message_xml), &exception);
if (!exception.is_undefined())
« no previous file with comments | « remoting/client/plugin/chromoting_scriptable_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698