Ignore:
Timestamp:
Nov 22, 2011, 7:30:34 PM (14 years ago)
Author:
[email protected]
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp

    r95511 r101041  
    22 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007 Justin Haygood ([email protected])
     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)
Note: See TracChangeset for help on using the changeset viewer.