| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 class IOBuffer; | 11 class IOBuffer; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace android_webview { | 14 namespace android_webview { |
| 15 | 15 |
| 16 // Abstract wrapper used to access the InputStream Java class. | 16 // Abstract wrapper used to access the InputStream Java class. |
| 17 // This class is safe to pass around between threads (the destructor, |
| 18 // constructor and methods can be called on different threads) but calling |
| 19 // methods concurrently might have undefined results. |
| 17 class InputStream { | 20 class InputStream { |
| 18 public: | 21 public: |
| 19 virtual ~InputStream() {} | 22 virtual ~InputStream() {} |
| 20 | 23 |
| 21 // Sets |bytes_available| to the number of bytes that can be read (or skipped | 24 // 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 | 25 // over) from this input stream without blocking by the next caller of a |
| 23 // method for this input stream. | 26 // method for this input stream. |
| 24 // Returns true if completed successfully or false if an exception was | 27 // Returns true if completed successfully or false if an exception was |
| 25 // thrown. | 28 // thrown. |
| 26 virtual bool BytesAvailable(int* bytes_available) const = 0; | 29 virtual bool BytesAvailable(int* bytes_available) const = 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 // thrown. | 42 // thrown. |
| 40 virtual bool Read(net::IOBuffer* dest, int length, int* bytes_read) = 0; | 43 virtual bool Read(net::IOBuffer* dest, int length, int* bytes_read) = 0; |
| 41 | 44 |
| 42 protected: | 45 protected: |
| 43 InputStream() {} | 46 InputStream() {} |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 } // namespace android_webview | 49 } // namespace android_webview |
| 47 | 50 |
| 48 #endif // ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_ | 51 #endif // ANDROID_WEBVIEW_BROWSER_INPUT_STREAM_H_ |
| OLD | NEW |