OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PROFILING_MEMLOG_STREAM_RECEIVER_H_ | 5 #ifndef CHROME_PROFILING_MEMLOG_STREAM_RECEIVER_H_ |
6 #define CHROME_PROFILING_MEMLOG_STREAM_RECEIVER_H_ | 6 #define CHROME_PROFILING_MEMLOG_STREAM_RECEIVER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 | 12 |
13 namespace profiling { | 13 namespace profiling { |
14 | 14 |
15 // A stream receiver is a sink for unparsed bytes. See also LogReceiver. | 15 // A stream receiver is a sink for unparsed bytes. See also LogReceiver. |
16 class MemlogStreamReceiver | 16 class MemlogStreamReceiver |
17 : public base::RefCountedThreadSafe<MemlogStreamReceiver> { | 17 : public base::RefCountedThreadSafe<MemlogStreamReceiver> { |
18 public: | 18 public: |
19 MemlogStreamReceiver() {} | 19 MemlogStreamReceiver() {} |
20 | 20 |
21 // Returns true on success, false on unrecoverable error (in which case no | 21 // Returns true on success, false on unrecoverable error (in which case no |
22 // more blocks will be sent). May take a ref to the block, so the caller | 22 // more blocks will be sent). May take a ref to the block, so the caller |
23 // should not modify it later. | 23 // should not modify it later. |
24 virtual void OnStreamData(std::unique_ptr<char[]> data, size_t sz) = 0; | 24 virtual void OnStreamData(std::unique_ptr<char[]> data, size_t sz) = 0; |
25 | 25 |
26 virtual void OnStreamComplete() = 0; | 26 virtual void OnStreamComplete() = 0; |
27 | 27 |
28 protected: | 28 protected: |
29 friend class base::RefCountedThreadSafe<MemlogStreamReceiver>; | 29 friend class base::RefCountedThreadSafe<MemlogStreamReceiver>; |
30 ~MemlogStreamReceiver() override {} | 30 ~MemlogStreamReceiver() {} |
31 }; | 31 }; |
32 | 32 |
33 } // namespace profiling | 33 } // namespace profiling |
34 | 34 |
35 #endif // CHROME_PROFILING_MEMLOG_STREAM_RECEIVER_H_ | 35 #endif // CHROME_PROFILING_MEMLOG_STREAM_RECEIVER_H_ |
OLD | NEW |