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

Unified Diff: mojo/shell/standalone/tracer.h

Issue 1877753003: Move mojo\shell to services\shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@62scan
Patch Set: . Created 4 years, 8 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 | « mojo/shell/standalone/desktop/main_helper.cc ('k') | mojo/shell/standalone/tracer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/standalone/tracer.h
diff --git a/mojo/shell/standalone/tracer.h b/mojo/shell/standalone/tracer.h
deleted file mode 100644
index 651a35c2e42fb35c0f0d3cab0e6d140cbb4a491d..0000000000000000000000000000000000000000
--- a/mojo/shell/standalone/tracer.h
+++ /dev/null
@@ -1,102 +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.
-
-#ifndef MOJO_SHELL_STANDALONE_TRACER_H_
-#define MOJO_SHELL_STANDALONE_TRACER_H_
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <string>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted_memory.h"
-#include "mojo/common/data_pipe_drainer.h"
-#include "mojo/services/tracing/public/cpp/trace_provider_impl.h"
-#include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
-
-namespace mojo {
-namespace shell {
-
-// Tracer collects tracing data from base/trace_event and from externally
-// configured sources, aggregates it into a single stream, and writes it out to
-// a file. It should be constructed very early in a process' lifetime before any
-// initialization that may be interesting to trace has occured and be shut down
-// as late as possible to capture as much initialization/shutdown code as
-// possible.
-class Tracer : public mojo::common::DataPipeDrainer::Client {
- public:
- Tracer();
- ~Tracer() override;
-
- // Starts tracing the current process with the given set of categories. The
- // tracing results will be saved into the specified filename when
- // StopAndFlushToFile() is called.
- void Start(const std::string& categories,
- const std::string& duration_seconds_str,
- const std::string& filename);
-
- // Starts collecting data from the tracing service with the given set of
- // categories.
- void StartCollectingFromTracingService(
- tracing::TraceCollectorPtr coordinator);
-
- // Stops tracing and flushes all collected trace data to the file specified in
- // Start(). Blocks until the file write is complete. May be called after the
- // message loop is shut down.
- void StopAndFlushToFile();
-
- void ConnectToProvider(
- mojo::InterfaceRequest<tracing::TraceProvider> request);
-
- private:
- void StopTracingAndFlushToDisk();
-
- // Called from the flush thread. When all data is collected this runs
- // |done_callback| on the flush thread.
- void EndTraceAndFlush(const std::string& filename,
- const base::Closure& done_callback);
-
- // Called from the flush thread.
- void WriteTraceDataCollected(
- const base::Closure& done_callback,
- const scoped_refptr<base::RefCountedString>& events_str,
- bool has_more_events);
-
- // mojo::common::DataPipeDrainer::Client implementation.
- void OnDataAvailable(const void* data, size_t num_bytes) override;
- void OnDataComplete() override;
-
- // Emits a comma if needed.
- void WriteCommaIfNeeded();
-
- // Writes trace file footer and closes out the file.
- void WriteFooterAndClose();
-
- // Set when connected to the tracing service.
- tracing::TraceCollectorPtr coordinator_;
- scoped_ptr<mojo::common::DataPipeDrainer> drainer_;
-
- mojo::TraceProviderImpl trace_provider_impl_;
- // Whether we're currently tracing.
- bool tracing_;
- // Categories to trace.
- std::string categories_;
-
- // Whether we've written the first chunk.
- bool first_chunk_written_;
- std::string trace_service_data_;
-
- // Trace file, if open.
- FILE* trace_file_;
- std::string trace_filename_;
-
- DISALLOW_COPY_AND_ASSIGN(Tracer);
-};
-
-} // namespace shell
-} // namespace mojo
-
-#endif // MOJO_SHELL_STANDALONE_TRACER_H_
« no previous file with comments | « mojo/shell/standalone/desktop/main_helper.cc ('k') | mojo/shell/standalone/tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698