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

Unified Diff: remoting/android/java/src/org/chromium/chromoting/Chromoting.java

Issue 1537183002: Refactor Chromoting JNI code to use jni/Client (Java changes only). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update some comments Created 4 years, 11 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
Index: remoting/android/java/src/org/chromium/chromoting/Chromoting.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
index 800be2e323e043b80d7705411ddc1359ec91d527..4a84472500a7378440ae4c6e7e380cc77d1955ef 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
@@ -36,6 +36,7 @@ import org.chromium.chromoting.accountswitcher.AccountSwitcher;
import org.chromium.chromoting.accountswitcher.AccountSwitcherFactory;
import org.chromium.chromoting.help.HelpContext;
import org.chromium.chromoting.help.HelpSingleton;
+import org.chromium.chromoting.jni.Client;
import org.chromium.chromoting.jni.ConnectionListener;
import org.chromium.chromoting.jni.JniInterface;
@@ -335,8 +336,10 @@ public class Chromoting extends AppCompatActivity implements ConnectionListener,
@Override
public void onDestroy() {
super.onDestroy();
- JniInterface.disconnectFromHost();
mAccountSwitcher.destroy();
+ if (Client.getClient() != null) {
+ Client.getClient().destroy();
Sergey Ulanov 2016/01/30 01:03:23 keep the Client object created in connectToHost()
Lambros 2016/02/03 22:57:43 I'm not sure we should be disconnecting anyway in
+ }
}
/** Called when a child Activity exits and sends a result back to this Activity. */
@@ -430,6 +433,11 @@ public class Chromoting extends AppCompatActivity implements ConnectionListener,
}
private void connectToHost(HostInfo host) {
+ if (Client.getClient() != null) {
+ Client.getClient().destroy();
+ }
+
+ final Client client = new Client();
mProgressIndicator = ProgressDialog.show(
this,
host.name,
@@ -439,11 +447,11 @@ public class Chromoting extends AppCompatActivity implements ConnectionListener,
new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
- JniInterface.disconnectFromHost();
+ client.destroy();
}
});
- SessionConnector connector = new SessionConnector(this, this, mHostListLoader);
- mAuthenticator = new SessionAuthenticator(this, host);
+ SessionConnector connector = new SessionConnector(client, this, this, mHostListLoader);
+ mAuthenticator = new SessionAuthenticator(this, client, host);
connector.connectToHost(mAccount, mToken, host, mAuthenticator);
}

Powered by Google App Engine
This is Rietveld 408576698