Index: webrtc/base/thread.h |
diff --git a/webrtc/base/thread.h b/webrtc/base/thread.h |
index 01c80501c8010a2cfd2f39230abf1f9af28f3f34..e9bb3249ea809f9b963d58a3a65d932a3e2d3be7 100644 |
--- a/webrtc/base/thread.h |
+++ b/webrtc/base/thread.h |
@@ -23,6 +23,7 @@ |
#include "webrtc/base/constructormagic.h" |
#include "webrtc/base/event.h" |
#include "webrtc/base/messagequeue.h" |
+#include "webrtc/base/platform_thread_types.h" |
#if defined(WEBRTC_WIN) |
#include "webrtc/base/win32.h" |
@@ -36,9 +37,7 @@ class ThreadManager { |
public: |
static const int kForever = -1; |
- ThreadManager(); |
- ~ThreadManager(); |
- |
+ // Singleton, constructor and destructor are private. |
static ThreadManager* Instance(); |
Thread* CurrentThread(); |
@@ -60,7 +59,12 @@ class ThreadManager { |
Thread *WrapCurrentThread(); |
void UnwrapCurrentThread(); |
+ bool IsMainThread(); |
+ |
private: |
+ ThreadManager(); |
+ ~ThreadManager(); |
+ |
#if defined(WEBRTC_POSIX) |
pthread_key_t key_; |
#endif |
@@ -69,6 +73,9 @@ class ThreadManager { |
DWORD key_; |
#endif |
+ // The thread to potentially autowrap. |
+ PlatformThreadRef main_thread_ref_; |
+ |
RTC_DISALLOW_COPY_AND_ASSIGN(ThreadManager); |
}; |
@@ -123,9 +130,7 @@ class LOCKABLE Thread : public MessageQueue { |
const bool previous_state_; |
}; |
- bool IsCurrent() const { |
- return Current() == this; |
- } |
+ bool IsCurrent() const; |
// Sleeps the calling thread for the specified number of milliseconds, during |
// which time no processing is performed. Returns false if sleeping was |