From 92a17ec3ed87d86eee5dbea238bab3c3a00396e0 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 23 Oct 2013 14:24:27 +0200 Subject: Only use 64bit atomics when supported To support Windows XP we must avoid using the 64bit variants of the atomicIncrement/atomicDecrement operations which are only supported from Windows 2003 and up. This patch rolls back the minimum Win32 API version to WinNT 5.1 (32bit WinXP), and adds a new flag to indicate the support of 64bit atomics. The new flag is now also used to support MIPS and other architectures without 64bit intrinsics, instead of hacking in poor support. This also extends the atomic operations to sparc64 which was previously skipped because it did not work with __exchange_and_add. Task-number: QTBUG-34271 Change-Id: I21b09df3cafb7f0987a2f44c89036ff34ed34aa0 Reviewed-by: Jocelyn Turcotte Reviewed-by: Kai Koehne --- Source/WebKit2/UIProcess/StatisticsRequest.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Source/WebKit2/UIProcess/StatisticsRequest.cpp') diff --git a/Source/WebKit2/UIProcess/StatisticsRequest.cpp b/Source/WebKit2/UIProcess/StatisticsRequest.cpp index 0fa1fb7a7..6f81ccbb3 100644 --- a/Source/WebKit2/UIProcess/StatisticsRequest.cpp +++ b/Source/WebKit2/UIProcess/StatisticsRequest.cpp @@ -28,7 +28,7 @@ #include "ImmutableArray.h" #include "MutableDictionary.h" -#include +#include namespace WebKit { @@ -47,7 +47,15 @@ uint64_t StatisticsRequest::addOutstandingRequest() { static int64_t uniqueRequestID; +#if HAVE(ATOMICS_64BIT) uint64_t requestID = atomicIncrement(&uniqueRequestID); +#else + static Mutex uniqueRequestMutex; + uniqueRequestMutex.lock(); + uint64_t requestID = ++uniqueRequestID; + uniqueRequestMutex.unlock(); +#endif + m_outstandingRequests.add(requestID); return requestID; } -- cgit v1.2.1