OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BUFFERING_FILE_STRE
AM_READER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BUFFERING_FILE_STRE
AM_READER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BUFFERING_FILE_STRE
AM_READER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BUFFERING_FILE_STRE
AM_READER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 BufferingFileStreamReader( | 31 BufferingFileStreamReader( |
32 scoped_ptr<storage::FileStreamReader> file_stream_reader, | 32 scoped_ptr<storage::FileStreamReader> file_stream_reader, |
33 int preloading_buffer_length, | 33 int preloading_buffer_length, |
34 int64 max_bytes_to_read); | 34 int64 max_bytes_to_read); |
35 | 35 |
36 virtual ~BufferingFileStreamReader(); | 36 virtual ~BufferingFileStreamReader(); |
37 | 37 |
38 // storage::FileStreamReader overrides. | 38 // storage::FileStreamReader overrides. |
39 virtual int Read(net::IOBuffer* buf, | 39 virtual int Read(net::IOBuffer* buf, |
40 int buf_len, | 40 int buf_len, |
41 const net::CompletionCallback& callback) OVERRIDE; | 41 const net::CompletionCallback& callback) override; |
42 virtual int64 GetLength( | 42 virtual int64 GetLength( |
43 const net::Int64CompletionCallback& callback) OVERRIDE; | 43 const net::Int64CompletionCallback& callback) override; |
44 | 44 |
45 private: | 45 private: |
46 // Copies data from the preloading buffer and updates the internal iterator. | 46 // Copies data from the preloading buffer and updates the internal iterator. |
47 // Returns number of bytes successfully copied. | 47 // Returns number of bytes successfully copied. |
48 int CopyFromPreloadingBuffer(scoped_refptr<net::IOBuffer> buffer, | 48 int CopyFromPreloadingBuffer(scoped_refptr<net::IOBuffer> buffer, |
49 int buffer_length); | 49 int buffer_length); |
50 | 50 |
51 // Preloads data from the internal stream reader and calls the |callback|. | 51 // Preloads data from the internal stream reader and calls the |callback|. |
52 void Preload(const net::CompletionCallback& callback); | 52 void Preload(const net::CompletionCallback& callback); |
53 | 53 |
(...skipping 15 matching lines...) Expand all Loading... |
69 int preloaded_bytes_; | 69 int preloaded_bytes_; |
70 | 70 |
71 base::WeakPtrFactory<BufferingFileStreamReader> weak_ptr_factory_; | 71 base::WeakPtrFactory<BufferingFileStreamReader> weak_ptr_factory_; |
72 DISALLOW_COPY_AND_ASSIGN(BufferingFileStreamReader); | 72 DISALLOW_COPY_AND_ASSIGN(BufferingFileStreamReader); |
73 }; | 73 }; |
74 | 74 |
75 } // namespace file_system_provider | 75 } // namespace file_system_provider |
76 } // namespace chromeos | 76 } // namespace chromeos |
77 | 77 |
78 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BUFFERING_FILE_S
TREAM_READER_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BUFFERING_FILE_S
TREAM_READER_H_ |
OLD | NEW |