Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1367)

Side by Side Diff: components/tracing/test/fake_scattered_buffer.h

Issue 2228593004: Revert of tracing v2: Introduce TraceBufferWriter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proto_refactor
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/tracing/proto/events_chunk.proto ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/tracing/core/scattered_stream_writer.h" 13 #include "components/tracing/core/scattered_stream_writer.h"
14 #include "components/tracing/tracing_export.h" 14 #include "components/tracing/tracing_export.h"
15 15
16 namespace tracing { 16 namespace tracing {
17 namespace v2 { 17 namespace v2 {
18 18
19 // A simple ScatteredStreamWriter::Delegate implementation which just allocates 19 // A simple ScatteredStreamWriter::Delegate implementation which just allocates
20 // chunks of a fixed size. 20 // chunks of a fixed size.
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();
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 std::string GetBytesAsString(size_t start, size_t length); 31 std::string GetBytesAsString(size_t start, size_t length);
32 32
33 const std::vector<std::unique_ptr<uint8_t[]>>& chunks() const { 33 const std::vector<std::unique_ptr<uint8_t[]>>& chunks() const {
34 return chunks_; 34 return chunks_;
35 } 35 }
36 36
37 private: 37 private:
38 const size_t chunk_size_; 38 const size_t chunk_size_;
39 std::vector<std::unique_ptr<uint8_t[]>> chunks_; 39 std::vector<std::unique_ptr<uint8_t[]>> chunks_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(FakeScatteredBuffer); 41 DISALLOW_COPY_AND_ASSIGN(FakeScatteredBuffer);
42 }; 42 };
43 43
44 } // namespace v2 44 } // namespace v2
45 } // namespace tracing 45 } // namespace tracing
46 46
47 #endif // COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_ 47 #endif // COMPONENTS_TRACING_TEST_FAKE_SCATTERED_BUFFER_H_
OLDNEW
« no previous file with comments | « components/tracing/proto/events_chunk.proto ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698