Commit 51256752 authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Commit Bot

Fuchsia: Prepare for OS_POSIX removal in Blink.

This cleans up multi-platform code paths selection and prepares for
the removal of OS_POSIX for the Fuchsia build.

Bug: 836416
Change-Id: Ia326c5b5f0f05d347ee52abc89ad69386761792f
Reviewed-on: https://chromium-review.googlesource.com/1033994
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556918}
parent 98cd6585
......@@ -954,11 +954,9 @@ inline uint32_t GetRandomMagic() {
#if defined(OS_WIN)
static const uintptr_t random2 =
~(RotateLeft16(reinterpret_cast<uintptr_t>(::ReadFile)));
#elif defined(OS_POSIX)
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
static const uintptr_t random2 =
~(RotateLeft16(reinterpret_cast<uintptr_t>(::read)));
#else
#error OS not supported
#endif
#if defined(ARCH_CPU_64_BITS)
......
......@@ -10,7 +10,7 @@
#if defined(OS_WIN)
#include <windows.h>
#elif defined(OS_POSIX)
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
#include <unistd.h>
#endif
......@@ -36,7 +36,7 @@ WebThreadCreationParams& WebThreadCreationParams::SetFrameScheduler(
#if defined(OS_WIN)
static_assert(sizeof(blink::PlatformThreadId) >= sizeof(DWORD),
"size of platform thread id is too small");
#elif defined(OS_POSIX)
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
static_assert(sizeof(blink::PlatformThreadId) >= sizeof(pid_t),
"size of platform thread id is too small");
#else
......
......@@ -33,7 +33,7 @@
#include "build/build_config.h"
#if defined(OS_POSIX)
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
#include <arpa/inet.h>
#endif
......
......@@ -41,15 +41,19 @@
#if defined(OS_WIN)
#include <windows.h>
#endif
#if defined(OS_POSIX)
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
#include <pthread.h>
#endif
namespace WTF {
#if defined(OS_POSIX)
#if defined(OS_WIN)
struct PlatformMutex {
CRITICAL_SECTION internal_mutex_;
size_t recursion_count_;
};
typedef CONDITION_VARIABLE PlatformCondition;
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
struct PlatformMutex {
pthread_mutex_t internal_mutex_;
#if DCHECK_IS_ON()
......@@ -57,15 +61,6 @@ struct PlatformMutex {
#endif
};
typedef pthread_cond_t PlatformCondition;
#elif defined(OS_WIN)
struct PlatformMutex {
CRITICAL_SECTION internal_mutex_;
size_t recursion_count_;
};
typedef CONDITION_VARIABLE PlatformCondition;
#else
typedef void* PlatformMutex;
typedef void* PlatformCondition;
#endif
class WTF_EXPORT MutexBase {
......
......@@ -32,7 +32,7 @@
#include "build/build_config.h"
#if defined(OS_POSIX)
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
#include <errno.h>
#include <limits.h>
......@@ -270,4 +270,4 @@ void WillCreateThread() {
} // namespace WTF
#endif // defined(OS_POSIX)
#endif // defined(OS_POSIX) || defined(OS_FUCHSIA)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment