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

Side by Side Diff: android_webview/browser/input_stream.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_
6 #define ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_
7
8 #include "base/basictypes.h"
9
10 namespace net {
11 class IOBuffer;
12 }
13
14 namespace android_webview {
15
16 // Abstract wrapper used to access the InputStream Java class.
17 class InputStream {
18 public:
19 virtual ~InputStream() {}
20
21 // Sets |bytes_available| to the number of bytes that can be read (or skipped
22 // over) from this input stream without blocking by the next caller of a
23 // method for this input stream.
24 // Returns true if completed successfully or false if an exception was
25 // thrown.
26 virtual bool BytesAvailable(int* bytes_available) const = 0;
27
28 // Skips over and discards |n| bytes of data from this input stream. Sets
29 // |bytes_skipped| to the number of of bytes skipped.
30 // Returns true if completed successfully or false if an exception was
31 // thrown.
32 virtual bool Skip(int64_t n, int64_t* bytes_skipped) = 0;
33
34 // Reads |length| bytes into |dest|. Sets |bytes_read| to the total number of
35 // bytes read into |dest| or -1 if there is no more data because the end of
36 // the stream was reached.
37 // |dest| must be at least |length| in size.
38 // Returns true if completed successfully or false if an exception was
39 // thrown.
40 virtual bool Read(net::IOBuffer* dest, int length, int* bytes_read) = 0;
41
42 protected:
43 InputStream() {}
44 };
45
46 } // namespace android_webview
47
48 #endif // ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_
OLDNEW
« no previous file with comments | « android_webview/android_webview_tests.gypi ('k') | android_webview/browser/net/android_stream_reader_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698