LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 static void JNICALL JniSetUpJsEngine(JNIEnv* env, jclass clazz, jlong ptr, jobje
ct jAppInfo, jlong v8IsolatePtr) | 95 static void JNICALL JniSetUpJsEngine(JNIEnv* env, jclass clazz, jlong ptr, jobje
ct jAppInfo, jlong v8IsolatePtr) |
96 { | 96 { |
97 try | 97 try |
98 { | 98 { |
99 AdblockPlus::AppInfo appInfo; | 99 AdblockPlus::AppInfo appInfo; |
100 TransformAppInfo(env, jAppInfo, appInfo); | 100 TransformAppInfo(env, jAppInfo, appInfo); |
101 std::unique_ptr<AdblockPlus::IV8IsolateProvider> isolateProvider; | 101 std::unique_ptr<AdblockPlus::IV8IsolateProvider> isolateProvider; |
102 if (v8IsolatePtr) | 102 if (v8IsolatePtr) |
103 { | 103 { |
104 isolateProvider.reset(new V8IsolateHolder(reinterpret_cast<v8::Isolate*>(v
8IsolatePtr))); | 104 isolateProvider.reset(new V8IsolateHolder(JniLongToTypePtr<v8::Isolate>(v8
IsolatePtr))); |
105 } | 105 } |
106 | 106 |
107 GetPlatformRef(ptr).SetUpJsEngine(appInfo, std::move(isolateProvider)); | 107 GetPlatformRef(ptr).SetUpJsEngine(appInfo, std::move(isolateProvider)); |
108 } | 108 } |
109 CATCH_AND_THROW(env) | 109 CATCH_AND_THROW(env) |
110 } | 110 } |
111 | 111 |
112 static long JNICALL JniGetJsEnginePtr(JNIEnv* env, jclass clazz, jlong ptr) | 112 static long JNICALL JniGetJsEnginePtr(JNIEnv* env, jclass clazz, jlong ptr) |
113 { | 113 { |
114 try | 114 try |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 { (char*)"setUpJsEngine", (char*)"(J" TYP("AppInfo") "J)V", (void*)JniSetUpJsE
ngine }, | 163 { (char*)"setUpJsEngine", (char*)"(J" TYP("AppInfo") "J)V", (void*)JniSetUpJsE
ngine }, |
164 { (char*)"getJsEnginePtr", (char*)"(J)J", (void*)JniGetJsEnginePtr }, | 164 { (char*)"getJsEnginePtr", (char*)"(J)J", (void*)JniGetJsEnginePtr }, |
165 { (char*)"setUpFilterEngine", (char*)"(J" TYP("IsAllowedConnectionCallback") "
)V", (void*)JniSetUpFilterEngine }, | 165 { (char*)"setUpFilterEngine", (char*)"(J" TYP("IsAllowedConnectionCallback") "
)V", (void*)JniSetUpFilterEngine }, |
166 { (char*)"ensureFilterEngine", (char*)"(J)V", (void*)JniEnsureFilterEngine } | 166 { (char*)"ensureFilterEngine", (char*)"(J)V", (void*)JniEnsureFilterEngine } |
167 }; | 167 }; |
168 | 168 |
169 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Platform_r
egisterNatives(JNIEnv *env, jclass clazz) | 169 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Platform_r
egisterNatives(JNIEnv *env, jclass clazz) |
170 { | 170 { |
171 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 171 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
172 } | 172 } |
LEFT | RIGHT |