Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: sky/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java

Issue 1086233002: Revert "skyshell: disable cache for now" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java
diff --git a/sky/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java b/sky/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java
index ce30d856bad68eee5e211d1519262aab9a3726a1..f8b5b73d58bc021491e501d323e10a894dab85e2 100644
--- a/sky/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java
+++ b/sky/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java
@@ -45,9 +45,19 @@ public class NetworkServiceImpl implements NetworkService {
if (sThreadPool == null)
sThreadPool = Executors.newCachedThreadPool();
- if (sClient == null)
+ if (sClient == null) {
sClient = new OkHttpClient();
+ try {
+ int cacheSize = 10 * 1024 * 1024; // 10 MiB
+ File cacheDirectory = new File(context.getCacheDir(), "ok_http_cache");
+ Cache cache = new Cache(cacheDirectory, cacheSize);
+ sClient.setCache(cache);
+ } catch (IOException e) {
+ Log.e(TAG, "Unable to create HTTP cache", e);
+ }
+ }
+
NetworkService.MANAGER.bind(this, pipe);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698