Revert of Removes usage of native base::android::GetApplicationContext() (patchset #6 id:120001 of https://codereview.webrtc.org/2888093004/ )

Reason for revert:
Breaks bot on chromium.webrtc.fyi.

Original issue's description:
> Removes usage of native base::android::GetApplicationContext()
>
> BUG=webrtc:7665
>
> Review-Url: https://codereview.webrtc.org/2888093004
> Cr-Commit-Position: refs/heads/master@{#18195}
> Committed: bc83e2ee69

TBR=magjed@webrtc.org,henrika@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7665

Review-Url: https://codereview.webrtc.org/2894593002
Cr-Commit-Position: refs/heads/master@{#18196}
This commit is contained in:
sakal
2017-05-18 06:44:20 -07:00
committed by Commit bot
parent bc83e2ee69
commit 40d224814a
19 changed files with 54 additions and 219 deletions

View File

@ -118,7 +118,8 @@ class JNIEnvironment {
// JNIEnv* jni = ::base::android::AttachCurrentThread();
// JavaVM* jvm = NULL;
// jni->GetJavaVM(&jvm);
// webrtc::JVM::Initialize(jvm);
// jobject context = ::base::android::GetApplicationContext();
// webrtc::JVM::Initialize(jvm, context);
//
// // Header (.h) file of example class called User.
// std::unique_ptr<JNIEnvironment> env;
@ -144,9 +145,9 @@ class JNIEnvironment {
// JVM::Uninitialize();
class JVM {
public:
// Stores global handles to the Java VM interface.
// Stores global handles to the Java VM interface and the application context.
// Should be called once on a thread that is attached to the JVM.
static void Initialize(JavaVM* jvm);
static void Initialize(JavaVM* jvm, jobject context);
// Clears handles stored in Initialize(). Must be called on same thread as
// Initialize().
static void Uninitialize();
@ -167,9 +168,10 @@ class JVM {
// TODO(henrika): can we make these private?
JavaVM* jvm() const { return jvm_; }
jobject context() const { return context_; }
protected:
JVM(JavaVM* jvm);
JVM(JavaVM* jvm, jobject context);
~JVM();
private:
@ -177,6 +179,7 @@ class JVM {
rtc::ThreadChecker thread_checker_;
JavaVM* const jvm_;
jobject context_;
};
} // namespace webrtc