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

Unified Diff: android_webview/native/intercepted_request_data_impl.cc

Issue 11363123: [android_webview] Don't block the IO thread when reading from an InputStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « android_webview/native/intercepted_request_data_impl.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/intercepted_request_data_impl.cc
diff --git a/android_webview/native/intercepted_request_data_impl.cc b/android_webview/native/intercepted_request_data_impl.cc
index e3d90967bcd798fa69b9165a0bce2379865a6fe3..894eb7c70886688ed2b30387d5375d6cff56f8b4 100644
--- a/android_webview/native/intercepted_request_data_impl.cc
+++ b/android_webview/native/intercepted_request_data_impl.cc
@@ -4,7 +4,8 @@
#include "android_webview/native/intercepted_request_data_impl.h"
-#include "android_webview/native/android_stream_reader_url_request_job.h"
+#include "android_webview/browser/net/android_stream_reader_url_request_job.h"
+#include "android_webview/native/input_stream_impl.h"
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "jni/InterceptedRequestData_jni.h"
@@ -26,22 +27,22 @@ class StreamReaderJobDelegateImpl :
DCHECK(intercepted_request_data_impl_);
}
- virtual base::android::ScopedJavaLocalRef<jobject> OpenInputStream(
+ virtual scoped_ptr<InputStream> OpenInputStream(
JNIEnv* env,
net::URLRequest* request) OVERRIDE {
- return intercepted_request_data_impl_->GetInputStream(env);
+ return intercepted_request_data_impl_->GetInputStream(env).Pass();
}
virtual bool GetMimeType(JNIEnv* env,
net::URLRequest* request,
- jobject stream,
+ const android_webview::InputStream& stream,
std::string* mime_type) OVERRIDE {
return intercepted_request_data_impl_->GetMimeType(env, mime_type);
}
virtual bool GetCharset(JNIEnv* env,
net::URLRequest* request,
- jobject stream,
+ const android_webview::InputStream& stream,
std::string* charset) OVERRIDE {
return intercepted_request_data_impl_->GetCharset(env, charset);
}
@@ -60,9 +61,13 @@ InterceptedRequestDataImpl::InterceptedRequestDataImpl(
InterceptedRequestDataImpl::~InterceptedRequestDataImpl() {
}
-ScopedJavaLocalRef<jobject>
+scoped_ptr<InputStream>
InterceptedRequestDataImpl::GetInputStream(JNIEnv* env) const {
- return Java_InterceptedRequestData_getData(env, java_object_.obj());
+ ScopedJavaLocalRef<jobject> jstream =
+ Java_InterceptedRequestData_getData(env, java_object_.obj());
+ if (jstream.is_null())
+ return scoped_ptr<InputStream>();
+ return make_scoped_ptr<InputStream>(new InputStreamImpl(jstream));
}
bool InterceptedRequestDataImpl::GetMimeType(JNIEnv* env,
« no previous file with comments | « android_webview/native/intercepted_request_data_impl.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698