OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 this.cacheFolder = cacheFolder; | 56 this.cacheFolder = cacheFolder; |
57 } | 57 } |
58 | 58 |
59 public boolean wasUnitialized() | 59 public boolean wasUnitialized() |
60 { | 60 { |
61 return this.wasUnitialized; | 61 return this.wasUnitialized; |
62 } | 62 } |
63 | 63 |
64 public File createAndWriteFile() throws IOException | 64 public File createAndWriteFile() throws IOException |
65 { | 65 { |
66 // TODO cache cleanups | |
67 for (;;) | 66 for (;;) |
68 { | 67 { |
69 final File file = new File(this.cacheFolder, String.format("tmp-%d.txt", | 68 final File file = new File(this.cacheFolder, String.format("tmp-%d.txt", |
70 (int) (Math.random() * 1e8))); | 69 (int) (Math.random() * 1e8))); |
71 if (!file.exists()) | 70 if (!file.exists()) |
72 { | 71 { |
73 Log.d(TAG, "Writing filters to " + file); | 72 Log.d(TAG, "Writing filters to " + file); |
74 this.writeFile(file); | 73 this.writeFile(file); |
75 return file; | 74 return file; |
76 } | 75 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (sub != null) | 269 if (sub != null) |
271 { | 270 { |
272 if (sub.updateSubscription(responseCode, text, httpHeaders, this.getMetaFi
le(sub), | 271 if (sub.updateSubscription(responseCode, text, httpHeaders, this.getMetaFi
le(sub), |
273 this.getFiltersFile(sub))) | 272 this.getFiltersFile(sub))) |
274 { | 273 { |
275 this.engine.requestUpdateBroadcast(); | 274 this.engine.requestUpdateBroadcast(); |
276 } | 275 } |
277 } | 276 } |
278 } | 277 } |
279 } | 278 } |
OLD | NEW |