| OLD | NEW |
| (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 |
| OLD | NEW |