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

Side by Side Diff: remoting/client/jni/jni_client.h

Issue 2338473002: [Remoting Android] JniGlDisplayHandler calls invalidate() on UI thread (Closed)
Patch Set: Reviewer's Feedback Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « remoting/client/jni/display_updater_factory.h ('k') | remoting/client/jni/jni_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_JNI_JNI_CLIENT_H_ 5 #ifndef REMOTING_CLIENT_JNI_JNI_CLIENT_H_
6 #define REMOTING_CLIENT_JNI_JNI_CLIENT_H_ 6 #define REMOTING_CLIENT_JNI_JNI_CLIENT_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "remoting/protocol/connection_to_host.h" 13 #include "remoting/protocol/connection_to_host.h"
14 #include "remoting/protocol/cursor_shape_stub.h" 14 #include "remoting/protocol/cursor_shape_stub.h"
15 15
16 namespace remoting { 16 namespace remoting {
17 17
18 class ChromotingJniRuntime; 18 class ChromotingJniRuntime;
19 class ChromotingJniInstance; 19 class ChromotingJniInstance;
20 class DisplayUpdaterFactory; 20 class JniGlDisplayHandler;
21 class JniPairingSecretFetcher; 21 class JniPairingSecretFetcher;
22 22
23 // Houses resources scoped to a session and exposes JNI interface to the 23 // Houses resources scoped to a session and exposes JNI interface to the
24 // Java client during a session. All its methods should be invoked exclusively 24 // Java client during a session. All its methods should be invoked exclusively
25 // from the UI thread unless otherwise noted. 25 // from the UI thread unless otherwise noted.
26 class JniClient { 26 class JniClient {
27 public: 27 public:
28 JniClient(ChromotingJniRuntime* runtime, 28 JniClient(ChromotingJniRuntime* runtime,
29 base::android::ScopedJavaGlobalRef<jobject> java_client); 29 base::android::ScopedJavaGlobalRef<jobject> java_client);
30 virtual ~JniClient(); 30 virtual ~JniClient();
31 31
32 // Initiates a connection with the specified host. To skip the attempt at 32 // Initiates a connection with the specified host. To skip the attempt at
33 // pair-based authentication, leave |pairing_id| and |pairing_secret| as 33 // pair-based authentication, leave |pairing_id| and |pairing_secret| as
34 // empty strings. 34 // empty strings.
35 void ConnectToHost(DisplayUpdaterFactory* updater_factory, 35 void ConnectToHost(const std::string& username,
36 const std::string& username,
37 const std::string& auth_token, 36 const std::string& auth_token,
38 const std::string& host_jid, 37 const std::string& host_jid,
39 const std::string& host_id, 38 const std::string& host_id,
40 const std::string& host_pubkey, 39 const std::string& host_pubkey,
41 const std::string& pairing_id, 40 const std::string& pairing_id,
42 const std::string& pairing_secret, 41 const std::string& pairing_secret,
43 const std::string& capabilities, 42 const std::string& capabilities,
44 const std::string& flags); 43 const std::string& flags);
45 44
46 // Terminates any ongoing connection attempt and cleans up by nullifying 45 // Terminates any ongoing connection attempt and cleans up by nullifying
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // TODO(yuweih): Instead of exposing a weak pointer in the public API, 149 // TODO(yuweih): Instead of exposing a weak pointer in the public API,
151 // consider handling task posting inside the client. 150 // consider handling task posting inside the client.
152 base::WeakPtr<JniClient> GetWeakPtr(); 151 base::WeakPtr<JniClient> GetWeakPtr();
153 152
154 private: 153 private:
155 ChromotingJniRuntime* runtime_; 154 ChromotingJniRuntime* runtime_;
156 155
157 // Reference to the Java client object. 156 // Reference to the Java client object.
158 base::android::ScopedJavaGlobalRef<jobject> java_client_; 157 base::android::ScopedJavaGlobalRef<jobject> java_client_;
159 158
160 std::unique_ptr<DisplayUpdaterFactory> display_handler_; 159 std::unique_ptr<JniGlDisplayHandler> display_handler_;
161 160
162 // Deleted on UI thread. 161 // Deleted on UI thread.
163 std::unique_ptr<JniPairingSecretFetcher> secret_fetcher_; 162 std::unique_ptr<JniPairingSecretFetcher> secret_fetcher_;
164 163
165 // Deleted on Network thread. 164 // Deleted on Network thread.
166 std::unique_ptr<ChromotingJniInstance> session_; 165 std::unique_ptr<ChromotingJniInstance> session_;
167 166
168 // Holds pointer for the UI thread. 167 // Holds pointer for the UI thread.
169 base::WeakPtr<JniClient> weak_ptr_; 168 base::WeakPtr<JniClient> weak_ptr_;
170 base::WeakPtrFactory<JniClient> weak_factory_; 169 base::WeakPtrFactory<JniClient> weak_factory_;
171 170
172 DISALLOW_COPY_AND_ASSIGN(JniClient); 171 DISALLOW_COPY_AND_ASSIGN(JniClient);
173 }; 172 };
174 173
175 } // namespace remoting 174 } // namespace remoting
176 175
177 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_ 176 #endif // REMOTING_CLIENT_JNI_JNI_CLIENT_H_
OLDNEW
« no previous file with comments | « remoting/client/jni/display_updater_factory.h ('k') | remoting/client/jni/jni_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698