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

Unified Diff: components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java

Issue 860893002: [Cronet] Allow UrlRequest bypass cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
diff --git a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
index c6e6c2cb4a8151fe21c3245cc569425c62e25437..7817e3d835bad9a6be5456a097226fcb60c092d2 100644
--- a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
+++ b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
@@ -34,6 +34,7 @@ final class CronetUrlRequest implements UrlRequest {
private boolean mStarted = false;
private boolean mCanceled = false;
private boolean mInOnDataReceived = false;
+ private boolean mBypassCache = false;
/*
* Synchronize access to mUrlRequestAdapter, mStarted, mCanceled and
@@ -270,6 +271,9 @@ final class CronetUrlRequest implements UrlRequest {
+ header.first + "=" + header.second);
}
}
+ if (mBypassCache) {
+ nativeBypassCache(mUrlRequestAdapter);
+ }
mStarted = true;
nativeStart(mUrlRequestAdapter);
}
@@ -312,6 +316,12 @@ final class CronetUrlRequest implements UrlRequest {
throw new UnsupportedOperationException("Not implemented yet");
}
+ @Override
+ public void bypassCache() {
+ checkNotStarted();
+ mBypassCache = true;
+ }
+
/**
* Post task to application Executor. Used for Listener callbacks
* and other tasks that should not be executed on network thread.
@@ -610,4 +620,6 @@ final class CronetUrlRequest implements UrlRequest {
private native boolean nativeGetWasCached(long urlRequestAdapter);
private native long nativeGetTotalReceivedBytes(long urlRequestAdapter);
+
+ private native void nativeBypassCache(long urlRequestAdapter);
}

Powered by Google App Engine
This is Rietveld 408576698