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

Side by Side Diff: src/org/adblockplus/libadblockplus/LogSystem.java

Issue 6606493159784448: New JNI bindings (Closed)
Patch Set: Added missing empty lines after file comments Created April 2, 2014, 8:49 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
(Empty)
1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 package org.adblockplus.libadblockplus;
19
20 import com.github.rjeschke.neetutils.dispose.Disposable;
21 import com.github.rjeschke.neetutils.dispose.Disposer;
22
23 public abstract class LogSystem implements Disposable
24 {
25 private final Disposer disposer;
26 protected final long ptr;
27
28 static
29 {
30 System.loadLibrary("adblockplus-jni");
31 registerNatives();
32 }
33
34 public LogSystem()
35 {
36 this.ptr = ctor(this);
37 this.disposer = new Disposer(this, new DisposeWrapper(this.ptr));
38 }
39
40 public static enum LogLevel
41 {
42 TRACE, LOG, INFO, WARN, ERROR;
43 }
44
45 public abstract void logCallback(LogLevel level, String message, String source );
46
47 @Override
48 public void dispose()
49 {
50 this.disposer.dispose();
51 }
52
53 private final static class DisposeWrapper implements Disposable
54 {
55 private final long ptr;
56
57 public DisposeWrapper(final long ptr)
58 {
59 this.ptr = ptr;
60 }
61
62 @Override
63 public void dispose()
64 {
65 dtor(this.ptr);
66 }
67 }
68
69 private final static native void registerNatives();
70
71 private final static native long ctor(Object callbackObject);
72
73 private final static native void dtor(long ptr);
74 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/libadblockplus/JsValue.java ('k') | src/org/adblockplus/libadblockplus/ServerResponse.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld