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 COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_ | 5 #ifndef COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_ |
6 #define COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_ | 6 #define COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... |
21 class FakeScatteredBuffer : public ScatteredStreamWriter::Delegate { | 21 class FakeScatteredBuffer : public ScatteredStreamWriter::Delegate { |
22 public: | 22 public: |
23 explicit FakeScatteredBuffer(size_t chunk_size); | 23 explicit FakeScatteredBuffer(size_t chunk_size); |
24 ~FakeScatteredBuffer() override; | 24 ~FakeScatteredBuffer() override; |
25 | 25 |
26 // ScatteredStreamWriter::Delegate implementation. | 26 // ScatteredStreamWriter::Delegate implementation. |
27 ContiguousMemoryRange GetNewBuffer() override; | 27 ContiguousMemoryRange GetNewBuffer() override; |
28 | 28 |
29 std::string GetChunkAsString(int chunk_index); | 29 std::string GetChunkAsString(int chunk_index); |
30 | 30 |
| 31 void GetBytes(size_t start, size_t length, uint8_t* buf); |
31 std::string GetBytesAsString(size_t start, size_t length); | 32 std::string GetBytesAsString(size_t start, size_t length); |
32 | 33 |
33 const std::vector<std::unique_ptr<uint8_t[]>>& chunks() const { | 34 const std::vector<std::unique_ptr<uint8_t[]>>& chunks() const { |
34 return chunks_; | 35 return chunks_; |
35 } | 36 } |
36 | 37 |
37 private: | 38 private: |
38 const size_t chunk_size_; | 39 const size_t chunk_size_; |
39 std::vector<std::unique_ptr<uint8_t[]>> chunks_; | 40 std::vector<std::unique_ptr<uint8_t[]>> chunks_; |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(FakeScatteredBuffer); | 42 DISALLOW_COPY_AND_ASSIGN(FakeScatteredBuffer); |
42 }; | 43 }; |
43 | 44 |
44 } // namespace v2 | 45 } // namespace v2 |
45 } // namespace tracing | 46 } // namespace tracing |
46 | 47 |
47 #endif // COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_ | 48 #endif // COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_ |
OLD | NEW |