Changeset 25552 in webkit


Ignore:
Timestamp:
Sep 13, 2007 4:59:35 PM (17 years ago)
Author:
kmccullo
Message:

Reviewed by Tim.

  • Moved isPaused into the JS for efficiency and simplicity.
  • Drosera/DebuggerDocument.cpp: (DebuggerDocument::DebuggerDocument): (DebuggerDocument::pauseCallback): (DebuggerDocument::resumeCallback): (DebuggerDocument::isPaused): (DebuggerDocument::staticFunctions):
  • Drosera/DebuggerDocument.h:
  • Drosera/console.js:
  • Drosera/debugger.js:
  • Drosera/mac/DebuggerClient.mm: (-[DebuggerClient validateUserInterfaceItem:]):
Location:
trunk/WebKitTools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r25544 r25552  
     12007-09-13  Kevin McCullough  <kmccullough@apple.com>
     2
     3        Reviewed by Tim.
     4
     5        - Moved isPaused into the JS for efficiency and simplicity.
     6
     7        * Drosera/DebuggerDocument.cpp:
     8        (DebuggerDocument::DebuggerDocument):
     9        (DebuggerDocument::pauseCallback):
     10        (DebuggerDocument::resumeCallback):
     11        (DebuggerDocument::isPaused):
     12        (DebuggerDocument::staticFunctions):
     13        * Drosera/DebuggerDocument.h:
     14        * Drosera/console.js:
     15        * Drosera/debugger.js:
     16        * Drosera/mac/DebuggerClient.mm:
     17        (-[DebuggerClient validateUserInterfaceItem:]):
     18
    1192007-09-13  Sam Weinig  <sam@webkit.org>
    220
  • trunk/WebKitTools/Drosera/DebuggerDocument.cpp

    r25524 r25552  
    4040
    4141DebuggerDocument::DebuggerDocument(DebuggerClient* debugger)
    42     : m_paused(false)
    43     , m_debuggerClient(debugger)
     42    : m_debuggerClient(debugger)
    4443{
    4544    ASSERT(m_debuggerClient);
     
    8786}
    8887
    89 JSValueRef DebuggerDocument::isPausedCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/)
    90 {
    91     DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
    92     return JSValueMakeBoolean(context, debuggerDocument->m_paused);
    93 }
    94 
    9588JSValueRef DebuggerDocument::pauseCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/)
    9689{
    9790    DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
    9891
    99     debuggerDocument->m_paused = true;
    10092    debuggerDocument->platformPause();
    10193    return JSValueMakeUndefined(context);
     
    10597{
    10698    DebuggerDocument* debuggerDocument = reinterpret_cast<DebuggerDocument*>(JSObjectGetPrivate(thisObject));
    107     debuggerDocument->m_paused = false;
    10899    debuggerDocument->platformResume();
    109100    return JSValueMakeUndefined(context);
     
    202193
    203194//-- These are the calls into the JS. --//   
     195
     196bool DebuggerDocument::isPaused(JSContextRef context) const
     197{
     198    JSObjectRef globalObject = JSContextGetGlobalObject(context);
     199    JSRetainPtr<JSStringRef> string(Adopt, JSStringCreateWithUTF8CString("isPaused"));
     200    JSValueRef objectProperty = JSObjectGetProperty(context, globalObject, string.get(), 0);
     201    return JSValueToBoolean(context, objectProperty);
     202}
    204203
    205204void DebuggerDocument::updateFileSource(JSContextRef context, JSStringRef documentSource, JSStringRef url)
     
    357356        { "currentFunctionStack", DebuggerDocument::currentFunctionStackCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    358357        { "evaluateScript", DebuggerDocument::evaluateScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    359         { "isPaused", DebuggerDocument::isPausedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    360358        { "localScopeVariableNamesForCallFrame", DebuggerDocument::localScopeVariableNamesForCallFrameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    361359        { "pause", DebuggerDocument::pauseCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/Drosera/DebuggerDocument.h

    r25524 r25552  
    5151    DebuggerDocument(DebuggerClient*);
    5252
    53     // These are all calls out of the JS
     53    // These are all calls from the JS
    5454    static JSValueRef breakpointEditorHTMLCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/);
    55     static JSValueRef isPausedCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/);
    5655    static JSValueRef pauseCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/);
    5756    static JSValueRef resumeCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/);
     
    6362    static JSValueRef logCallback(JSContextRef context, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t /*argumentCount*/, const JSValueRef /*arguments*/[], JSValueRef* /*exception*/);
    6463
    65     // Cross-platform functions
     64    // Non Cross-platform functions
    6665    void platformPause();
    6766    void platformResume();
     
    7473
    7574    // These are the calls into the JS.
     75    bool isPaused(JSContextRef) const;
    7676    static void updateFileSource(JSContextRef, JSStringRef documentSource, JSStringRef url);
    7777    static void didParseScript(JSContextRef, JSStringRef source, JSStringRef documentSource, JSStringRef url, JSValueRef sourceId, JSValueRef baseLine);
     
    9090    static JSValueRef callGlobalFunction(JSContextRef, const char* functionName, int argumentCount, JSValueRef arguments[], JSValueRef* exception = 0);   // Implementation for calls into JS
    9191
    92     bool getPaused() const { return m_paused; }
    93 
    9492private:
    9593    static JSValueRef callFunctionOnObject(JSContextRef, JSObjectRef object, const char* functionName, int argumentCount, JSValueRef arguments[], JSValueRef* exception = 0);   // Implementation for calls into JS
     
    10098
    10199    DebuggerClient* m_debuggerClient;   //DebuggerClient owns the DebuggerDocument so don't delete it.  It will delete you!
    102 
    103     bool m_paused;
    104100};
    105101
  • trunk/WebKitTools/Drosera/console.js

    r25394 r25552  
    4444{
    4545    if (event.keyCode == 13 && !event.altKey) {
    46         if (mainWindow.isPaused() && mainWindow.currentStack) {
     46        if (mainWindow.isPaused && mainWindow.currentStack) {
    4747            history[history.length - 1] = inputElement.innerText;
    4848            sendScript(inputElement.innerText);
  • trunk/WebKitTools/Drosera/debugger.js

    r25394 r25552  
    5050var breakpointEditorHTML = DebuggerDocument.breakpointEditorHTML();
    5151var pendingAction = null;
     52var isPaused = false;
    5253
    5354ScriptCallFrame = function (functionName, index, row)
     
    287288}
    288289
    289 function isPaused()
    290 {
    291     return DebuggerDocument.isPaused();
    292 }
    293 
    294290function pause()
    295291{
    296292    DebuggerDocument.pause();
     293    isPaused = true;
    297294}
    298295
     
    318315
    319316    DebuggerDocument.resume();
     317    isPaused = false;
    320318}
    321319
     
    13511349    }
    13521350
    1353     if (isPaused()) {
     1351    if (isPaused) {
    13541352        updateFunctionStack();
    13551353        jumpToLine(sourceId, line);
  • trunk/WebKitTools/Drosera/mac/DebuggerClient.mm

    r25524 r25552  
    365365    SEL action = [interfaceItem action];
    366366    if (action == @selector(pause:)) {
    367         return !debuggerDocument->getPaused();
     367        if (!webViewLoaded)
     368            return NO;
     369
     370        return !debuggerDocument->isPaused([[webView mainFrame] globalContext]);
    368371    }
    369372    if (action == @selector(resume:) ||
     
    371374        action == @selector(stepOut:) ||
    372375        action == @selector(stepInto:)) {
    373         return debuggerDocument->getPaused();
     376        if (!webViewLoaded)
     377            return YES;
     378
     379        return debuggerDocument->isPaused([[webView mainFrame] globalContext]);
    374380    }
    375381    return YES;
Note: See TracChangeset for help on using the changeset viewer.