Fixes to build WebRTC for Fuchsia

1. Added WEBRTC_FUCHSIA define.
2. Added PlatformThreadId typedef for Fuchsia.
3. Updated ifdefs for _strnicmp()/strncasecmd(), so _strnicmp()
   is used on all platforms
3. Updated ifdefs in clock.cc to avoid invalid assumption that
   POSIX = LINUX || MAC .

Bug: chromium:750940
Change-Id: Id7aa98e017f467bcebb78a0b298ba91655502072
Reviewed-on: https://webrtc-review.googlesource.com/31641
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21233}
This commit is contained in:
Sergey Ulanov
2017-12-11 17:38:13 -08:00
committed by Commit Bot
parent 3fe1b15413
commit 6acefdb70a
6 changed files with 41 additions and 48 deletions

View File

@ -10,19 +10,19 @@
#include "system_wrappers/include/clock.h"
#if defined(_WIN32)
#if defined(WEBRTC_WIN)
// Windows needs to be included before mmsystem.h
#include "rtc_base/win32.h"
#include <MMSystem.h>
#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
#elif defined(WEBRTC_POSIX)
#include <sys/time.h>
#include <time.h>
#endif
#endif // defined(WEBRTC_POSIX)
#include "rtc_base/criticalsection.h"
#include "rtc_base/timeutils.h"
@ -79,7 +79,7 @@ class RealTimeClock : public Clock {
}
};
#if defined(_WIN32)
#if defined(WEBRTC_WIN)
// TODO(pbos): Consider modifying the implementation to synchronize itself
// against system time (update ref_point_, make it non-const) periodically to
// prevent clock drift.
@ -181,7 +181,7 @@ class WindowsRealTimeClock : public RealTimeClock {
const ReferencePoint ref_point_;
};
#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
#elif defined(WEBRTC_POSIX)
class UnixRealTimeClock : public RealTimeClock {
public:
UnixRealTimeClock() {}
@ -198,13 +198,14 @@ class UnixRealTimeClock : public RealTimeClock {
return tv;
}
};
#endif
#endif // defined(WEBRTC_POSIX)
#if defined(_WIN32)
#if defined(WEBRTC_WIN)
static WindowsRealTimeClock* volatile g_shared_clock = nullptr;
#endif
#endif // defined(WEBRTC_WIN)
Clock* Clock::GetRealTimeClock() {
#if defined(_WIN32)
#if defined(WEBRTC_WIN)
// This read relies on volatile read being atomic-load-acquire. This is
// true in MSVC since at least 2005:
// "A read of a volatile object (volatile read) has Acquire semantics"
@ -219,12 +220,12 @@ Clock* Clock::GetRealTimeClock() {
delete clock;
}
return g_shared_clock;
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_POSIX)
static UnixRealTimeClock clock;
return &clock;
#else
return NULL;
#endif
#else // defined(WEBRTC_POSIX)
return nullptr;
#endif // !defined(WEBRTC_WIN) || defined(WEBRTC_POSIX)
}
SimulatedClock::SimulatedClock(int64_t initial_time_us)