Chromium Code Reviews| Index: android_webview/browser/net/android_stream_reader_url_request_job.h |
| diff --git a/android_webview/browser/net/android_stream_reader_url_request_job.h b/android_webview/browser/net/android_stream_reader_url_request_job.h |
| index 70d5d88a67c204e277a6c37588b42dc4dfe5a859..4920a7b143322bfbd57b9e167f132d6649be4a83 100644 |
| --- a/android_webview/browser/net/android_stream_reader_url_request_job.h |
| +++ b/android_webview/browser/net/android_stream_reader_url_request_job.h |
| @@ -7,9 +7,10 @@ |
| #include "base/android/scoped_java_ref.h" |
| #include "base/location.h" |
| +#include "base/memory/ref_counted.h" |
|
boliu
2013/03/06 02:30:18
How did scoped_refptr ever compile without this..?
mkosiba (inactive)
2013/03/06 19:05:27
by being included from something else (most likely
|
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| -#include "base/threading/non_thread_safe.h" |
| +#include "base/threading/thread_checker.h" |
| #include "net/http/http_byte_range.h" |
| #include "net/url_request/url_request_job.h" |
| @@ -37,9 +38,18 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob { |
| */ |
| class Delegate { |
| public: |
| + // This method is called from a worker thread, not from the IO thread. |
| virtual scoped_ptr<android_webview::InputStream> OpenInputStream( |
| JNIEnv* env, |
| - net::URLRequest* request) = 0; |
| + const GURL& url) = 0; |
| + |
| + // This method is called on the Job's thread if the result of calling |
| + // OpenInputStream was null. |
| + // Setting the |restart| parameter to true will cause the request to be |
| + // restarted with a new job. |
| + virtual void OnInputStreamOpenFailed( |
| + net::URLRequest* request, |
| + bool* restart) = 0; |
| virtual bool GetMimeType( |
| JNIEnv* env, |
| @@ -85,8 +95,11 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob { |
| CreateStreamReader(android_webview::InputStream* stream); |
| private: |
| - void StartAsync(); |
| - |
| + struct OpenInputStreamResult; |
| + static scoped_ptr<OpenInputStreamResult> OpenInputStreamOnWorkerThread( |
| + scoped_ptr<Delegate> delegate, |
| + const GURL& url); |
| + void OnInputStreamOpened(scoped_ptr<OpenInputStreamResult> result); |
| void OnReaderSeekCompleted(int content_size); |
| void OnReaderReadCompleted(int bytes_read); |
| @@ -94,6 +107,7 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob { |
| scoped_ptr<Delegate> delegate_; |
| scoped_refptr<InputStreamReaderWrapper> input_stream_reader_wrapper_; |
| base::WeakPtrFactory<AndroidStreamReaderURLRequestJob> weak_factory_; |
| + base::ThreadChecker thread_checker_; |
| DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLRequestJob); |
| }; |