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

Unified Diff: android_webview/native/input_stream_impl.cc

Issue 11748015: [Android WebView] Close InputStreams when we're done with them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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: android_webview/native/input_stream_impl.cc
diff --git a/android_webview/native/input_stream_impl.cc b/android_webview/native/input_stream_impl.cc
index 5838650e43b5a74c2b51d8e2cb099317f206b934..5272ee54c1852bede7ba500fe7a240b2903d300a 100644
--- a/android_webview/native/input_stream_impl.cc
+++ b/android_webview/native/input_stream_impl.cc
@@ -18,6 +18,7 @@ using base::android::AttachCurrentThread;
using base::android::ClearException;
using base::android::JavaRef;
using JNI_InputStream::Java_InputStream_available;
+using JNI_InputStream::Java_InputStream_close;
using JNI_InputStream::Java_InputStream_skip;
using JNI_InputStream::Java_InputStream_readI_AB_I_I;
@@ -45,6 +46,9 @@ InputStreamImpl::InputStreamImpl(const JavaRef<jobject>& stream)
}
InputStreamImpl::~InputStreamImpl() {
+ JNIEnv* env = AttachCurrentThread();
+ Java_InputStream_close(env, jobject_.obj());
+ DCHECK(!ClearException(env));
joth 2013/01/03 19:18:18 the ClearException will be removed in release buil
mkosiba (inactive) 2013/01/04 12:31:11 uh, actually due to the way the JNI methods are au
benm (inactive) 2013/01/04 12:55:11 I see. So right now in the exception case we'll ne
mkosiba (inactive) 2013/01/04 14:41:01 When the bug is fixed we'll have an unsafe version
benm (inactive) 2013/01/04 16:59:40 Gotcha. Follow up in https://codereview.chromium.o
}
bool InputStreamImpl::BytesAvailable(int* bytes_available) const {
« 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