forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move java LibraryLoader into cronet.jar. BUG=354143 Review URL: https://codereview.chromium.org/250683002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266357 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
mef@chromium.org
committed
Apr 26, 2014
1 parent
c6d5bfc
commit 81079fc
Showing
6 changed files
with
81 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2014 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. | ||
|
||
#include "base/android/base_jni_registrar.h" | ||
#include "base/android/jni_android.h" | ||
#include "base/android/jni_registrar.h" | ||
#include "base/at_exit.h" | ||
#include "base/i18n/icu_util.h" | ||
#include "components/cronet/android/org_chromium_net_UrlRequest.h" | ||
#include "components/cronet/android/org_chromium_net_UrlRequestContext.h" | ||
#include "net/android/net_jni_registrar.h" | ||
|
||
namespace { | ||
|
||
const base::android::RegistrationMethod kCronetRegisteredMethods[] = { | ||
{"BaseAndroid", base::android::RegisterJni}, | ||
{"NetAndroid", net::android::RegisterJni}, | ||
{"UrlRequest", cronet::UrlRequestRegisterJni}, | ||
{"UrlRequestContext", cronet::UrlRequestContextRegisterJni}, | ||
}; | ||
|
||
base::AtExitManager* g_at_exit_manager = NULL; | ||
|
||
|
||
} // namespace | ||
|
||
// Checks the available version of JNI. Also, caches Java reflection artifacts. | ||
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) { | ||
JNIEnv* env; | ||
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) { | ||
return -1; | ||
} | ||
|
||
base::android::InitVM(vm); | ||
|
||
if (!base::android::RegisterNativeMethods( | ||
env, kCronetRegisteredMethods, arraysize(kCronetRegisteredMethods))) { | ||
return -1; | ||
} | ||
|
||
g_at_exit_manager = new base::AtExitManager(); | ||
|
||
base::i18n::InitializeICU(); | ||
|
||
return JNI_VERSION_1_6; | ||
} | ||
|
||
extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM* jvm, void* reserved) { | ||
if (g_at_exit_manager) { | ||
delete g_at_exit_manager; | ||
g_at_exit_manager = NULL; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
components/cronet/android/org_chromium_net_UrlRequestContext.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014 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 COMPONENTS_CRONET_ANDROID_URLREQUEST_CONTEXT_H_ | ||
#define COMPONENTS_CRONET_ANDROID_URLREQUEST_CONTEXT_H_ | ||
|
||
#include <jni.h> | ||
|
||
namespace cronet { | ||
|
||
bool UrlRequestContextRegisterJni(JNIEnv* env); | ||
|
||
} // namespace cronet | ||
|
||
#endif // COMPONENTS_CRONET_ANDROID_URLREQUEST_CONTEXT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters