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

Side by Side Diff: src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java

Issue 29355392: Issue 4485 - Clear cache directory (Closed)
Patch Set: Adding null check for listFiles Created Sept. 30, 2016, 3:02 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
« no previous file with comments | « src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-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
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
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 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld