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

Unified Diff: content/shell/android/tracing_shell.h

Issue 11647013: Enable Tracing on content shell for Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add license header, javadoc comment and some minor fix Created 8 years 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: content/shell/android/tracing_shell.h
diff --git a/content/shell/android/tracing_shell.h b/content/shell/android/tracing_shell.h
new file mode 100644
index 0000000000000000000000000000000000000000..44e40e2544e0ae6c232b03eda194e1c7d97ef1f1
--- /dev/null
+++ b/content/shell/android/tracing_shell.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 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 CONTENT_SHELL_ANDROID_TRACING_SHELL_H
+#define CONTENT_SHELL_ANDROID_TRACING_SHELL_H
+
+#include <jni.h>
+#include <string>
+
+#include "base/file_util.h"
+#include "content/public/browser/trace_subscriber.h"
+
+namespace content {
+
+// Registers the TraceController native methods.
+bool RegisterTracingHandler(JNIEnv* env);
Ted C 2012/12/26 16:18:28 this should be RegisterTracingIntentHandler
+
+class TracingIntentHandler
Ted C 2012/12/26 16:18:28 the file name and ifdef should match this class na
+ : public content::TraceSubscriber {
Ted C 2012/12/26 16:18:28 I think it would be better to just extend from Tra
+ public:
+ TracingIntentHandler();
+ virtual ~TracingIntentHandler() {}
+
+ // TraceSubscriber
Ted C 2012/12/26 16:18:28 Add "implementation" to the end so it's clearer.
+ virtual void OnEndTracingComplete();
+ virtual void OnTraceDataCollected(
+ const scoped_refptr<base::RefCountedString>& trace_fragment);
+
+ // IntentHandler
+ void OnBeginTracing(std::string path);
+ void OnEndTracing();
+
+ bool in_tracing() { return in_tracing_; }
+ void SetInTracing(bool tracing) { in_tracing_ = tracing; }
Ted C 2012/12/26 16:18:28 if you are inlining functions in the header, it sh
+
+ struct JsonString {
Ted C 2012/12/26 16:18:28 This should probably be a class as well since it's
+ void Start();
+ void AddFragment(const std::string&);
+ void Finish();
+
+ bool first_;
+ std::string data_;
+ };
+
+ private:
+ bool in_tracing_;
+ FilePath path_to_save_;
+ JsonString trace_data_to_save_;
+};
+
+} // namespace content
+#endif // CONTENT_SHELL_ANDROID_TRACING_SHELL_H

Powered by Google App Engine
This is Rietveld 408576698