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

Side by Side Diff: components/tracing/test/tracing_interface_simulator.cc

Issue 2656303003: Test virtual interface [NOT FOR REVIEW] (Closed)
Patch Set: results Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "tracing_interface_simulator.h"
6
7 #include <string.h>
8
9 #include "base/trace_event/trace_event.h"
10
11 namespace tracing {
12
13 namespace {
14
15 class TracingImplementation;
16
17 TracingImplementation *g_instance;
18
19 class TracingImplementation : public TracingInterface {
20 public:
21 base::trace_event::TraceEventHandle AddEvent(
22 const char *category, const unsigned char* cat_enabled,
23 char type, const char *name, bool copy_name) const override {
24
25 return trace_event_internal::AddTraceEvent(
26 type, cat_enabled, name,
27 trace_event_internal::kGlobalScope, trace_event_internal::kNoId,
28 0u, trace_event_internal::kNoId);
29 }
30
31 const unsigned char* GetCategoryPointer(const char *category) const override {
32 const unsigned char* cat_enabled =
33 base::trace_event::TraceLog::GetCategoryGroupEnabled(category);
34 CHECK(cat_enabled);
35 return cat_enabled;
36 }
37 };
38
39 } // namespace
40
41 void InitTracingInterface() {
42 g_instance = new TracingImplementation();
43 }
44
45 const TracingInterface* GetTracingInterface() {
46 return g_instance;
47 }
48
49 base::trace_event::TraceEventHandle AddEventDirect(
50 const char *category, const unsigned char* cat_enabled,
51 char type, const char *name, bool copy_name) {
52
53 return trace_event_internal::AddTraceEvent(
54 type, cat_enabled, name,
55 trace_event_internal::kGlobalScope, trace_event_internal::kNoId,
56 0u, trace_event_internal::kNoId);
57 }
58
59 const unsigned char* GetCategoryPointerDirect(const char *category) {
60 const unsigned char* cat_enabled =
61 base::trace_event::TraceLog::GetCategoryGroupEnabled(category);
62 CHECK(cat_enabled);
63 return cat_enabled;
64 }
65
66 } // namespace tracing
OLDNEW
« no previous file with comments | « components/tracing/test/tracing_interface_simulator.h ('k') | components/tracing/test/tracing_virtual_tradeoff.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698