webrtc_m130/webrtc/base/latebindingsymboltable.h
kwiberg 4485ffb58d #include "webrtc/base/constructormagic.h" where appropriate
Any file that uses the RTC_DISALLOW_* macros should #include
"webrtc/base/constructormagic.h", but a shocking number of them don't.
This causes trouble when we try to wean files off of #including
scoped_ptr.h, since a bunch of files get their constructormagic macros
only from there.

Rather than fixing these errors one by one as they turn up, this CL
simply ensures that every file in the WebRTC tree that uses the
RTC_DISALLOW_* macros #includes "webrtc/base/constructormagic.h".

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1917043005

Cr-Commit-Position: refs/heads/master@{#12509}
2016-04-26 15:14:48 +00:00

71 lines
2.1 KiB
C++

/*
* Copyright 2004 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.
*/
#ifndef WEBRTC_BASE_LATEBINDINGSYMBOLTABLE_H_
#define WEBRTC_BASE_LATEBINDINGSYMBOLTABLE_H_
#include <string.h>
#include "webrtc/base/common.h"
#include "webrtc/base/constructormagic.h"
namespace rtc {
#if defined(WEBRTC_POSIX)
typedef void *DllHandle;
#else
#error Not implemented for this platform
#endif
// This is the base class for "symbol table" classes to simplify the dynamic
// loading of symbols from DLLs. Currently the implementation only supports
// Linux and OS X, and pure C symbols (or extern "C" symbols that wrap C++
// functions). Sub-classes for specific DLLs are generated via the "supermacro"
// files latebindingsymboltable.h.def and latebindingsymboltable.cc.def. See
// talk/sound/pulseaudiosymboltable.(h|cc) for an example.
class LateBindingSymbolTable {
public:
struct TableInfo {
const char *dll_name;
int num_symbols;
// Array of size num_symbols.
const char *const *symbol_names;
};
LateBindingSymbolTable(const TableInfo *info, void **table);
~LateBindingSymbolTable();
bool IsLoaded() const;
// Loads the DLL and the symbol table. Returns true iff the DLL and symbol
// table loaded successfully.
bool Load();
// Like load, but allows overriding the dll path for when the dll path is
// dynamic.
bool LoadFromPath(const char *dll_path);
void Unload();
// Gets the raw OS handle to the DLL. Be careful what you do with it.
DllHandle GetDllHandle() const { return handle_; }
private:
void ClearSymbols();
const TableInfo *info_;
void **table_;
DllHandle handle_;
bool undefined_symbols_;
RTC_DISALLOW_COPY_AND_ASSIGN(LateBindingSymbolTable);
};
} // namespace rtc
#endif // WEBRTC_BASE_LATEBINDINGSYMBOLTABLE_H_