Remove ThreadObj #define and kThreadMaxNameLength from thread_wrapper.
BUG= R=hbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/47679004 Cr-Commit-Position: refs/heads/master@{#8792} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8792 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
0c26299739
commit
27c0be9dfe
@ -21,11 +21,6 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Object that will be passed by the spawned thread when it enters the callback
|
||||
// function.
|
||||
// TODO(tommi): Remove this define.
|
||||
#define ThreadObj void*
|
||||
|
||||
// Callback function that the spawned thread will enter once spawned.
|
||||
// A return value of false is interpreted as that the function has no
|
||||
// more work to do and that the thread can be released.
|
||||
@ -44,8 +39,6 @@ enum ThreadPriority {
|
||||
// called from the same thread, including instantiation.
|
||||
class ThreadWrapper {
|
||||
public:
|
||||
enum {kThreadMaxNameLength = 64};
|
||||
|
||||
virtual ~ThreadWrapper() {}
|
||||
|
||||
// Factory method. Constructor disabled.
|
||||
|
@ -164,7 +164,7 @@ bool EventPosix::StartTimer(bool periodic, unsigned long time) {
|
||||
return started;
|
||||
}
|
||||
|
||||
bool EventPosix::Run(ThreadObj obj) {
|
||||
bool EventPosix::Run(void* obj) {
|
||||
return static_cast<EventPosix*>(obj)->Process();
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class EventPosix : public EventWrapper {
|
||||
private:
|
||||
EventPosix();
|
||||
|
||||
static bool Run(ThreadObj obj);
|
||||
static bool Run(void* obj);
|
||||
bool Process();
|
||||
EventTypeWrapper Wait(timespec* end_at);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
ThreadWrapper* ThreadWrapper::CreateThread(ThreadRunFunction func,
|
||||
ThreadObj obj, ThreadPriority prio,
|
||||
void* obj, ThreadPriority prio,
|
||||
const char* thread_name) {
|
||||
#if defined(_WIN32)
|
||||
return new ThreadWindows(func, obj, prio, thread_name);
|
||||
|
@ -68,7 +68,7 @@ void* ThreadPosix::StartThread(void* param) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ThreadPosix::ThreadPosix(ThreadRunFunction func, ThreadObj obj,
|
||||
ThreadPosix::ThreadPosix(ThreadRunFunction func, void* obj,
|
||||
ThreadPriority prio, const char* thread_name)
|
||||
: run_function_(func),
|
||||
obj_(obj),
|
||||
@ -76,7 +76,7 @@ ThreadPosix::ThreadPosix(ThreadRunFunction func, ThreadObj obj,
|
||||
stop_event_(false, false),
|
||||
name_(thread_name ? thread_name : "webrtc"),
|
||||
thread_(0) {
|
||||
DCHECK(name_.length() < kThreadMaxNameLength);
|
||||
DCHECK(name_.length() < 64);
|
||||
}
|
||||
|
||||
uint32_t ThreadWrapper::GetThreadId() {
|
||||
|
@ -25,7 +25,7 @@ int ConvertToSystemPriority(ThreadPriority priority, int min_prio,
|
||||
|
||||
class ThreadPosix : public ThreadWrapper {
|
||||
public:
|
||||
ThreadPosix(ThreadRunFunction func, ThreadObj obj, ThreadPriority prio,
|
||||
ThreadPosix(ThreadRunFunction func, void* obj, ThreadPriority prio,
|
||||
const char* thread_name);
|
||||
~ThreadPosix() override;
|
||||
|
||||
|
@ -54,7 +54,7 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) {
|
||||
|
||||
}
|
||||
|
||||
ThreadWindows::ThreadWindows(ThreadRunFunction func, ThreadObj obj,
|
||||
ThreadWindows::ThreadWindows(ThreadRunFunction func, void* obj,
|
||||
ThreadPriority prio, const char* thread_name)
|
||||
: run_function_(func),
|
||||
obj_(obj),
|
||||
|
@ -574,7 +574,7 @@ int32_t UdpSocket2WorkerWindows::Init()
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool UdpSocket2WorkerWindows::Run(ThreadObj obj)
|
||||
bool UdpSocket2WorkerWindows::Run(void* obj)
|
||||
{
|
||||
UdpSocket2WorkerWindows* pWorker =
|
||||
static_cast<UdpSocket2WorkerWindows*>(obj);
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
virtual bool Stop();
|
||||
virtual int32_t Init();
|
||||
protected:
|
||||
static bool Run(ThreadObj obj);
|
||||
static bool Run(void* obj);
|
||||
bool Process();
|
||||
private:
|
||||
HANDLE _ioCompletionHandle;
|
||||
|
@ -300,7 +300,7 @@ bool UdpSocketManagerPosixImpl::Process()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UdpSocketManagerPosixImpl::Run(ThreadObj obj)
|
||||
bool UdpSocketManagerPosixImpl::Run(void* obj)
|
||||
{
|
||||
UdpSocketManagerPosixImpl* mgr =
|
||||
static_cast<UdpSocketManagerPosixImpl*>(obj);
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
virtual bool RemoveSocket(UdpSocketWrapper* s);
|
||||
|
||||
protected:
|
||||
static bool Run(ThreadObj obj);
|
||||
static bool Run(void* obj);
|
||||
bool Process();
|
||||
void UpdateSocketMap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user