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

Unified Diff: libadblockplus-android/jni/JniPlatform.cpp

Issue 29600561: Issue 6001 - Pass IV8IsolateProvider to Helper (Closed)
Patch Set: Created Nov. 7, 2017, 7:42 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android/jni/JniPlatform.cpp
diff --git a/libadblockplus-android/jni/JniPlatform.cpp b/libadblockplus-android/jni/JniPlatform.cpp
index ccf96a029256040585cc831964e30ddf4ef76a04..11a3a4848a68b78b995f8734007646cc08e92d8a 100644
--- a/libadblockplus-android/jni/JniPlatform.cpp
+++ b/libadblockplus-android/jni/JniPlatform.cpp
@@ -20,29 +20,6 @@
#include "JniCallbacks.h"
#include "JniPlatform.h"
-/**
- * V8IsolateHolder accepts v8:::Isolate ptr in ctor and just returns it in Get().
- * V8IsolateHolder is not taking ownership so it's not releasing isolate ptr.
- */
-class V8IsolateHolder : public AdblockPlus::IV8IsolateProvider
-{
- public:
- V8IsolateHolder(v8::Isolate* isolate_) : isolate(isolate_)
- {
- }
-
- v8::Isolate* Get() override
- {
- return isolate;
- }
-
- private:
- V8IsolateHolder(const V8IsolateHolder&);
- V8IsolateHolder& operator=(const V8IsolateHolder&);
-
- v8::Isolate* isolate;
-};
-
static void TransformAppInfo(JNIEnv* env, jobject jAppInfo, AdblockPlus::AppInfo& appInfo)
{
jclass clazz = env->GetObjectClass(jAppInfo);
@@ -92,16 +69,17 @@ static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
delete JniLongToTypePtr<JniPlatform>(ptr);
}
-static void JNICALL JniSetUpJsEngine(JNIEnv* env, jclass clazz, jlong ptr, jobject jAppInfo, jlong v8IsolatePtr)
+static void JNICALL JniSetUpJsEngine(JNIEnv* env, jclass clazz,
+ jlong ptr, jobject jAppInfo, jlong v8IsolateProviderPtr)
{
try
{
AdblockPlus::AppInfo appInfo;
TransformAppInfo(env, jAppInfo, appInfo);
std::unique_ptr<AdblockPlus::IV8IsolateProvider> isolateProvider;
- if (v8IsolatePtr)
+ if (v8IsolateProviderPtr)
{
- isolateProvider.reset(new V8IsolateHolder(JniLongToTypePtr<v8::Isolate>(v8IsolatePtr)));
+ isolateProvider.reset(JniLongToTypePtr<AdblockPlus::IV8IsolateProvider>(v8IsolateProviderPtr));
}
GetPlatformRef(ptr).SetUpJsEngine(appInfo, std::move(isolateProvider));

Powered by Google App Engine
This is Rietveld