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

Unified Diff: sky/viewer/services/tracing_impl.cc

Issue 751303003: Move tracing_impl code to mojo/common (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/viewer/services/tracing_impl.h ('k') | sky/viewer/viewer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/viewer/services/tracing_impl.cc
diff --git a/sky/viewer/services/tracing_impl.cc b/sky/viewer/services/tracing_impl.cc
deleted file mode 100644
index 755e0dd2eff2bfa0a02bf97d6c39831b4bf4ab3a..0000000000000000000000000000000000000000
--- a/sky/viewer/services/tracing_impl.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-#include "sky/viewer/services/tracing_impl.h"
-
-#include "base/callback.h"
-#include "base/debug/trace_event.h"
-#include "base/files/file_util.h"
-
-namespace sky {
-namespace {
-
-static bool g_tracing = false;
-static int g_blocks = 0;
-static FILE* g_trace_file = NULL;
-
-void WriteTraceDataCollected(
- const scoped_refptr<base::RefCountedString>& events_str,
- bool has_more_events) {
- if (g_blocks) {
- fwrite(",", 1, 1, g_trace_file);
- }
- ++g_blocks;
- fwrite(
- events_str->data().c_str(), 1, events_str->data().length(), g_trace_file);
- if (!has_more_events) {
- fwrite("]}", 1, 2, g_trace_file);
- base::CloseFile(g_trace_file);
- g_trace_file = NULL;
- g_blocks = 0;
- }
-}
-
-void StopTracingAndFlushToDisk() {
- base::debug::TraceLog::GetInstance()->SetDisabled();
-
- g_trace_file = base::OpenFile(
- base::FilePath(FILE_PATH_LITERAL("sky_viewer.trace")), "w+");
- static const char start[] = "{\"traceEvents\":[";
- fwrite(start, 1, strlen(start), g_trace_file);
- base::debug::TraceLog::GetInstance()->Flush(
- base::Bind(&WriteTraceDataCollected));
-}
-
-}
-
-TracingImpl::TracingImpl() {
-}
-
-TracingImpl::~TracingImpl() {
-}
-
-void TracingImpl::Start() {
- if (g_tracing)
- return;
- g_tracing = true;
- base::debug::TraceLog::GetInstance()->SetEnabled(
- base::debug::CategoryFilter("*"),
- base::debug::TraceLog::RECORDING_MODE,
- base::debug::TraceOptions(base::debug::RECORD_UNTIL_FULL));
-}
-
-void TracingImpl::Stop() {
- if (!g_tracing)
- return;
- g_tracing = false;
- StopTracingAndFlushToDisk();
-}
-
-} // namespace sky
« no previous file with comments | « sky/viewer/services/tracing_impl.h ('k') | sky/viewer/viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698