| 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 ProcessMemoryDump; |
| 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 // Dumps memory allocation stats. |parent_dump_absolute_name| is the name |
| 64 // used by the parent MemoryAllocatorDump in the memory dump hierarchy. |
| 65 // Default implementation does nothing. |
| 66 virtual void DumpMemoryStats( |
| 67 base::trace_event::ProcessMemoryDump* dump, |
| 68 const std::string& parent_dump_absolute_name) const {} |
| 69 |
| 57 SourceType type() const { return type_; } | 70 SourceType type() const { return type_; } |
| 58 | 71 |
| 59 private: | 72 private: |
| 60 SourceType type_; | 73 SourceType type_; |
| 61 | 74 |
| 62 DISALLOW_COPY_AND_ASSIGN(SourceStream); | 75 DISALLOW_COPY_AND_ASSIGN(SourceStream); |
| 63 }; | 76 }; |
| 64 | 77 |
| 65 } // namespace net | 78 } // namespace net |
| 66 | 79 |
| 67 #endif // NET_FILTER_SOURCE_STREAM_H_ | 80 #endif // NET_FILTER_SOURCE_STREAM_H_ |
| OLD | NEW |