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 NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ | 5 #ifndef NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ |
6 #define NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ | 6 #define NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "net/base/upload_element_reader.h" | 14 #include "net/base/upload_element_reader.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 class FileStream; | 18 class FileStream; |
19 | 19 |
20 // An UploadElementReader implementation for file. | 20 // An UploadElementReader implementation for file. |
21 class NET_EXPORT_PRIVATE UploadFileElementReader : public UploadElementReader { | 21 class NET_EXPORT UploadFileElementReader : public UploadElementReader { |
22 public: | 22 public: |
23 // Deletes FileStream on the worker pool to avoid blocking the IO thread. | 23 // Deletes FileStream on the worker pool to avoid blocking the IO thread. |
24 // This class is used as a template argument of scoped_ptr_malloc. | 24 // This class is used as a template argument of scoped_ptr_malloc. |
25 class FileStreamDeleter { | 25 class FileStreamDeleter { |
26 public: | 26 public: |
27 void operator() (FileStream* file_stream) const; | 27 void operator() (FileStream* file_stream) const; |
28 }; | 28 }; |
29 | 29 |
30 typedef scoped_ptr_malloc<FileStream, FileStreamDeleter> ScopedFileStreamPtr; | 30 typedef scoped_ptr_malloc<FileStream, FileStreamDeleter> ScopedFileStreamPtr; |
31 | 31 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 uint64 content_length_; | 91 uint64 content_length_; |
92 uint64 bytes_remaining_; | 92 uint64 bytes_remaining_; |
93 base::WeakPtrFactory<UploadFileElementReader> weak_ptr_factory_; | 93 base::WeakPtrFactory<UploadFileElementReader> weak_ptr_factory_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(UploadFileElementReader); | 95 DISALLOW_COPY_AND_ASSIGN(UploadFileElementReader); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace net | 98 } // namespace net |
99 | 99 |
100 #endif // NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ | 100 #endif // NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ |
OLD | NEW |