Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: libadblockplus-android/jni/JniPlatform.cpp

Issue 29556582: Issue 5643 - Make v8::Isolate injectable into JsEngine (Closed)
Left Patch Set: reverted not related changes, addressed sergei's comments Created Sept. 26, 2017, 11:15 a.m.
Right Patch Set: Using JniLongToTypePtr for casting Created Sept. 28, 2017, 8:55 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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
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)));
sergei 2017/09/28 08:35:27 Acknowledged. Then could please use JniLongToTypeP
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
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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld