Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "base/android/base_jni_onload.h" | 5 #include "base/android/base_jni_onload.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_onload_delegate.h" | 8 #include "base/android/jni_onload_delegate.h" |
| 9 #include "base/android/jni_utils.h" | |
| 9 #include "base/android/library_loader/library_loader_hooks.h" | 10 #include "base/android/library_loader/library_loader_hooks.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 namespace android { | 13 namespace android { |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // The JNIOnLoadDelegate implementation in base. | 17 // The JNIOnLoadDelegate implementation in base. |
| 17 class BaseJNIOnLoadDelegate : public JNIOnLoadDelegate { | 18 class BaseJNIOnLoadDelegate : public JNIOnLoadDelegate { |
| 18 public: | 19 public: |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 41 bool ret = true; | 42 bool ret = true; |
| 42 for (std::vector<JNIOnLoadDelegate*>::reverse_iterator i = | 43 for (std::vector<JNIOnLoadDelegate*>::reverse_iterator i = |
| 43 delegates->rbegin(); i != delegates->rend(); ++i) { | 44 delegates->rbegin(); i != delegates->rend(); ++i) { |
| 44 if (!(*i)->RegisterJNI(env)) { | 45 if (!(*i)->RegisterJNI(env)) { |
| 45 ret = false; | 46 ret = false; |
| 46 break; | 47 break; |
| 47 } | 48 } |
| 48 } | 49 } |
| 49 | 50 |
| 50 if (ret) { | 51 if (ret) { |
| 52 base::android::InitReplacementClassLoader(env, | |
| 53 base::android::GetClassLoader(env)); | |
|
michaelbai
2015/02/13 04:36:07
Move this to BaseJNIOnLoadDelegate::Init()
Torne
2015/02/13 14:08:04
Hm. The JNI environment isn't passed to the init f
| |
| 54 | |
| 51 for (std::vector<JNIOnLoadDelegate*>::reverse_iterator i = | 55 for (std::vector<JNIOnLoadDelegate*>::reverse_iterator i = |
| 52 delegates->rbegin(); i != delegates->rend(); ++i) { | 56 delegates->rbegin(); i != delegates->rend(); ++i) { |
| 53 if (!(*i)->Init()) { | 57 if (!(*i)->Init()) { |
| 54 ret = false; | 58 ret = false; |
| 55 break; | 59 break; |
| 56 } | 60 } |
| 57 } | 61 } |
| 58 } | 62 } |
| 59 delegates->pop_back(); | 63 delegates->pop_back(); |
| 60 return ret; | 64 return ret; |
| 61 } | 65 } |
| 62 | 66 |
| 63 } // namespace android | 67 } // namespace android |
| 64 } // namespace base | 68 } // namespace base |
| OLD | NEW |