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

Side by Side Diff: libadblockplus-android/jni/JniCallbacks.h

Issue 29424615: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: changed impl for reading file as bytes array, modified test. AndroidFileSystem now does not resolve… Created May 29, 2017, 11:26 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 14 matching lines...) Expand all
25 void JniCallbacks_OnLoad(JavaVM* vm, JNIEnv* env, void* reserved); 25 void JniCallbacks_OnLoad(JavaVM* vm, JNIEnv* env, void* reserved);
26 26
27 void JniCallbacks_OnUnload(JavaVM* vm, JNIEnv* env, void* reserved); 27 void JniCallbacks_OnUnload(JavaVM* vm, JNIEnv* env, void* reserved);
28 28
29 class JniCallbackBase 29 class JniCallbackBase
30 { 30 {
31 public: 31 public:
32 JniCallbackBase(JNIEnv* env, jobject callbackObject); 32 JniCallbackBase(JNIEnv* env, jobject callbackObject);
33 virtual ~JniCallbackBase(); 33 virtual ~JniCallbackBase();
34 void LogException(JNIEnv* env, jthrowable throwable) const; 34 void LogException(JNIEnv* env, jthrowable throwable) const;
35 void CheckAndLogJavaException(JNIEnv* env) const; 35 bool CheckAndLogJavaException(JNIEnv* env) const;
36 36
37 JavaVM* GetJavaVM() const 37 JavaVM* GetJavaVM() const
38 { 38 {
39 return javaVM; 39 return javaVM;
40 } 40 }
41 41
42 jobject GetCallbackObject() const 42 jobject GetCallbackObject() const
43 { 43 {
44 return callbackObject->Get(); 44 return callbackObject->Get();
45 } 45 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void Callback(const std::string& arg, const AdblockPlus::JsValuePtr jsValue); 77 void Callback(const std::string& arg, const AdblockPlus::JsValuePtr jsValue);
78 }; 78 };
79 79
80 class JniLogSystemCallback : public JniCallbackBase, public AdblockPlus::LogSyst em 80 class JniLogSystemCallback : public JniCallbackBase, public AdblockPlus::LogSyst em
81 { 81 {
82 public: 82 public:
83 JniLogSystemCallback(JNIEnv* env, jobject callbackObject); 83 JniLogSystemCallback(JNIEnv* env, jobject callbackObject);
84 void operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string& message, const std::string& source); 84 void operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string& message, const std::string& source);
85 }; 85 };
86 86
87 class JniFileSystemCallback : public JniCallbackBase, public AdblockPlus::FileSy stem
sergei 2017/08/07 12:49:59 FileSystem interface is removed in the recent liba
88 {
89 public:
90 JniFileSystemCallback(JNIEnv* env, jobject callbackObject);
91 std::shared_ptr<std::istream> Read(const std::string& path) const;
92 void Write(const std::string& path, std::shared_ptr<std::istream> data);
93 void Move(const std::string& fromPath, const std::string& toPath);
94 void Remove(const std::string& path);
95 AdblockPlus::FileSystem::StatResult Stat(const std::string& path) const;
96 std::string Resolve(const std::string& path) const;
97 };
98
87 class JniShowNotificationCallback : public JniCallbackBase 99 class JniShowNotificationCallback : public JniCallbackBase
88 { 100 {
89 public: 101 public:
90 JniShowNotificationCallback(JNIEnv* env, jobject callbackObject); 102 JniShowNotificationCallback(JNIEnv* env, jobject callbackObject);
91 void Callback(const AdblockPlus::NotificationPtr&); 103 void Callback(const AdblockPlus::NotificationPtr&);
92 }; 104 };
93 105
94 class JniWebRequest : public JniCallbackBase, public AdblockPlus::WebRequest 106 class JniWebRequest : public JniCallbackBase, public AdblockPlus::WebRequest
95 { 107 {
96 public: 108 public:
97 JniWebRequest(JNIEnv* env, jobject callbackObject); 109 JniWebRequest(JNIEnv* env, jobject callbackObject);
98 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const; 110 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const;
99 111
100 private: 112 private:
101 jobject NewTuple(JNIEnv* env, const std::string& a, const std::string& b) cons t; 113 jobject NewTuple(JNIEnv* env, const std::string& a, const std::string& b) cons t;
102 }; 114 };
103 115
104 class JniIsAllowedConnectionTypeCallback : public JniCallbackBase 116 class JniIsAllowedConnectionTypeCallback : public JniCallbackBase
105 { 117 {
106 public: 118 public:
107 JniIsAllowedConnectionTypeCallback(JNIEnv* env, jobject callbackObject); 119 JniIsAllowedConnectionTypeCallback(JNIEnv* env, jobject callbackObject);
108 bool Callback(const std::string* allowedConnectionType); 120 bool Callback(const std::string* allowedConnectionType);
109 }; 121 };
110 122
111 #endif /* JNICALLBACKS_H */ 123 #endif /* JNICALLBACKS_H */
OLDNEW

Powered by Google App Engine
This is Rietveld