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

Unified Diff: sky/shell/tracing_controller.cc

Issue 1139873004: Make android directory for Android-specific bits of SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « sky/shell/tracing_controller.h ('k') | sky/shell/ui/engine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/tracing_controller.cc
diff --git a/sky/shell/tracing_controller.cc b/sky/shell/tracing_controller.cc
deleted file mode 100644
index e22e1a3866b7e0bf2557201c49a702ed3f38db07..0000000000000000000000000000000000000000
--- a/sky/shell/tracing_controller.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2015 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.
-
-#include "sky/shell/tracing_controller.h"
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_string.h"
-#include "base/files/file_util.h"
-#include "base/macros.h"
-#include "base/trace_event/trace_event.h"
-#include "jni/TracingController_jni.h"
-
-namespace sky {
-namespace shell {
-namespace {
-
-const char kStart[] = "{\"traceEvents\":[";
-const char kEnd[] = "]}";
-
-static FILE* g_file = NULL;
-
-void Write(const std::string& data) {
- ignore_result(fwrite(data.data(), data.length(), 1, g_file));
-}
-
-void HandleChunk(const scoped_refptr<base::RefCountedString>& chunk,
- bool has_more_events) {
- Write(chunk->data());
- if (has_more_events)
- Write(",");
-
- if (!has_more_events) {
- Write(kEnd);
- base::CloseFile(g_file);
- g_file = NULL;
-
- LOG(INFO) << "Trace complete";
- }
-}
-
-} // namespace
-
-static void StartTracing(JNIEnv* env, jclass clazz) {
- LOG(INFO) << "Starting trace";
-
- base::trace_event::TraceLog::GetInstance()->SetEnabled(
- base::trace_event::CategoryFilter("*"),
- base::trace_event::TraceLog::RECORDING_MODE,
- base::trace_event::TraceOptions(base::trace_event::RECORD_UNTIL_FULL));
-}
-
-static void StopTracing(JNIEnv* env, jclass clazz, jstring path) {
- base::trace_event::TraceLog::GetInstance()->SetDisabled();
-
- base::FilePath file_path(base::android::ConvertJavaStringToUTF8(env, path));
- g_file = base::OpenFile(file_path, "w");
- CHECK(g_file) << "Failed to open file " << file_path.LossyDisplayName();
-
- LOG(INFO) << "Saving trace to " << file_path.LossyDisplayName();
- Write(kStart);
- base::trace_event::TraceLog::GetInstance()->Flush(base::Bind(&HandleChunk));
-}
-
-bool RegisterTracingController(JNIEnv* env) {
- return RegisterNativesImpl(env);
-}
-
-} // namespace shell
-} // namespace sky
« no previous file with comments | « sky/shell/tracing_controller.h ('k') | sky/shell/ui/engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698