Changeset 172532 in webkit


Ignore:
Timestamp:
Aug 13, 2014, 12:43:25 PM (10 years ago)
Author:
dbates@webkit.org
Message:

[iOS] Make JavaScriptCore and bmalloc build with the public SDK
https://bugs.webkit.org/show_bug.cgi?id=135848

Reviewed by Geoffrey Garen.

Source/bmalloc:

  • bmalloc/BPlatform.h: Added macro BPLATFORM_IOS_SIMULATOR, which evaluates to true

when building for the iOS Simulator.

  • bmalloc/PerThread.h: Use pthread_machdep.h code path when building for iOS Simulator

using the public SDK.
(_pthread_setspecific_direct): Added; only defined when building for the iOS Simulator
using the public SDK.
(_pthread_getspecific_direct): Added; only defined when building for the iOS Simulator
using the public SDK.

Source/JavaScriptCore:

  • API/JSBase.h: Declare NSMap functions with external linkage when building for iOS without the

header <Foundation/NSMapTablePriv.h>.

  • inspector/remote/RemoteInspector.mm: Define XPC functions with external linkage when building

without the system header <xpc/xpc.h>.

  • inspector/remote/RemoteInspectorXPCConnection.h: Define xpc_connection_t and xpc_object_t when building

without the system header <xpc/xpc.h>.

  • inspector/remote/RemoteInspectorXPCConnection.mm: Declare XPC functions with external linkage when

