Changeset 101041 in webkit


Ignore:
Timestamp:
Nov 22, 2011 7:30:34 PM (12 years ago)
Author:
dbates@webkit.org
Message:

Add WTF infrastructure for the BlackBerry port
https://bugs.webkit.org/show_bug.cgi?id=72970

Reviewed by Antonio Gomes.

  • wtf/Assertions.cpp: Added BlackBerry-specific logging directive.
  • wtf/MathExtras.h:

(abs): Added; stdlib doesn't contain abs() on QNX.

  • wtf/Platform.h: Define WTF_PLATFORM_BLACKBERRY and enable some platform features.
  • wtf/RandomNumberSeed.h:

(WTF::initializeRandomNumberGenerator): For the BlackBerry port, we initialize
the bad pseudo random number generator using time(3) before initializing the
Mersenne Twister random number generator.

  • wtf/ThreadingPthreads.cpp:

(WTF::createThreadInternal): Added.

  • wtf/blackberry: Added.
  • wtf/blackberry/MainThreadBlackBerry.cpp: Added.

(WTF::initializeMainThreadPlatform):
(WTF::scheduleDispatchFunctionsOnMainThread):

  • wtf/text/WTFString.h: Added constructor and conversion operator for

BlackBerry WebString string object.

Location:
trunk/Source/JavaScriptCore
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r100989 r101041  
     12011-11-22  Daniel Bates  <dbates@rim.com>
     2
     3        Add WTF infrastructure for the BlackBerry port
     4        https://bugs.webkit.org/show_bug.cgi?id=72970
     5
     6        Reviewed by Antonio Gomes.
     7
     8        * wtf/Assertions.cpp: Added BlackBerry-specific logging directive.
     9        * wtf/MathExtras.h:
     10        (abs): Added; stdlib doesn't contain abs() on QNX.
     11        * wtf/Platform.h: Define WTF_PLATFORM_BLACKBERRY and enable some platform features.
     12        * wtf/RandomNumberSeed.h:
     13        (WTF::initializeRandomNumberGenerator): For the BlackBerry port, we initialize
     14        the bad pseudo random number generator using time(3) before initializing the
     15        Mersenne Twister random number generator.
     16        * wtf/ThreadingPthreads.cpp:
     17        (WTF::createThreadInternal): Added.
     18        * wtf/blackberry: Added.
     19        * wtf/blackberry/MainThreadBlackBerry.cpp: Added.
     20        (WTF::initializeMainThreadPlatform):
     21        (WTF::scheduleDispatchFunctionsOnMainThread):
     22        * wtf/text/WTFString.h: Added constructor and conversion operator for
     23        BlackBerry WebString string object.
     24
    1252011-11-22  Sheriff Bot  <webkit.review.bot@gmail.com>
    226
  • trunk/Source/JavaScriptCore/wtf/Assertions.cpp

    r97557 r101041  
    5656#endif
    5757
     58#if PLATFORM(BLACKBERRY)
     59#include <BlackBerryPlatformMisc.h>
     60#endif
     61
    5862extern "C" {
    5963
     
    7882        return;
    7983    }
    80 
     84#elif PLATFORM(BLACKBERRY)
     85    BlackBerry::Platform::logV(BlackBerry::Platform::LogLevelInfo, format, args);
    8186#elif HAVE(ISDEBUGGERPRESENT)
    8287    if (IsDebuggerPresent()) {
  • trunk/Source/JavaScriptCore/wtf/MathExtras.h

    r99161 r101041  
    5151#endif
    5252
     53#if OS(QNX)
     54// FIXME: Look into a way to have cmath import its functions into both the standard and global
     55// namespace. For now, we include math.h since the QNX cmath header only imports its functions
     56// into the standard namespace.
     57#include <math.h>
     58#endif
     59
    5360#ifndef M_PI
    5461const double piDouble = 3.14159265358979323846;
     
    132139inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
    133140
     141#endif
     142
     143#if COMPILER(GCC) && OS(QNX)
     144// The stdlib on QNX doesn't contain long abs(long). See PR #104666.
     145inline long long abs(long num) { return labs(num); }
    134146#endif
    135147
  • trunk/Source/JavaScriptCore/wtf/Platform.h

    r100989 r101041  
    22 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007-2009 Torch Mobile, Inc.
    4  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     4 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
    55 *
    66 * Redistribution and use in source and binary forms, with or without
     
    410410/* PLATFORM(WX) */
    411411/* PLATFORM(GTK) */
     412/* PLATFORM(BLACKBERRY) */
    412413/* PLATFORM(MAC) */
    413414/* PLATFORM(WIN) */
     
    420421#elif defined(BUILDING_GTK__)
    421422#define WTF_PLATFORM_GTK 1
     423#elif defined(BUILDING_BLACKBERRY__)
     424#define WTF_PLATFORM_BLACKBERRY 1
    422425#elif OS(DARWIN)
    423426#define WTF_PLATFORM_MAC 1
     
    469472#define WTF_USE_CHROMIUM_NET 1
    470473#endif
     474#endif
     475
     476#if PLATFORM(BLACKBERRY)
     477#define ENABLE_DRAG_SUPPORT 0
     478#define USE_SYSTEM_MALLOC 1
     479#define WTF_USE_MERSENNE_TWISTER_19937 1
     480#define WTF_USE_SKIA 1
    471481#endif
    472482
  • trunk/Source/JavaScriptCore/wtf/RandomNumberSeed.h

    r95901 r101041  
    5757#elif COMPILER(MSVC) && defined(_CRT_RAND_S)
    5858    // On Windows we use rand_s which initialises itself
    59 #elif OS(UNIX)
     59#elif OS(UNIX) && !PLATFORM(BLACKBERRY)
    6060    // srandomdev is not guaranteed to exist on linux so we use this poor seed, this should be improved
    6161    timeval time;
  • trunk/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp

    r95511 r101041  
    22 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
     4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    5657#endif
    5758
     59#if PLATFORM(BLACKBERRY)
     60#include <BlackBerryPlatformMisc.h>
     61#include <BlackBerryPlatformSettings.h>
     62#endif
     63
    5864namespace WTF {
    5965
     
    147153}
    148154
     155#if PLATFORM(BLACKBERRY)
     156ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char* threadName)
     157{
     158    pthread_attr_t attr;
     159    if (pthread_attr_init(&attr)) {
     160        LOG_ERROR("pthread_attr_init() failed: %d", errno);
     161        return 0;
     162    }
     163
     164    void* stackAddr;
     165    size_t stackSize;
     166    if (pthread_attr_getstack(&attr, &stackAddr, &stackSize))
     167        LOG_ERROR("pthread_attr_getstack() failed: %d", errno);
     168    else {
     169        stackSize = BlackBerry::Platform::Settings::get()->secondaryThreadStackSize();
     170        if (pthread_attr_setstack(&attr, stackAddr, stackSize))
     171            LOG_ERROR("pthread_attr_getstack() failed: %d", errno);
     172    }
     173
     174    pthread_t threadHandle;
     175    if (pthread_create(&threadHandle, &attr, entryPoint, data)) {
     176        LOG_ERROR("pthread_create() failed: %d", errno);
     177        threadHandle = 0;
     178    }
     179    pthread_setname_np(threadHandle, threadName);
     180
     181    pthread_attr_destroy(&attr);
     182
     183    if (!threadHandle)
     184        return 0;
     185
     186    return establishIdentifierForPthreadHandle(threadHandle);
     187}
     188#else
    149189ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*)
    150190{
     
    157197    return establishIdentifierForPthreadHandle(threadHandle);
    158198}
     199#endif
    159200
    160201void initializeCurrentThreadInternal(const char* threadName)
  • trunk/Source/JavaScriptCore/wtf/text/WTFString.h

    r100510 r101041  
    4747#endif
    4848
     49#if PLATFORM(BLACKBERRY)
     50namespace BlackBerry {
     51namespace WebKit {
     52    class WebString;
     53}
     54}
     55#endif
     56
    4957namespace WTF {
    5058
     
    333341    WTF_EXPORT_PRIVATE String(const wxString&);
    334342    WTF_EXPORT_PRIVATE operator wxString() const;
     343#endif
     344
     345#if PLATFORM(BLACKBERRY)
     346    String(const BlackBerry::WebKit::WebString&);
     347    operator BlackBerry::WebKit::WebString() const;
    335348#endif
    336349
Note: See TracChangeset for help on using the changeset viewer.