| Index: components/tracing/test/tracing_interface_simulator.cc
|
| diff --git a/components/tracing/test/tracing_interface_simulator.cc b/components/tracing/test/tracing_interface_simulator.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..06938789552c03d1db484b2768107d26fcb61ae9
|
| --- /dev/null
|
| +++ b/components/tracing/test/tracing_interface_simulator.cc
|
| @@ -0,0 +1,66 @@
|
| +// Copyright 2017 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 "tracing_interface_simulator.h"
|
| +
|
| +#include <string.h>
|
| +
|
| +#include "base/trace_event/trace_event.h"
|
| +
|
| +namespace tracing {
|
| +
|
| +namespace {
|
| +
|
| +class TracingImplementation;
|
| +
|
| +TracingImplementation *g_instance;
|
| +
|
| +class TracingImplementation : public TracingInterface {
|
| + public:
|
| + base::trace_event::TraceEventHandle AddEvent(
|
| + const char *category, const unsigned char* cat_enabled,
|
| + char type, const char *name, bool copy_name) const override {
|
| +
|
| + return trace_event_internal::AddTraceEvent(
|
| + type, cat_enabled, name,
|
| + trace_event_internal::kGlobalScope, trace_event_internal::kNoId,
|
| + 0u, trace_event_internal::kNoId);
|
| + }
|
| +
|
| + const unsigned char* GetCategoryPointer(const char *category) const override {
|
| + const unsigned char* cat_enabled =
|
| + base::trace_event::TraceLog::GetCategoryGroupEnabled(category);
|
| + CHECK(cat_enabled);
|
| + return cat_enabled;
|
| + }
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +void InitTracingInterface() {
|
| + g_instance = new TracingImplementation();
|
| +}
|
| +
|
| +const TracingInterface* GetTracingInterface() {
|
| + return g_instance;
|
| +}
|
| +
|
| +base::trace_event::TraceEventHandle AddEventDirect(
|
| + const char *category, const unsigned char* cat_enabled,
|
| + char type, const char *name, bool copy_name) {
|
| +
|
| + return trace_event_internal::AddTraceEvent(
|
| + type, cat_enabled, name,
|
| + trace_event_internal::kGlobalScope, trace_event_internal::kNoId,
|
| + 0u, trace_event_internal::kNoId);
|
| +}
|
| +
|
| +const unsigned char* GetCategoryPointerDirect(const char *category) {
|
| + const unsigned char* cat_enabled =
|
| + base::trace_event::TraceLog::GetCategoryGroupEnabled(category);
|
| + CHECK(cat_enabled);
|
| + return cat_enabled;
|
| +}
|
| +
|
| +} // namespace tracing
|
|
|