building without without the system header <xpc/xpc.h>.
(Inspector::RemoteInspectorXPCConnection::closeOnQueue): Fix code style; use nullptr instead of NULL.
(Inspector::RemoteInspectorXPCConnection::sendMessage): Ditto.

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSBase.h

    r165676 r172532  
    3333#ifdef __OBJC__
    3434#import <Foundation/Foundation.h>
     35
     36#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
     37#if __has_include(<Foundation/NSMapTablePriv.h>)
     38#import <Foundation/NSMapTablePriv.h>
     39#else
     40extern "C" {
     41    void *NSMapGet(NSMapTable *, const void *key);
     42    void NSMapInsert(NSMapTable *, const void *key, const void *value);
     43    void NSMapRemove(NSMapTable *, const void *key);
     44}
    3545#endif
     46#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
     47#endif // __OBJC__
    3648
    3749/* JavaScript engine interface */
  • trunk/Source/JavaScriptCore/ChangeLog

    r172503 r172532  
     12014-08-13  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Make JavaScriptCore and bmalloc build with the public SDK
     4        https://bugs.webkit.org/show_bug.cgi?id=135848
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * API/JSBase.h: Declare NSMap functions with external linkage when building for iOS without the
     9        header <Foundation/NSMapTablePriv.h>.
     10        * inspector/remote/RemoteInspector.mm: Define XPC functions with external linkage when building
     11        without the system header <xpc/xpc.h>.
     12        * inspector/remote/RemoteInspectorXPCConnection.h: Define xpc_connection_t and xpc_object_t when building
     13        without the system header <xpc/xpc.h>.
     14        * inspector/remote/RemoteInspectorXPCConnection.mm: Declare XPC functions with external linkage when
     15        building without without the system header <xpc/xpc.h>.
     16        (Inspector::RemoteInspectorXPCConnection::closeOnQueue): Fix code style; use nullptr instead of NULL.
     17        (Inspector::RemoteInspectorXPCConnection::sendMessage): Ditto.
     18
    1192014-08-12  Peyton Randolph  <prandolph@apple.com>
    220
  • trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm

    r170903 r172532  
    3838#import <wtf/NeverDestroyed.h>
    3939#import <wtf/text/WTFString.h>
     40
     41#if __has_include(<xpc/xpc.h>)
    4042#import <xpc/xpc.h>
     43#else
     44extern "C" {
     45    xpc_connection_t xpc_connection_create_mach_service(const char* name, dispatch_queue_t, uint64_t flags);
     46    void xpc_release(xpc_object_t);
     47}
     48#endif
    4149
    4250#if PLATFORM(IOS)
  • trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h

    r166982 r172532  
    3232#import <mutex>
    3333#import <wtf/ThreadSafeRefCounted.h>
     34
     35#if __has_include(<xpc/xpc.h>)
    3436#import <xpc/xpc.h>
     37#else
     38typedef void* xpc_connection_t;
     39typedef void* xpc_object_t;
     40#endif
    3541
    3642OBJC_CLASS NSDictionary;
  • trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm

    r166982 r172532  
    3333#import <wtf/Ref.h>
    3434
     35#if !__has_include(<xpc/xpc.h>)
     36extern "C" {
     37    typedef void (^xpc_handler_t)(xpc_object_t);
     38    void xpc_connection_cancel(xpc_connection_t);
     39    void xpc_connection_resume(xpc_connection_t);
     40    void xpc_connection_send_message(xpc_connection_t, xpc_object_t message);
     41    void xpc_connection_set_event_handler(xpc_connection_t, xpc_handler_t);
     42    void xpc_connection_set_target_queue(xpc_connection_t, dispatch_queue_t);
     43
     44    xpc_object_t xpc_retain(xpc_object_t);
     45    void xpc_release(xpc_object_t);
     46
     47    typedef void* xpc_type_t;
     48    xpc_type_t xpc_get_type(xpc_object_t);
     49
     50    void* XPC_ERROR_CONNECTION_INVALID;
     51    void* XPC_TYPE_DICTIONARY;
     52    void* XPC_TYPE_ERROR;
     53
     54    xpc_object_t xpc_dictionary_create(const char* const* keys, const xpc_object_t* values, size_t count);
     55    xpc_object_t xpc_dictionary_get_value(xpc_object_t, const char* key);
     56    void xpc_dictionary_set_value(xpc_object_t, const char* key, xpc_object_t value);
     57}
     58#endif
     59
    3560#if __has_include(<CoreFoundation/CFXPCBridge.h>)
    3661#import <CoreFoundation/CFXPCBridge.h>
    3762#else
    38 extern "C" xpc_object_t _CFXPCCreateXPCMessageWithCFObject(CFTypeRef);
    39 extern "C" CFTypeRef _CFXPCCreateCFObjectFromXPCMessage(xpc_object_t);
     63extern "C" {
     64    xpc_object_t _CFXPCCreateXPCMessageWithCFObject(CFTypeRef);
     65    CFTypeRef _CFXPCCreateCFObjectFromXPCMessage(xpc_object_t);
     66}
    4067#endif
    4168
     
    97124        xpc_connection_cancel(m_connection);
    98125        xpc_release(m_connection);
    99         m_connection = NULL;
     126        m_connection = nullptr;
    100127    }
    101128
    102129    if (m_queue) {
    103130        dispatch_release(m_queue);
    104         m_queue = NULL;
     131        m_queue = nullptr;
    105132    }
    106133}
     
    171198        return;
    172199
    173     xpc_object_t msg = xpc_dictionary_create(NULL, NULL, 0);
     200    xpc_object_t msg = xpc_dictionary_create(nullptr, nullptr, 0);
    174201    xpc_dictionary_set_value(msg, RemoteInspectorXPCConnectionSerializedMessageKey, xpcDictionary);
    175202    xpc_release(xpcDictionary);
  • trunk/Source/bmalloc/ChangeLog

    r172510 r172532  
     12014-08-13  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Make JavaScriptCore and bmalloc build with the public SDK
     4        https://bugs.webkit.org/show_bug.cgi?id=135848
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * bmalloc/BPlatform.h: Added macro BPLATFORM_IOS_SIMULATOR, which evaluates to true
     9        when building for the iOS Simulator.
     10        * bmalloc/PerThread.h: Use pthread_machdep.h code path when building for iOS Simulator
     11        using the public SDK.
     12        (_pthread_setspecific_direct): Added; only defined when building for the iOS Simulator
     13        using the public SDK.
     14        (_pthread_getspecific_direct): Added; only defined when building for the iOS Simulator
     15        using the public SDK.
     16
    1172014-08-12  Daniel Bates  <dabates@apple.com>
    218
  • trunk/Source/bmalloc/bmalloc/BPlatform.h

    r172510 r172532  
    3939#endif
    4040
     41#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
     42#define BPLATFORM_IOS_SIMULATOR 1
     43#endif
     44
    4145#endif // BPlatform_h
  • trunk/Source/bmalloc/bmalloc/PerThread.h

    r166956 r172532  
    2727#define PerThread_h
    2828
     29#include "BPlatform.h"
    2930#include "Inline.h"
    3031#include <mutex>
     
    3233#if defined(__has_include) && __has_include(<System/pthread_machdep.h>)
    3334#include <System/pthread_machdep.h>
     35#elif BPLATFORM(IOS_SIMULATOR)
     36// FIXME: We shouldn't hardcode this constant as it can become out-of-date with the macro define of the same
     37// name in System/pthread_machdep.h. Instead, we should make PerThread work without C++ thread local storage.
     38// See <https://bugs.webkit.org/show_bug.cgi?id=135895> for more details.
     39const pthread_key_t __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 = 90;
     40
     41INLINE int _pthread_setspecific_direct(pthread_key_t key, const void* value) { return pthread_setspecific(key, value); }
     42INLINE void* _pthread_getspecific_direct(pthread_key_t key) { return pthread_getspecific(key); }
     43extern "C" int pthread_key_init_np(int, void (*destructor)(void*));
    3444#endif
    3545
     
    5464template<typename T> struct PerThreadStorage;
    5565
    56 #if defined(__has_include) && __has_include(<System/pthread_machdep.h>)
    57 
     66#if (defined(__has_include) && __has_include(<System/pthread_machdep.h>)) || BPLATFORM(IOS_SIMULATOR)
    5867// For now, we only support PerThread<Cache>. We can expand to other types by
    5968// using more keys.
     
    91100template<typename T> std::once_flag PerThreadStorage<T>::onceFlag;
    92101
    93 #endif // defined(__has_include) && __has_include(<System/pthread_machdep.h>)
     102#endif // (defined(__has_include) && __has_include(<System/pthread_machdep.h>)) || BPLATFORM(IOS_SIMULATOR)
    94103
    95104template<typename T>
Note: See TracChangeset for help on using the changeset viewer.