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

Unified Diff: sky/tools/debugger/prompt/trace_collector.h

Issue 853943005: Make tracing work on Android (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: nits Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: sky/tools/debugger/prompt/trace_collector.h
diff --git a/sky/tools/debugger/prompt/trace_collector.h b/sky/tools/debugger/prompt/trace_collector.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a14f2a9ffcf2c7ceafd0edd80509815121c70b6
--- /dev/null
+++ b/sky/tools/debugger/prompt/trace_collector.h
@@ -0,0 +1,41 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKY_TOOLS_DEBUGGER_PROMPT_TRACE_COLLECTOR_H_
+#define SKY_TOOLS_DEBUGGER_PROMPT_TRACE_COLLECTOR_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "mojo/common/data_pipe_drainer.h"
+
+namespace sky {
+namespace debugger {
+
+class TraceCollector : public mojo::common::DataPipeDrainer::Client {
+ public:
+ typedef base::Callback<void(std::string)> TraceCallback;
+
+ explicit TraceCollector(mojo::ScopedDataPipeConsumerHandle source);
+ ~TraceCollector();
+
+ void GetTrace(TraceCallback callback);
+
+ private:
+ void OnDataAvailable(const void* data, size_t num_bytes) override;
+ void OnDataComplete() override;
+
+ std::string GetTraceAsString();
+
+ mojo::common::DataPipeDrainer drainer_;
+ std::vector<char> trace_;
+ bool is_complete_;
+ bool callback_requested_;
+ TraceCallback callback_;
+};
+
+} // namespace debugger
+} // namespace sky
+
+#endif // SKY_TOOLS_DEBUGGER_PROMPT_TRACE_COLLECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698