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

Unified Diff: remoting/client/jni/chromoting_jni.h

Issue 19967007: Various improvements to the Chromoting Android app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments to clarify ChromotingJniRuntime pointer lifetimes Created 7 years, 5 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/android/java/AndroidManifest.xml ('k') | remoting/client/jni/chromoting_jni.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/chromoting_jni.h
diff --git a/remoting/client/jni/chromoting_jni.h b/remoting/client/jni/chromoting_jni.h
deleted file mode 100644
index 197cf396b5be0e340a9cb3e4852d2b043db69ea6..0000000000000000000000000000000000000000
--- a/remoting/client/jni/chromoting_jni.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef REMOTING_CLIENT_JNI_CHROMOTING_JNI_H_
-#define REMOTING_CLIENT_JNI_CHROMOTING_JNI_H_
-
-#include <jni.h>
-
-#include "base/at_exit.h"
-#include "net/url_request/url_request_context_getter.h"
-#include "remoting/base/auto_thread.h"
-#include "remoting/client/jni/chromoting_jni_instance.h"
-#include "remoting/protocol/connection_to_host.h"
-
-template<typename T> struct DefaultSingletonTraits;
-
-namespace remoting {
-
-// Houses the global resources on which the Chromoting components run
-// (e.g. message loops and task runners). Proxies outgoing JNI calls from its
-// ChromotingJniInstance member to Java. All its methods should be invoked
-// exclusively from the UI thread unless otherwise noted.
-class ChromotingJni {
- public:
- // This class is instantiated at process initialization and persists until
- // we close. Its components are reused across |ChromotingJniInstance|s.
- static ChromotingJni* GetInstance();
-
- scoped_refptr<AutoThreadTaskRunner> ui_task_runner() {
- return ui_task_runner_;
- }
-
- scoped_refptr<AutoThreadTaskRunner> network_task_runner() {
- return network_task_runner_;
- }
-
- scoped_refptr<AutoThreadTaskRunner> display_task_runner() {
- return display_task_runner_;
- }
-
- scoped_refptr<net::URLRequestContextGetter> url_requester() {
- return url_requester_;
- }
-
- // Initiates a connection with the specified host. Only call when a host
- // connection is active (i.e. between a call to Connect() and the
- // corresponding call to Disconnect()).
- void ConnectToHost(const char* username,
- const char* auth_token,
- const char* host_jid,
- const char* host_id,
- const char* host_pubkey);
-
- // Terminates any ongoing connection attempt and cleans up by nullifying
- // |session_|. This is a no-op unless |session| is currently non-null.
- void DisconnectFromHost();
-
- // Returns the client for the currently-active session. Do not call if
- // |session| is null.
- scoped_refptr<ChromotingJniInstance> session() {
- DCHECK(session_);
- return session_;
- }
-
- // Notifies the user that the connection status has changed.
- void ReportConnectionStatus(protocol::ConnectionToHost::State state,
- protocol::ErrorCode error);
-
- // Pops up a dialog box asking the user to enter a PIN.
- void DisplayAuthenticationPrompt();
-
- // Updates image dimensions and canvas memory space. Call on display thread.
- void UpdateImageBuffer(int width, int height, jobject buffer);
-
- // Draws the latest image buffer onto the canvas. Call on the display thread.
- void RedrawCanvas();
-
- private:
- ChromotingJni();
-
- // Forces a DisconnectFromHost() in case there is any active or failed
- // connection, then proceeds to tear down the Chromium dependencies on which
- // all sessions depended. Because destruction only occurs at application exit
- // after all connections have terminated, it is safe to make unretained
- // cross-thread calls on the class.
- virtual ~ChromotingJni();
-
- // Reference to the Java class into which we make JNI calls.
- jclass class_;
-
- // Used by the Chromium libraries to clean up the base and net libraries' JNI
- // bindings. It must persist for the lifetime of the singleton.
- scoped_ptr<base::AtExitManager> at_exit_manager_;
-
- // Chromium code's connection to the Java message loop.
- scoped_ptr<base::MessageLoopForUI> ui_loop_;
-
- // References to native threads.
- scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
- scoped_refptr<AutoThreadTaskRunner> network_task_runner_;
- scoped_refptr<AutoThreadTaskRunner> display_task_runner_;
-
- scoped_refptr<net::URLRequestContextGetter> url_requester_;
-
- // Contains all connection-specific state.
- scoped_refptr<ChromotingJniInstance> session_;
-
- friend struct DefaultSingletonTraits<ChromotingJni>;
-
- DISALLOW_COPY_AND_ASSIGN(ChromotingJni);
-};
-
-} // namespace remoting
-
-#endif
« no previous file with comments | « remoting/android/java/AndroidManifest.xml ('k') | remoting/client/jni/chromoting_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698