Ignore:
Timestamp:
Jun 30, 2014, 10:57:39 AM (11 years ago)
Author:
Joseph Pecoraro
Message:

JSContext Inspection: Provide a way to use a non-Main RunLoop for Inspector JavaScript Evaluations
https://bugs.webkit.org/show_bug.cgi?id=134371

Reviewed by Timothy Hatcher.

  • API/JSContextPrivate.h:
  • API/JSContext.mm:

(-[JSContext _debuggerRunLoop]):
(-[JSContext _setDebuggerRunLoop:]):
Private API for setting the CFRunLoop for a debugger to evaluate in.

  • API/JSContextRefInternal.h: Added.
  • API/JSContextRef.cpp:

(JSGlobalContextGetDebuggerRunLoop):
(JSGlobalContextSetDebuggerRunLoop):
Internal API for setting a CFRunLoop on a JSContextRef.
Set this on the debuggable.

  • inspector/remote/RemoteInspectorDebuggable.h:
  • inspector/remote/RemoteInspectorDebuggableConnection.h:

(Inspector::RemoteInspectorBlock::RemoteInspectorBlock):
(Inspector::RemoteInspectorBlock::~RemoteInspectorBlock):
(Inspector::RemoteInspectorBlock::operator=):
(Inspector::RemoteInspectorBlock::operator()):
Moved into the header.

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::inspectorDebuggable):
Lets store the RunLoop on the debuggable instead of this core
platform agnostic class, so expose the debuggable.

  • inspector/remote/RemoteInspectorDebuggableConnection.mm:

(Inspector::RemoteInspectorHandleRunSourceGlobal):
(Inspector::RemoteInspectorQueueTaskOnGlobalQueue):
(Inspector::RemoteInspectorInitializeGlobalQueue):
Rename the global functions for clarity.

(Inspector::RemoteInspectorHandleRunSourceWithInfo):
Handler for private run loops.

(Inspector::RemoteInspectorDebuggableConnection::RemoteInspectorDebuggableConnection):
(Inspector::RemoteInspectorDebuggableConnection::~RemoteInspectorDebuggableConnection):
(Inspector::RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::setupRunLoop):
(Inspector::RemoteInspectorDebuggableConnection::teardownRunLoop):
(Inspector::RemoteInspectorDebuggableConnection::queueTaskOnPrivateRunLoop):
Setup and teardown and use private run loop sources if the debuggable needs it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSContextRef.cpp

    r169139 r170589  
    2626#include "config.h"
    2727#include "JSContextRef.h"
    28 #include "JSContextRefPrivate.h"
     28#include "JSContextRefInternal.h"
    2929
    3030#include "APICast.h"
     
    4242
    4343#if ENABLE(REMOTE_INSPECTOR)
     44#include "JSGlobalObjectDebuggable.h"
    4445#include "JSGlobalObjectInspectorController.h"
    4546#endif
     
    368369}
    369370
     371#if USE(CF)
     372CFRunLoopRef JSGlobalContextGetDebuggerRunLoop(JSGlobalContextRef ctx)
     373{
     374#if ENABLE(REMOTE_INSPECTOR)
     375    if (!ctx) {
     376        ASSERT_NOT_REACHED();
     377        return nullptr;
     378    }
     379
     380    ExecState* exec = toJS(ctx);
     381    JSLockHolder lock(exec);
     382
     383    return exec->vmEntryGlobalObject()->inspectorDebuggable().debuggerRunLoop();
     384#else
     385    UNUSED_PARAM(ctx);
     386    return nullptr;
     387#endif
     388}
     389
     390void JSGlobalContextSetDebuggerRunLoop(JSGlobalContextRef ctx, CFRunLoopRef runLoop)
     391{
     392#if ENABLE(REMOTE_INSPECTOR)
     393    if (!ctx) {
     394        ASSERT_NOT_REACHED();
     395        return;
     396    }
     397
     398    ExecState* exec = toJS(ctx);
     399    JSLockHolder lock(exec);
     400
     401    exec->vmEntryGlobalObject()->inspectorDebuggable().setDebuggerRunLoop(runLoop);
     402#else
     403    UNUSED_PARAM(ctx);
     404    UNUSED_PARAM(runLoop);
     405#endif
     406}
     407#endif
Note: See TracChangeset for help on using the changeset viewer.