mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
d83a3d71bc
Merge in RedPhone // FREEBIE
61 lines
2.0 KiB
C++
61 lines
2.0 KiB
C++
/*
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "webrtc/system_wrappers/interface/event_tracer.h"
|
|
|
|
namespace webrtc {
|
|
|
|
namespace {
|
|
|
|
GetCategoryEnabledPtr g_get_category_enabled_ptr = 0;
|
|
AddTraceEventPtr g_add_trace_event_ptr = 0;
|
|
|
|
} // namespace
|
|
|
|
void SetupEventTracer(GetCategoryEnabledPtr get_category_enabled_ptr,
|
|
AddTraceEventPtr add_trace_event_ptr) {
|
|
g_get_category_enabled_ptr = get_category_enabled_ptr;
|
|
g_add_trace_event_ptr = add_trace_event_ptr;
|
|
}
|
|
|
|
// static
|
|
const unsigned char* EventTracer::GetCategoryEnabled(const char* name) {
|
|
if (g_get_category_enabled_ptr)
|
|
return g_get_category_enabled_ptr(name);
|
|
|
|
// A string with null terminator means category is disabled.
|
|
return reinterpret_cast<const unsigned char*>("\0");
|
|
}
|
|
|
|
// static
|
|
void EventTracer::AddTraceEvent(char phase,
|
|
const unsigned char* category_enabled,
|
|
const char* name,
|
|
unsigned long long id,
|
|
int num_args,
|
|
const char** arg_names,
|
|
const unsigned char* arg_types,
|
|
const unsigned long long* arg_values,
|
|
unsigned char flags) {
|
|
if (g_add_trace_event_ptr) {
|
|
g_add_trace_event_ptr(phase,
|
|
category_enabled,
|
|
name,
|
|
id,
|
|
num_args,
|
|
arg_names,
|
|
arg_types,
|
|
arg_values,
|
|
flags);
|
|
}
|
|
}
|
|
|
|
} // namespace webrtc
|