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

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

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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 | « services/shell/standalone/desktop/main_helper.cc ('k') | services/shell/standalone/tracer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/standalone/tracer.h
diff --git a/services/shell/standalone/tracer.h b/services/shell/standalone/tracer.h
deleted file mode 100644
index d330779553d7d74a2aba0441a176dd5993efd30e..0000000000000000000000000000000000000000
--- a/services/shell/standalone/tracer.h
+++ /dev/null
@@ -1,100 +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 SERVICES_SHELL_STANDALONE_TRACER_H_
-#define SERVICES_SHELL_STANDALONE_TRACER_H_
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <memory>
-#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 "services/tracing/public/cpp/provider.h"
-#include "services/tracing/public/interfaces/tracing.mojom.h"
-
-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::mojom::CollectorPtr 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(tracing::mojom::ProviderRequest 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::mojom::CollectorPtr coordinator_;
- std::unique_ptr<mojo::common::DataPipeDrainer> drainer_;
-
- tracing::Provider provider_;
- // 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
-
-#endif // SERVICES_SHELL_STANDALONE_TRACER_H_
« no previous file with comments | « services/shell/standalone/desktop/main_helper.cc ('k') | services/shell/standalone/tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698