Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 NET_BASE_UPLOAD_DISK_CACHE_ENTRY_ELEMENT_READER_H_ | |
| 6 #define NET_BASE_UPLOAD_DISK_CACHE_ENTRY_ELEMENT_READER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "net/base/upload_element_reader.h" | |
| 12 | |
| 13 namespace disk_cache { | |
| 14 class Entry; | |
| 15 } | |
| 16 | |
| 17 namespace net { | |
| 18 | |
| 19 // An UploadElementReader implementation for disk_cache::Entry objects. | |
| 20 // |entry| should outlive this class because this class does not take the | |
| 21 // ownership of the data. | |
|
mmenke
2015/06/16 18:51:18
Think the second sentence should be more assertive
gavinp
2015/06/16 22:28:01
Done. This text was copied directly from upload_by
| |
| 22 class NET_EXPORT UploadDiskCacheEntryElementReader | |
|
mmenke
2015/06/16 18:51:18
include net_export
gavinp
2015/06/16 22:28:01
Done. Also in the file and bytes upload element he
| |
| 23 : public UploadElementReader { | |
| 24 public: | |
| 25 UploadDiskCacheEntryElementReader(disk_cache::Entry* disk_cache_entry, | |
| 26 int disk_cache_stream_index, | |
| 27 int range_offset, | |
| 28 int range_length); | |
|
mmenke
2015/06/16 18:51:18
These are fine as ints, rather than int64s? Not s
gavinp
2015/06/16 22:28:01
The disk_cache interface uses ints, and so I chose
| |
| 29 ~UploadDiskCacheEntryElementReader() override; | |
| 30 | |
| 31 int range_offset() const { return range_offset_; } | |
| 32 int range_length() const { return range_length_; } | |
|
mmenke
2015/06/16 18:51:19
+_for_testing / _for_tests
gavinp
2015/06/16 22:28:01
Done.
| |
| 33 | |
| 34 // UploadElementReader overrides: | |
| 35 const UploadDiskCacheEntryElementReader* AsDiskCacheEntryReader() | |
|
mmenke
2015/06/16 18:51:18
These methods make me sad. :(
The other UploadEl
gavinp
2015/06/16 22:28:01
Done. I don't think we want to let extensions poke
| |
| 36 const override; | |
| 37 int Init(const CompletionCallback& callback) override; | |
|
mmenke
2015/06/16 18:51:18
I generally feel like you should forward declare a
gavinp
2015/06/16 22:28:01
I'm happy to do this; I was of the impression that
| |
| 38 uint64_t GetContentLength() const override; | |
| 39 uint64_t BytesRemaining() const override; | |
| 40 bool IsInMemory() const override; | |
| 41 int Read(IOBuffer* buf, | |
| 42 int buf_length, | |
| 43 const CompletionCallback& callback) override; | |
| 44 | |
| 45 private: | |
| 46 void OnReadCompleted(const CompletionCallback& callback, int result); | |
| 47 | |
| 48 disk_cache::Entry* const disk_cache_entry_; | |
| 49 const int disk_cache_stream_index_; | |
| 50 | |
| 51 const int range_offset_; | |
| 52 const int range_length_; | |
| 53 | |
| 54 int offset_; | |
|
mmenke
2015/06/16 18:51:18
Should document these. It's not clear, in particu
michaeln
2015/06/16 21:52:54
+1 comments &| massaging the names, wasn't obvsiou
gavinp
2015/06/16 22:28:01
I've done this. I left the inline methods used in
| |
| 55 | |
| 56 base::WeakPtrFactory<UploadDiskCacheEntryElementReader> weak_factory_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(UploadDiskCacheEntryElementReader); | |
| 59 }; | |
| 60 | |
| 61 } // namespace net | |
| 62 | |
| 63 #endif // NET_BASE_UPLOAD_DISK_CACHE_ENTRY_ELEMENT_READER_H_ | |
| OLD | NEW |