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

Unified Diff: android_webview/native/android_stream_reader_url_request_job.h

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
Index: android_webview/native/android_stream_reader_url_request_job.h
diff --git a/android_webview/native/android_stream_reader_url_request_job.h b/android_webview/native/android_stream_reader_url_request_job.h
deleted file mode 100644
index e29acd86e90045dfcb2265d78d2d80fc217e9c53..0000000000000000000000000000000000000000
--- a/android_webview/native/android_stream_reader_url_request_job.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
-#define ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
-
-#include "base/android/scoped_java_ref.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/non_thread_safe.h"
-#include "net/http/http_byte_range.h"
-#include "net/url_request/url_request_job.h"
-
-namespace net {
-class URLRequest;
-}
-
-// A request job that reads data from a Java InputStream.
-class AndroidStreamReaderURLRequestJob : public net::URLRequestJob {
- public:
- /*
- * We use a delegate so that we can share code for this job in slightly
- * different contexts.
- */
- class Delegate {
- public:
- virtual base::android::ScopedJavaLocalRef<jobject> OpenInputStream(
- JNIEnv* env,
- net::URLRequest* request) = 0;
-
- virtual bool GetMimeType(
- JNIEnv* env,
- net::URLRequest* request,
- jobject stream,
- std::string* mime_type) = 0;
-
- virtual bool GetCharset(
- JNIEnv* env,
- net::URLRequest* request,
- jobject stream,
- std::string* charset) = 0;
-
- virtual ~Delegate() {}
- };
-
- AndroidStreamReaderURLRequestJob(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate,
- scoped_ptr<Delegate> delegate);
-
- // URLRequestJob:
- virtual void Start() OVERRIDE;
- virtual bool ReadRawData(net::IOBuffer* buf,
- int buf_size,
- int* bytes_read) OVERRIDE;
- virtual void SetExtraRequestHeaders(
- const net::HttpRequestHeaders& headers) OVERRIDE;
- virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
- virtual bool GetCharset(std::string* charset) OVERRIDE;
-
- protected:
- virtual ~AndroidStreamReaderURLRequestJob();
-
- private:
- // Verify the requested range against the stream size.
- bool VerifyRequestedRange(JNIEnv* env);
-
- // Skip to the first byte of the requested read range.
- bool SkipToRequestedRange(JNIEnv* env);
-
- void StartAsync();
-
- net::HttpByteRange byte_range_;
- scoped_ptr<Delegate> delegate_;
- base::android::ScopedJavaGlobalRef<jobject> stream_;
- base::android::ScopedJavaGlobalRef<jbyteArray> buffer_;
- base::WeakPtrFactory<AndroidStreamReaderURLRequestJob> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLRequestJob);
-};
-
-bool RegisterAndroidStreamReaderUrlRequestJob(JNIEnv* env);
-
-#endif // ANDROID_WEBVIEW_NATIVE_ANDROID_STREAM_READER_URL_REQUEST_JOB_H_
« no previous file with comments | « android_webview/native/android_protocol_handler.cc ('k') | android_webview/native/android_stream_reader_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698