diff options
Diffstat (limited to 'lldb/source/Core/PluginManager.cpp')
-rw-r--r-- | lldb/source/Core/PluginManager.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 91d640d641d..71a0f6eccea 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -1167,93 +1167,6 @@ PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex( return nullptr; } -#pragma mark LogChannel - -struct LogInstance { - LogInstance() : name(), description(), create_callback(nullptr) {} - - ConstString name; - std::string description; - LogChannelCreateInstance create_callback; -}; - -typedef std::vector<LogInstance> LogInstances; - -static std::recursive_mutex &GetLogMutex() { - static std::recursive_mutex g_instances_mutex; - return g_instances_mutex; -} - -static LogInstances &GetLogInstances() { - static LogInstances g_instances; - return g_instances; -} - -bool PluginManager::RegisterPlugin(const ConstString &name, - const char *description, - LogChannelCreateInstance create_callback) { - if (create_callback) { - LogInstance instance; - assert((bool)name); - instance.name = name; - if (description && description[0]) - instance.description = description; - instance.create_callback = create_callback; - std::lock_guard<std::recursive_mutex> gard(GetLogMutex()); - GetLogInstances().push_back(instance); - } - return false; -} - -bool PluginManager::UnregisterPlugin(LogChannelCreateInstance create_callback) { - if (create_callback) { - std::lock_guard<std::recursive_mutex> gard(GetLogMutex()); - LogInstances &instances = GetLogInstances(); - - LogInstances::iterator pos, end = instances.end(); - for (pos = instances.begin(); pos != end; ++pos) { - if (pos->create_callback == create_callback) { - instances.erase(pos); - return true; - } - } - } - return false; -} - -const char *PluginManager::GetLogChannelCreateNameAtIndex(uint32_t idx) { - std::lock_guard<std::recursive_mutex> gard(GetLogMutex()); - LogInstances &instances = GetLogInstances(); - if (idx < instances.size()) - return instances[idx].name.GetCString(); - return nullptr; -} - -LogChannelCreateInstance -PluginManager::GetLogChannelCreateCallbackAtIndex(uint32_t idx) { - std::lock_guard<std::recursive_mutex> gard(GetLogMutex()); - LogInstances &instances = GetLogInstances(); - if (idx < instances.size()) - return instances[idx].create_callback; - return nullptr; -} - -LogChannelCreateInstance -PluginManager::GetLogChannelCreateCallbackForPluginName( - const ConstString &name) { - if (name) { - std::lock_guard<std::recursive_mutex> gard(GetLogMutex()); - LogInstances &instances = GetLogInstances(); - - LogInstances::iterator pos, end = instances.end(); - for (pos = instances.begin(); pos != end; ++pos) { - if (name == pos->name) - return pos->create_callback; - } - } - return nullptr; -} - #pragma mark Platform struct PlatformInstance { |