summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/JavaScriptCore/API/JSBase.h2
-rw-r--r--Source/JavaScriptCore/ChangeLog31
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.pri6
-rw-r--r--Source/JavaScriptCore/heap/MachineStackMarker.cpp14
-rw-r--r--Source/JavaScriptCore/heap/MachineStackMarker.h4
-rw-r--r--Source/JavaScriptCore/runtime/JSExportMacros.h4
-rw-r--r--Source/JavaScriptCore/wscript2
-rw-r--r--Source/WTF/ChangeLog15
-rw-r--r--Source/WTF/wtf/ExportMacros.h6
-rw-r--r--Source/WTF/wtf/ThreadSpecific.h36
-rw-r--r--Source/WTF/wtf/ThreadSpecificWin.cpp90
-rw-r--r--Source/WebCore/CMakeLists.txt1
-rw-r--r--Source/WebCore/ChangeLog29
-rw-r--r--Source/WebCore/GNUmakefile.list.am2
-rw-r--r--Source/WebCore/Target.pri2
-rw-r--r--Source/WebCore/WebCore.gypi4
-rw-r--r--Source/WebCore/platform/PlatformExportMacros.h6
-rw-r--r--Source/WebCore/platform/mock/DeviceMotionClientMock.cpp72
-rw-r--r--Source/WebCore/platform/mock/DeviceMotionClientMock.h68
19 files changed, 203 insertions, 191 deletions
diff --git a/Source/JavaScriptCore/API/JSBase.h b/Source/JavaScriptCore/API/JSBase.h
index f46a41755..fed54fe23 100644
--- a/Source/JavaScriptCore/API/JSBase.h
+++ b/Source/JavaScriptCore/API/JSBase.h
@@ -71,7 +71,7 @@ typedef struct OpaqueJSValue* JSObjectRef;
#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__)
#define JS_EXPORT __attribute__((visibility("default")))
#elif defined(WIN32) || defined(_WIN32) || defined(_WIN32_WCE) || defined(__CC_ARM) || defined(__ARMCC__)
-#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore)
+#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
#define JS_EXPORT __declspec(dllexport)
#else
#define JS_EXPORT __declspec(dllimport)
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 3907efc13..aafc84dca 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,34 +1,3 @@
-2012-06-19 Joel Dillon <joel.dillon@codethink.co.uk> Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
-
- [Qt][Win] Fix broken QtWebKit5.lib linking
- https://bugs.webkit.org/show_bug.cgi?id=88321
-
- Reviewed by NOBODY (OOPS!).
-
- Also update the Wx build to use the new define.
-
- * API/JSBase.h:
- * runtime/JSExportMacros.h:
- * wscript:
-
-2012-06-13 Patrick Gansterer <paroga@webkit.org>
-
- [WIN] Remove dependency on pthread from MachineStackMarker
- https://bugs.webkit.org/show_bug.cgi?id=68429
-
- Reviewed by NOBODY (OOPS!).
-
- Implement pthread TLS functionality with native windows functions.
-
- * heap/MachineStackMarker.cpp: Use the new functions instead of pthread directly.
- * heap/MachineStackMarker.h:
- * wtf/ThreadSpecific.h:
- (WTF::ThreadSpecificKeyCreate): Added wrapper around pthread_key_create.
- (WTF::ThreadSpecificKeyDelete): Added wrapper around pthread_key_delete.
- (WTF::ThreadSpecificSet): Added wrapper around pthread_setspecific.
- (WTF::ThreadSpecificGet): Added wrapper around pthread_getspecific.
- * wtf/ThreadSpecificWin.cpp:
-
2012-06-19 Filip Pizlo <fpizlo@apple.com>
JSC should be able to show disassembly for all generated JIT code
diff --git a/Source/JavaScriptCore/JavaScriptCore.pri b/Source/JavaScriptCore/JavaScriptCore.pri
index f6580c51f..380bbaf1b 100644
--- a/Source/JavaScriptCore/JavaScriptCore.pri
+++ b/Source/JavaScriptCore/JavaScriptCore.pri
@@ -34,6 +34,12 @@ INCLUDEPATH += \
win32-* {
LIBS += -lwinmm
+
+ win32-g++* {
+ LIBS += -lpthreadGC2
+ } else:win32-msvc* {
+ LIBS += -lpthreadVC2
+ }
}
wince* {
diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/Source/JavaScriptCore/heap/MachineStackMarker.cpp
index 06190f118..6989047ac 100644
--- a/Source/JavaScriptCore/heap/MachineStackMarker.cpp
+++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp
@@ -142,8 +142,10 @@ MachineThreads::MachineThreads(Heap* heap)
MachineThreads::~MachineThreads()
{
- if (m_threadSpecific)
- ThreadSpecificKeyDelete(m_threadSpecific);
+ if (m_threadSpecific) {
+ int error = pthread_key_delete(m_threadSpecific);
+ ASSERT_UNUSED(error, !error);
+ }
MutexLocker registeredThreadsLock(m_registeredThreadsMutex);
for (Thread* t = m_registeredThreads; t;) {
@@ -180,17 +182,19 @@ void MachineThreads::makeUsableFromMultipleThreads()
if (m_threadSpecific)
return;
- ThreadSpecificKeyCreate(&m_threadSpecific, removeThread);
+ int error = pthread_key_create(&m_threadSpecific, removeThread);
+ if (error)
+ CRASH();
}
void MachineThreads::addCurrentThread()
{
ASSERT(!m_heap->globalData()->exclusiveThread || m_heap->globalData()->exclusiveThread == currentThread());
- if (!m_threadSpecific || ThreadSpecificGet(m_threadSpecific))
+ if (!m_threadSpecific || pthread_getspecific(m_threadSpecific))
return;
- ThreadSpecificSet(m_threadSpecific, this);
+ pthread_setspecific(m_threadSpecific, this);
Thread* thread = new Thread(getCurrentPlatformThread(), wtfThreadData().stack().origin());
MutexLocker lock(m_registeredThreadsMutex);
diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.h b/Source/JavaScriptCore/heap/MachineStackMarker.h
index 2209f97e9..0f5a4c3aa 100644
--- a/Source/JavaScriptCore/heap/MachineStackMarker.h
+++ b/Source/JavaScriptCore/heap/MachineStackMarker.h
@@ -22,8 +22,8 @@
#ifndef MachineThreads_h
#define MachineThreads_h
+#include <pthread.h>
#include <wtf/Noncopyable.h>
-#include <wtf/ThreadSpecific.h>
#include <wtf/ThreadingPrimitives.h>
namespace JSC {
@@ -55,7 +55,7 @@ namespace JSC {
Heap* m_heap;
Mutex m_registeredThreadsMutex;
Thread* m_registeredThreads;
- WTF::ThreadSpecificKey m_threadSpecific;
+ pthread_key_t m_threadSpecific;
};
} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSExportMacros.h b/Source/JavaScriptCore/runtime/JSExportMacros.h
index 19e2c286f..884805f86 100644
--- a/Source/JavaScriptCore/runtime/JSExportMacros.h
+++ b/Source/JavaScriptCore/runtime/JSExportMacros.h
@@ -36,7 +36,7 @@
// See note in wtf/Platform.h for more info on EXPORT_MACROS.
#if USE(EXPORT_MACROS)
-#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore)
+#if defined(BUILDING_JavaScriptCore)
#define JS_EXPORT_PRIVATE WTF_EXPORT
#else
#define JS_EXPORT_PRIVATE WTF_IMPORT
@@ -50,7 +50,7 @@
#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
-#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore)
+#if defined(BUILDING_JavaScriptCore)
#define JS_EXPORTDATA __declspec(dllexport)
#else
#define JS_EXPORTDATA __declspec(dllimport)
diff --git a/Source/JavaScriptCore/wscript b/Source/JavaScriptCore/wscript
index 58696d9c5..4afb4d26a 100644
--- a/Source/JavaScriptCore/wscript
+++ b/Source/JavaScriptCore/wscript
@@ -66,7 +66,7 @@ def build(bld):
features = 'cc cxx cshlib',
includes = '. .. assembler ../WTF ' + ' '.join(includes),
source = sources,
- defines = ['BUILDING_JavaScriptCore', 'STATICALLY_LINKED_WITH_WTF'],
+ defines = ['BUILDING_JavaScriptCore'],
target = 'jscore',
uselib = 'WX ICU ' + get_config(),
uselib_local = '',
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index b01ed25bb..175633a66 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,18 +1,3 @@
-2012-06-19 Joel Dillon <joel.dillon@codethink.co.uk> Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
-
- [Qt][Win] Fix broken QtWebKit5.lib linking
- https://bugs.webkit.org/show_bug.cgi?id=88321
-
- Reviewed by NOBODY (OOPS!).
-
- Instead of letting a module's headers know which other modules depend on them,
- have depending modules define explicitely that they want its symbols exported too.
-
- JavaScriptCore should then be compiled with both BUILDING_JavaScriptCore and
- STATICALLY_LINKED_WITH_WTF.
-
- * wtf/ExportMacros.h:
-
2012-06-17 Filip Pizlo <fpizlo@apple.com>
It should be possible to look at disassembly
diff --git a/Source/WTF/wtf/ExportMacros.h b/Source/WTF/wtf/ExportMacros.h
index d50d6d117..efa0c8f81 100644
--- a/Source/WTF/wtf/ExportMacros.h
+++ b/Source/WTF/wtf/ExportMacros.h
@@ -72,7 +72,7 @@
// FIXME: When all ports are using the export macros, we should replace
// WTF_EXPORTDATA with WTF_EXPORT_PRIVATE macros.
-#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF)
+#if defined(BUILDING_WTF) || defined(BUILDING_JavaScriptCore)
#define WTF_EXPORTDATA WTF_EXPORT
#else
#define WTF_EXPORTDATA WTF_IMPORT
@@ -81,7 +81,7 @@
#else // !USE(EXPORT_MACROS)
#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !COMPILER(GCC)
-#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF)
+#if defined(BUILDING_WTF) || defined(BUILDING_JavaScriptCore)
#define WTF_EXPORTDATA __declspec(dllexport)
#else
#define WTF_EXPORTDATA __declspec(dllimport)
@@ -98,7 +98,7 @@
#endif // USE(EXPORT_MACROS)
-#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF)
+#if defined(BUILDING_WTF) || defined(BUILDING_JavaScriptCore)
#define WTF_EXPORT_PRIVATE WTF_EXPORT
#else
#define WTF_EXPORT_PRIVATE WTF_IMPORT
diff --git a/Source/WTF/wtf/ThreadSpecific.h b/Source/WTF/wtf/ThreadSpecific.h
index 60c9907bd..f51ab4cf2 100644
--- a/Source/WTF/wtf/ThreadSpecific.h
+++ b/Source/WTF/wtf/ThreadSpecific.h
@@ -1,7 +1,6 @@
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
* Copyright (C) 2009 Jian Li <jianli@chromium.org>
- * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -103,33 +102,6 @@ private:
};
#if USE(PTHREADS)
-
-typedef pthread_key_t ThreadSpecificKey;
-
-inline void ThreadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *))
-{
- int error = pthread_key_create(key, destructor);
- if (error)
- CRASH();
-}
-
-inline void ThreadSpecificKeyDelete(ThreadSpecificKey key)
-{
- int error = pthread_key_delete(key);
- if (error)
- CRASH();
-}
-
-inline void ThreadSpecificSet(ThreadSpecificKey key, void* value)
-{
- pthread_setspecific(key, value);
-}
-
-inline void* ThreadSpecificGet(ThreadSpecificKey key)
-{
- return pthread_getspecific(key);
-}
-
template<typename T>
inline ThreadSpecific<T>::ThreadSpecific()
{
@@ -167,14 +139,6 @@ const int kMaxTlsKeySize = 256;
WTF_EXPORT_PRIVATE long& tlsKeyCount();
WTF_EXPORT_PRIVATE DWORD* tlsKeys();
-class ThreadSpecificKeyValue;
-typedef ThreadSpecificKeyValue* ThreadSpecificKey;
-
-void ThreadSpecificKeyCreate(ThreadSpecificKey*, void (*)(void *));
-void ThreadSpecificKeyDelete(ThreadSpecificKey);
-void ThreadSpecificSet(ThreadSpecificKey, void*);
-void* ThreadSpecificGet(ThreadSpecificKey);
-
template<typename T>
inline ThreadSpecific<T>::ThreadSpecific()
: m_index(-1)
diff --git a/Source/WTF/wtf/ThreadSpecificWin.cpp b/Source/WTF/wtf/ThreadSpecificWin.cpp
index 61a594251..d72996a7a 100644
--- a/Source/WTF/wtf/ThreadSpecificWin.cpp
+++ b/Source/WTF/wtf/ThreadSpecificWin.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2009 Jian Li <jianli@chromium.org>
- * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,72 +19,15 @@
*/
#include "config.h"
-#include "ThreadSpecific.h"
-#include "StdLibExtras.h"
-#include "ThreadingPrimitives.h"
+#include "ThreadSpecific.h"
-#if !USE(PTHREADS)
+#if USE(PTHREADS)
+#error This file should not be compiled by ports that do not use Windows native ThreadSpecific implementation.
+#endif
namespace WTF {
-static Mutex& destructorsMutex()
-{
- DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
- return staticMutex;
-}
-
-class ThreadSpecificKeyValue {
-public:
- ThreadSpecificKeyValue(void (*destructor)(void *))
- : m_destructor(destructor)
- {
- m_tlsKey = TlsAlloc();
- if (m_tlsKey == TLS_OUT_OF_INDEXES)
- CRASH();
-
- MutexLocker locker(destructorsMutex());
- m_next = m_first;
- m_first = this;
- }
-
- ~ThreadSpecificKeyValue()
- {
- MutexLocker locker(destructorsMutex());
- ThreadSpecificKeyValue** next = &m_first;
- while (*next != this) {
- ASSERT(*next);
- next = &(*next)->m_next;
- }
- *next = (*next)->m_next;
-
- TlsFree(m_tlsKey);
- }
-
- void setValue(void* data) { TlsSetValue(m_tlsKey, data); }
- void* value() { return TlsGetValue(m_tlsKey); }
-
- static void callDestructors()
- {
- MutexLocker locker(destructorsMutex());
- ThreadSpecificKeyValue* next = m_first;
- while (next) {
- if (void* data = next->value())
- next->m_destructor(data);
- next = next->m_next;
- }
- }
-
-private:
- void (*m_destructor)(void *);
- DWORD m_tlsKey;
- ThreadSpecificKeyValue* m_next;
-
- static ThreadSpecificKeyValue* m_first;
-};
-
-ThreadSpecificKeyValue* ThreadSpecificKeyValue::m_first = 0;
-
long& tlsKeyCount()
{
static long count;
@@ -98,26 +40,6 @@ DWORD* tlsKeys()
return keys;
}
-void ThreadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *))
-{
- *key = new ThreadSpecificKeyValue(destructor);
-}
-
-void ThreadSpecificKeyDelete(ThreadSpecificKey key)
-{
- delete key;
-}
-
-void ThreadSpecificSet(ThreadSpecificKey key, void* data)
-{
- key->setValue(data);
-}
-
-void* ThreadSpecificGet(ThreadSpecificKey key)
-{
- return key->value();
-}
-
void ThreadSpecificThreadExit()
{
for (long i = 0; i < tlsKeyCount(); i++) {
@@ -126,10 +48,6 @@ void ThreadSpecificThreadExit()
if (data)
data->destructor(data);
}
-
- ThreadSpecificKeyValue::callDestructors();
}
} // namespace WTF
-
-#endif // !USE(PTHREADS)
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 1cb103140..e3a057232 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -1250,6 +1250,7 @@ SET(WebCore_SOURCES
platform/graphics/transforms/TransformState.cpp
platform/graphics/transforms/TranslateTransformOperation.cpp
+ platform/mock/DeviceMotionClientMock.cpp
platform/mock/DeviceOrientationClientMock.cpp
platform/mock/GeolocationClientMock.cpp
platform/mock/ScrollbarThemeMock.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 9d9649377..f9857a70d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,11 +1,30 @@
-2012-06-19 Joel Dillon <joel.dillon@codethink.co.uk> Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+2012-06-20 Amy Ousterhout <aousterh@chromium.org>
- [Qt][Win] Fix broken QtWebKit5.lib linking
- https://bugs.webkit.org/show_bug.cgi?id=88321
+ Adds DeviceMotionClientMock
+ https://bugs.webkit.org/show_bug.cgi?id=89220
+
+ Reviewed by Steve Block.
+
+ No new tests because DeviceMotionClientMock is designed to enable future testing and cannot be tested in itself.
- Reviewed by NOBODY (OOPS!).
+ Adds DeviceMotionClientMock in WebCore to enable testing of DeviceMotion once it is fully implemented in WebKit.
+ This addition was originally included in https://bugs.webkit.org/show_bug.cgi?id=89197 but was split into a separate patch for easier review.
- * platform/PlatformExportMacros.h:
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * platform/mock/DeviceMotionClientMock.cpp: Added.
+ (WebCore):
+ (WebCore::DeviceMotionClientMock::DeviceMotionClientMock):
+ (WebCore::DeviceMotionClientMock::setController):
+ (WebCore::DeviceMotionClientMock::startUpdating):
+ (WebCore::DeviceMotionClientMock::stopUpdating):
+ (WebCore::DeviceMotionClientMock::setMotion):
+ (WebCore::DeviceMotionClientMock::timerFired):
+ * platform/mock/DeviceMotionClientMock.h: Added.
+ (WebCore):
+ (DeviceMotionClientMock):
2012-06-19 Vivek Galatage <vivekgalatage@gmail.com>
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index 36ce1050a..202f5ea37 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -3479,6 +3479,8 @@ webcore_sources += \
Source/WebCore/platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp \
Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp \
Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h \
+ Source/WebCore/platform/mock/DeviceMotionClientMock.cpp \
+ Source/WebCore/platform/mock/DeviceMotionClientMock.h \
Source/WebCore/platform/mock/DeviceOrientationClientMock.cpp \
Source/WebCore/platform/mock/DeviceOrientationClientMock.h \
Source/WebCore/platform/mock/GeolocationClientMock.cpp \
diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri
index 6eacd5de6..dd9fdc0b1 100644
--- a/Source/WebCore/Target.pri
+++ b/Source/WebCore/Target.pri
@@ -1164,6 +1164,7 @@ SOURCES += \
platform/MemoryPressureHandler.cpp \
platform/MemoryUsageSupport.cpp \
platform/MIMETypeRegistry.cpp \
+ platform/mock/DeviceMotionClientMock.cpp \
platform/mock/DeviceOrientationClientMock.cpp \
platform/mock/GeolocationClientMock.cpp \
platform/mock/ScrollbarThemeMock.cpp \
@@ -2221,6 +2222,7 @@ HEADERS += \
platform/FileSystem.h \
platform/HistogramSupport.h \
platform/image-decoders/ImageDecoder.h \
+ platform/mock/DeviceMotionClientMock.h \
platform/mock/DeviceOrientationClientMock.h \
platform/mock/GeolocationClientMock.cpp \
platform/mock/ScrollbarThemeMock.h \
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index b0c72bc31..c8974d2d6 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -456,6 +456,7 @@
'platform/mediastream/chromium/PeerConnection00Handler.cpp',
'platform/mediastream/chromium/PeerConnection00HandlerInternal.cpp',
'platform/mediastream/chromium/PeerConnection00HandlerInternal.h',
+ 'platform/mock/DeviceMotionClientMock.h',
'platform/mock/DeviceOrientationClientMock.h',
'platform/mock/GeolocationClientMock.h',
'platform/network/AuthenticationChallengeBase.h',
@@ -622,6 +623,8 @@
'dom/ContextFeatures.cpp',
'dom/DOMImplementation.h',
'dom/DOMTimeStamp.h',
+ 'dom/DeviceMotionClient.h',
+ 'dom/DeviceMotionData.h',
'dom/DeviceOrientation.h',
'dom/DeviceOrientationClient.h',
'dom/Document.h',
@@ -4342,6 +4345,7 @@
'platform/mac/WebCoreView.m',
'platform/mac/WebFontCache.mm',
'platform/mac/WidgetMac.mm',
+ 'platform/mock/DeviceMotionClientMock.cpp',
'platform/mock/DeviceOrientationClientMock.cpp',
'platform/mock/GeolocationClientMock.cpp',
'platform/mock/ScrollbarThemeMock.cpp',
diff --git a/Source/WebCore/platform/PlatformExportMacros.h b/Source/WebCore/platform/PlatformExportMacros.h
index ae3e30a3a..6c70813ad 100644
--- a/Source/WebCore/platform/PlatformExportMacros.h
+++ b/Source/WebCore/platform/PlatformExportMacros.h
@@ -35,8 +35,7 @@
// See note in wtf/Platform.h for more info on EXPORT_MACROS.
#if USE(EXPORT_MACROS)
-#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit) || \
- defined(STATICALLY_LINKED_WITH_WebCore) || defined(STATICALLY_LINKED_WITH_WebKit)
+#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit)
#define WEBKIT_EXPORTDATA WTF_EXPORT
#else
#define WEBKIT_EXPORTDATA WTF_IMPORT
@@ -46,8 +45,7 @@
#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
-#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit) || \
- defined(STATICALLY_LINKED_WITH_WebCore) || defined(STATICALLY_LINKED_WITH_WebKit)
+#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit)
#define WEBKIT_EXPORTDATA __declspec(dllexport)
#else
#define WEBKIT_EXPORTDATA __declspec(dllimport)
diff --git a/Source/WebCore/platform/mock/DeviceMotionClientMock.cpp b/Source/WebCore/platform/mock/DeviceMotionClientMock.cpp
new file mode 100644
index 000000000..ecc4b13fd
--- /dev/null
+++ b/Source/WebCore/platform/mock/DeviceMotionClientMock.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DeviceMotionClientMock.h"
+
+#include "DeviceMotionController.h"
+
+namespace WebCore {
+
+DeviceMotionClientMock::DeviceMotionClientMock()
+ : m_controller(0)
+ , m_timer(this, &DeviceMotionClientMock::timerFired)
+ , m_isUpdating(false)
+{
+}
+
+void DeviceMotionClientMock::setController(DeviceMotionController* controller)
+{
+ ASSERT(!m_controller);
+ m_controller = controller;
+ ASSERT(m_controller);
+}
+
+void DeviceMotionClientMock::startUpdating()
+{
+ m_isUpdating = true;
+}
+
+void DeviceMotionClientMock::stopUpdating()
+{
+ m_isUpdating = false;
+ m_timer.stop();
+}
+
+void DeviceMotionClientMock::setMotion(PassRefPtr<DeviceMotionData> motion)
+{
+ m_motion = motion;
+ if (m_isUpdating && !m_timer.isActive())
+ m_timer.startOneShot(0);
+}
+
+void DeviceMotionClientMock::timerFired(Timer<DeviceMotionClientMock>* timer)
+{
+ ASSERT_UNUSED(timer, timer == &m_timer);
+ m_timer.stop();
+ m_controller->didChangeDeviceMotion(m_motion.get());
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/mock/DeviceMotionClientMock.h b/Source/WebCore/platform/mock/DeviceMotionClientMock.h
new file mode 100644
index 000000000..919e92b87
--- /dev/null
+++ b/Source/WebCore/platform/mock/DeviceMotionClientMock.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeviceMotionClientMock_h
+#define DeviceMotionClientMock_h
+
+#include "DeviceMotionClient.h"
+#include "DeviceMotionData.h"
+#include "Timer.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class DeviceMotionController;
+
+// A mock implementation of DeviceMotionClient used to test the feature in
+// DumpRenderTree. Embedders should should configure the Page object to use this
+// client when running DumpRenderTree.
+class DeviceMotionClientMock : public DeviceMotionClient {
+public:
+ DeviceMotionClientMock();
+
+ // DeviceMotionClient
+ virtual void setController(DeviceMotionController*) OVERRIDE;
+ virtual void startUpdating() OVERRIDE;
+ virtual void stopUpdating() OVERRIDE;
+ virtual DeviceMotionData* lastMotion() const OVERRIDE { return m_motion.get(); }
+ // mock is owned by the testing framework, which should handle deletion
+ virtual void deviceMotionControllerDestroyed() OVERRIDE { }
+
+ void setMotion(PassRefPtr<DeviceMotionData>);
+
+private:
+ void timerFired(Timer<DeviceMotionClientMock>*);
+
+ RefPtr<DeviceMotionData> m_motion;
+ DeviceMotionController* m_controller;
+ Timer<DeviceMotionClientMock> m_timer;
+ bool m_isUpdating;
+};
+
+} // namespace WebCore
+
+#endif // DeviceMotionClientMock_h