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

Side by Side Diff: jni/Utils.h

Issue 29329928: Issue 3297 - Fix issues introduced by recent libadblockplus changes and update dependencies (Closed)
Patch Set: Created Nov. 10, 2015, 4:32 p.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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef UTILS_H 18 #ifndef UTILS_H
19 #define UTILS_H 19 #define UTILS_H
20 20
21 #include <string> 21 #include <string>
22 #include <algorithm> 22 #include <algorithm>
23 #include <jni.h> 23 #include <jni.h>
24 #include <stdexcept> 24 #include <stdexcept>
25 #include <memory>
25 26
26 #include <AdblockPlus.h> 27 #include <AdblockPlus.h>
27 #include <AdblockPlus/tr1_memory.h>
28 28
29 #define PKG(x) "org/adblockplus/libadblockplus/" x 29 #define PKG(x) "org/adblockplus/libadblockplus/" x
30 #define TYP(x) "L" PKG(x) ";" 30 #define TYP(x) "L" PKG(x) ";"
31 31
32 #define ABP_JNI_VERSION JNI_VERSION_1_6 32 #define ABP_JNI_VERSION JNI_VERSION_1_6
33 33
34 void JniThrowException(JNIEnv* env, const std::string& message); 34 void JniThrowException(JNIEnv* env, const std::string& message);
35 35
36 void JniThrowException(JNIEnv* env, const std::exception& e); 36 void JniThrowException(JNIEnv* env, const std::exception& e);
37 37
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 JniGlobalReference(const JniGlobalReference& other); 115 JniGlobalReference(const JniGlobalReference& other);
116 JniGlobalReference& operator=(const JniGlobalReference& other); 116 JniGlobalReference& operator=(const JniGlobalReference& other);
117 117
118 T Get() 118 T Get()
119 { 119 {
120 return reference; 120 return reference;
121 } 121 }
122 122
123 typedef std::tr1::shared_ptr<JniGlobalReference<T> > Ptr; 123 typedef std::shared_ptr<JniGlobalReference<T> > Ptr;
124 124
125 private: 125 private:
126 T reference; 126 T reference;
127 JavaVM* javaVM; 127 JavaVM* javaVM;
128 }; 128 };
129 129
130 inline void* JniLongToPtr(jlong value) 130 inline void* JniLongToPtr(jlong value)
131 { 131 {
132 return reinterpret_cast<void*>((size_t)value); 132 return reinterpret_cast<void*>((size_t)value);
133 } 133 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 JniThrowException(jEnv, except); \ 197 JniThrowException(jEnv, except); \
198 return retVal; \ 198 return retVal; \
199 } \ 199 } \
200 catch (...) \ 200 catch (...) \
201 { \ 201 { \
202 JniThrowException(jEnv); \ 202 JniThrowException(jEnv); \
203 return retVal; \ 203 return retVal; \
204 } 204 }
205 205
206 #endif 206 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld