Changeset 54592 in webkit


Ignore:
Timestamp:
Feb 10, 2010 2:25:47 AM (14 years ago)
Author:
yurys@chromium.org
Message:

2010-02-10 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Use v8::Debug::ProcessDebugMessages instead of executing an empty function

https://bugs.webkit.org/show_bug.cgi?id=34704

  • src/DebuggerAgent.h:
  • src/DebuggerAgentImpl.cpp: (WebKit::DebuggerAgentImpl::processDebugCommands):
  • src/DebuggerAgentImpl.h:
  • src/ToolsAgent.h:
  • src/WebDevToolsAgentImpl.cpp:
  • src/WebDevToolsAgentImpl.h:
  • src/js/DebuggerAgent.js: (devtools.DebuggerAgent.prototype.addBreakpoint):
  • src/js/DevToolsHostStub.js: (.RemoteDebuggerAgentStub.prototype.processDebugCommands):
  • src/js/InjectDispatch.js: (dispatch):
  • src/js/ProfilerAgent.js: (devtools.ProfilerAgent.prototype.startProfiling): (devtools.ProfilerAgent.prototype.stopProfiling):
  • src/js/Tests.js:
Location:
trunk/WebKit/chromium
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r54589 r54592  
     12010-02-10  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Use v8::Debug::ProcessDebugMessages instead of executing an empty function
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=34704
     8
     9        * src/DebuggerAgent.h:
     10        * src/DebuggerAgentImpl.cpp:
     11        (WebKit::DebuggerAgentImpl::processDebugCommands):
     12        * src/DebuggerAgentImpl.h:
     13        * src/ToolsAgent.h:
     14        * src/WebDevToolsAgentImpl.cpp:
     15        * src/WebDevToolsAgentImpl.h:
     16        * src/js/DebuggerAgent.js:
     17        (devtools.DebuggerAgent.prototype.addBreakpoint):
     18        * src/js/DevToolsHostStub.js:
     19        (.RemoteDebuggerAgentStub.prototype.processDebugCommands):
     20        * src/js/InjectDispatch.js:
     21        (dispatch):
     22        * src/js/ProfilerAgent.js:
     23        (devtools.ProfilerAgent.prototype.startProfiling):
     24        (devtools.ProfilerAgent.prototype.stopProfiling):
     25        * src/js/Tests.js:
     26
    1272010-02-10  Tony Chang  <tony@chromium.org>
    228
  • trunk/WebKit/chromium/src/DebuggerAgent.h

    r54232 r54592  
    3838#define DEBUGGER_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \
    3939    /* Requests global context id of the inspected tab. */ \
    40     METHOD0(getContextId)
     40    METHOD0(getContextId) \
     41    \
     42    /* Request v8 to process all debug commands in the queue. */ \
     43    METHOD0(processDebugCommands)
    4144
    4245DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT)
  • trunk/WebKit/chromium/src/DebuggerAgentImpl.cpp

    r54349 r54592  
    7878{
    7979    m_delegate->setContextId(m_webdevtoolsAgent->hostId());
     80}
     81
     82void DebuggerAgentImpl::processDebugCommands()
     83{
     84    DebuggerAgentManager::UtilityContextScope utilityScope;
     85    v8::Debug::ProcessDebugMessages();
    8086}
    8187
     
    180186}
    181187
    182 void DebuggerAgentImpl::executeVoidJavaScript(v8::Handle<v8::Context> context)
    183 {
    184     v8::HandleScope scope;
    185     ASSERT(!context.IsEmpty());
    186     v8::Context::Scope contextScope(context);
    187     DebuggerAgentManager::UtilityContextScope utilityScope;
    188 
    189     v8::Handle<v8::Value> function =
    190         context->Global()->Get(v8::String::New("devtools$$void"));
    191     ASSERT(function->IsFunction());
    192     v8::Handle<v8::Value> args[] = {
    193         v8::Local<v8::Value>()
    194     };
    195     v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args);
    196 }
    197 
    198188WebCore::Page* DebuggerAgentImpl::page()
    199189{
  • trunk/WebKit/chromium/src/DebuggerAgentImpl.h

    r54232 r54592  
    6363    // DebuggerAgent implementation.
    6464    virtual void getContextId();
     65    virtual void processDebugCommands();
    6566
    6667    void debuggerOutput(const WebCore::String& out);
     
    8283        WebCore::String* exception);
    8384
    84     // Executes a no-op function in the utility context. We don't use
    85     // executeUtilityFunction for that to avoid script evaluation leading to
    86     // undesirable AfterCompile events.
    87     void executeVoidJavaScript(v8::Handle<v8::Context> context);
    8885
    8986    WebCore::Page* page();
  • trunk/WebKit/chromium/src/ToolsAgent.h

    r54232 r54592  
    3939// API for auxiliary UI functions such as dom elements highlighting.
    4040#define TOOLS_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5) \
    41     /* Request the agent to to run a no-op JavaScript function to trigger v8 execution. */ \
    42     METHOD0(executeVoidJavaScript) \
    43     \
    4441    /* Dispatches given function on the InspectorController object */ \
    4542    METHOD3(dispatchOnInspectorController, int /* call_id */, \
  • trunk/WebKit/chromium/src/WebDevToolsAgentImpl.cpp

    r54425 r54592  
    266266}
    267267
    268 void WebDevToolsAgentImpl::executeVoidJavaScript()
    269 {
    270     m_debuggerAgentImpl->executeVoidJavaScript(m_utilityContext);
    271 }
    272 
    273268void WebDevToolsAgentImpl::dispatchMessageFromFrontend(const WebDevToolsMessageData& data)
    274269{
  • trunk/WebKit/chromium/src/WebDevToolsAgentImpl.h

    r54232 r54592  
    7171    virtual void dispatchOnInspectorController(int callId, const WebCore::String& functionName, const WebCore::String& jsonArgs);
    7272    virtual void dispatchOnInjectedScript(int callId, int injectedScriptId, const WebCore::String& functionName, const WebCore::String& jsonArgs, bool async);
    73     virtual void executeVoidJavaScript();
    7473
    7574    // WebDevToolsAgentPrivate implementation.
  • trunk/WebKit/chromium/src/js/DebuggerAgent.js

    r54547 r54592  
    209209    devtools.DebuggerAgent.sendCommand_(cmd);
    210210    // Force v8 execution so that it gets to processing the requested command.
    211     RemoteToolsAgent.executeVoidJavaScript();
     211    RemoteDebuggerAgent.processDebugCommands();
    212212
    213213    this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
     
    291291    // It is necessary for being able to change a breakpoint just after it
    292292    // has been created (since we need an existing breakpoint id for that).
    293     RemoteToolsAgent.executeVoidJavaScript();
     293    RemoteDebuggerAgent.processDebugCommands();
    294294};
    295295
     
    750750        devtools.DebuggerAgent.sendCommand_(cmd);
    751751        // Force v8 execution so that it gets to processing the requested command.
    752         RemoteToolsAgent.executeVoidJavaScript();
     752        RemoteDebuggerAgent.processDebugCommands();
    753753
    754754        var debuggerAgent = this;
  • trunk/WebKit/chromium/src/js/DevToolsHostStub.js

    r54547 r54592  
    5151
    5252
     53RemoteDebuggerAgentStub.prototype.processDebugCommands = function()
     54{
     55};
     56
     57
    5358/**
    5459 * @constructor
     
    8590
    8691RemoteToolsAgentStub.prototype.dispatchOnInspectorController = function()
    87 {
    88 };
    89 
    90 
    91 RemoteToolsAgentStub.prototype.executeVoidJavaScript = function()
    9292{
    9393};
  • trunk/WebKit/chromium/src/js/InjectDispatch.js

    r54547 r54592  
    105105    DevToolsAgentHost.dispatch(call);
    106106};
    107 
    108 /**
    109  * A no-op function that is called by debugger agent just to trigger v8
    110  * execution.
    111  */
    112 function devtools$$void() {
    113 }
  • trunk/WebKit/chromium/src/js/ProfilerAgent.js

    r54547 r54592  
    145145        "command": "resume"});
    146146    devtools.DebuggerAgent.sendCommand_(cmd);
    147     RemoteToolsAgent.executeVoidJavaScript();
     147    RemoteDebuggerAgent.processDebugCommands();
    148148    if (modules & devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT) {
    149149        var pos = this.logPosition_;
     
    163163        "command": "pause"});
    164164    devtools.DebuggerAgent.sendCommand_(cmd);
    165     RemoteToolsAgent.executeVoidJavaScript();
     165    RemoteDebuggerAgent.processDebugCommands();
    166166};
    167167
  • trunk/WebKit/chromium/src/js/Tests.js

    r54547 r54592  
    614614                view._addBreakpoint(breakpointLine);
    615615                // Force v8 execution.
    616                 RemoteToolsAgent.executeVoidJavaScript();
     616                RemoteDebuggerAgent.processDebugCommands();
    617617                test.waitForSetBreakpointResponse_(url, breakpointLine,
    618618                    function() {
     
    870870                  view._addBreakpoint(breakpointLine);
    871871                  // Force v8 execution.
    872                   RemoteToolsAgent.executeVoidJavaScript();
     872                  RemoteDebuggerAgent.processDebugCommands();
    873873                  test.waitForSetBreakpointResponse_(url, breakpointLine, setBreakpointCallback);
    874874              });
Note: See TracChangeset for help on using the changeset viewer.