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

Side by Side Diff: chrome/browser/chromeos/arc/trace/arc_trace_reader.h

Issue 2400163003: arc: enable Android tracing in verified-boot mode (Closed)
Patch Set: Fix some nits Created 3 years, 10 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_READER_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_READER_H_
7
8 #include <inttypes.h>
9
10 #include <memory>
11 #include <queue>
12 #include <string>
13
14 #include "base/files/scoped_file.h"
15 #include "base/macros.h"
16 #include "base/threading/simple_thread.h"
17 #include "chromeos/trace/arc_trace_agent.h"
18
19 namespace arc {
20
21 // The class is for reading ARC trace data from the given socket FD, transform
22 // data into the JSON format, and store it in a circular buffer.
23 class ArcTraceReader : public base::DelegateSimpleThread::Delegate {
24 public:
25 using StopTracingCallback =
26 chromeos::ArcTraceAgent::Delegate::StopTracingCallback;
27
28 ArcTraceReader();
29
30 // Sets the input socket FD for reading ARC trace data.
31 void SetInputFD(base::ScopedFD fd);
32
33 void StartRecord();
34
35 void StopRecord(const StopTracingCallback& callback);
36
37 // DelegateSimpleThread::Delegate overrides:
38 void Run() override;
39
40 private:
41 void WriteTraceEvent(char ph,
42 int pid,
43 int tid,
44 uint64_t ts,
45 uint64_t tts,
46 const std::string* name = nullptr,
47 const int* count = nullptr,
48 const int* id = nullptr);
49
50 void ParseAndSaveData(std::string data);
51
52 bool is_recording_;
53 std::queue<std::string> trace_buffer_;
54 int current_data_size_;
55 base::ScopedFD input_fd_;
56 // Thread used for reading data from the input socket.
57 std::unique_ptr<base::SimpleThread> recording_thread_;
58
59 DISALLOW_COPY_AND_ASSIGN(ArcTraceReader);
60 };
61
62 } // namespace arc
63
64 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698