| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_FILTER_SOURCE_STREAM_H_ | 5 #ifndef NET_FILTER_SOURCE_STREAM_H_ |
| 6 #define NET_FILTER_SOURCE_STREAM_H_ | 6 #define NET_FILTER_SOURCE_STREAM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 16 | 16 |
| 17 namespace base { |
| 18 namespace trace_event { |
| 19 class MemoryAllocatorDump; |
| 20 } |
| 21 } |
| 22 |
| 17 namespace net { | 23 namespace net { |
| 18 | 24 |
| 19 class IOBuffer; | 25 class IOBuffer; |
| 20 | 26 |
| 21 // The SourceStream class implements a producer of bytes. | 27 // The SourceStream class implements a producer of bytes. |
| 22 class NET_EXPORT_PRIVATE SourceStream { | 28 class NET_EXPORT_PRIVATE SourceStream { |
| 23 public: | 29 public: |
| 24 enum SourceType { | 30 enum SourceType { |
| 25 #define SOURCE_STREAM_TYPE(label) TYPE_##label, | 31 #define SOURCE_STREAM_TYPE(label) TYPE_##label, |
| 26 #include "net/filter/source_stream_type_list.h" | 32 #include "net/filter/source_stream_type_list.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 // This method takes a reference to |*dest_buffer| if it completes | 53 // This method takes a reference to |*dest_buffer| if it completes |
| 48 // asynchronously to ensure it does not get freed mid-read. | 54 // asynchronously to ensure it does not get freed mid-read. |
| 49 virtual int Read(IOBuffer* dest_buffer, | 55 virtual int Read(IOBuffer* dest_buffer, |
| 50 int buffer_size, | 56 int buffer_size, |
| 51 const CompletionCallback& callback) = 0; | 57 const CompletionCallback& callback) = 0; |
| 52 | 58 |
| 53 // Returns a string that represents stream. This is for UMA and NetLog | 59 // Returns a string that represents stream. This is for UMA and NetLog |
| 54 // logging. | 60 // logging. |
| 55 virtual std::string Description() const = 0; | 61 virtual std::string Description() const = 0; |
| 56 | 62 |
| 63 // Called by URLRequestJob to dump memory allocation stats. |dump| is the |
| 64 // memory allocator dump of the URLRequestJob. Default implementation does |
| 65 // nothing. |
| 66 virtual void DumpMemoryStats( |
| 67 base::trace_event::MemoryAllocatorDump* dump) const {} |
| 68 |
| 57 SourceType type() const { return type_; } | 69 SourceType type() const { return type_; } |
| 58 | 70 |
| 59 private: | 71 private: |
| 60 SourceType type_; | 72 SourceType type_; |
| 61 | 73 |
| 62 DISALLOW_COPY_AND_ASSIGN(SourceStream); | 74 DISALLOW_COPY_AND_ASSIGN(SourceStream); |
| 63 }; | 75 }; |
| 64 | 76 |
| 65 } // namespace net | 77 } // namespace net |
| 66 | 78 |
| 67 #endif // NET_FILTER_SOURCE_STREAM_H_ | 79 #endif // NET_FILTER_SOURCE_STREAM_H_ |
| OLD | NEW |