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

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

Issue 29347315: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Left Patch Set: patchset 2 + patchset 3 + applied Eyeo's codestyle Created Aug. 8, 2016, 8:09 a.m.
Right Patch Set: made helper methods static, fixed 'remove' for fs callback Created Dec. 13, 2016, 9:32 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 env->CallVoidMethod(GetCallbackObject(), method, *jFromPath, *jToPath); 96 env->CallVoidMethod(GetCallbackObject(), method, *jFromPath, *jToPath);
97 CheckAndLogJavaException(*env); 97 CheckAndLogJavaException(*env);
98 } 98 }
99 99
100 void JniFileSystemCallback::Remove(const std::string& path) 100 void JniFileSystemCallback::Remove(const std::string& path)
101 { 101 {
102 JNIEnvAcquire env(GetJavaVM()); 102 JNIEnvAcquire env(GetJavaVM());
103 103
104 jmethodID method = env->GetMethodID( 104 jmethodID method = env->GetMethodID(
105 *JniLocalReference<jclass>(*env, env->GetObjectClass(GetCallbackObject())), 105 *JniLocalReference<jclass>(*env, env->GetObjectClass(GetCallbackObject())),
106 "move", 106 "remove",
107 "(Ljava/lang/String;Ljava/lang/String;)V"); 107 "(Ljava/lang/String;)V");
108 108
109 JniLocalReference<jstring> jPath(*env, env->NewStringUTF(path.c_str())); 109 JniLocalReference<jstring> jPath(*env, env->NewStringUTF(path.c_str()));
110 110
111 env->CallVoidMethod(GetCallbackObject(), method, *jPath); 111 env->CallVoidMethod(GetCallbackObject(), method, *jPath);
112 CheckAndLogJavaException(*env); 112 CheckAndLogJavaException(*env);
113 } 113 }
114 114
115 AdblockPlus::FileSystem::StatResult JniFileSystemCallback::Stat(const std::strin g& path) const 115 AdblockPlus::FileSystem::StatResult JniFileSystemCallback::Stat(const std::strin g& path) const
116 { 116 {
117 JNIEnvAcquire env(GetJavaVM()); 117 JNIEnvAcquire env(GetJavaVM());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 static JNINativeMethod methods[] = 174 static JNINativeMethod methods[] =
175 { 175 {
176 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, 176 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
177 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } 177 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
178 }; 178 };
179 179
180 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FileSystem _registerNatives(JNIEnv *env, jclass clazz) 180 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FileSystem _registerNatives(JNIEnv *env, jclass clazz)
181 { 181 {
182 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 182 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
183 } 183 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld