Changeset 90017 in webkit


Ignore:
Timestamp:
Jun 29, 2011 7:38:06 AM (13 years ago)
Author:
caseq@chromium.org
Message:

2011-06-29 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: backend needs to provide system-unique object ids, so these remain unique across navigation
https://bugs.webkit.org/show_bug.cgi?id=62894

  • inspector/InspectorController.cpp: (WebCore::InspectorController::setAgentProcessIdentifier):
  • inspector/InspectorController.h:
  • inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::setAgentIdentifier): (WebCore::InspectorPageAgent::createIdentifier): (WebCore::InspectorPageAgent::frameForId): (WebCore::InspectorPageAgent::frameId): (WebCore::InspectorPageAgent::frameDestroyed):
  • inspector/InspectorPageAgent.h:

2011-06-29 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: backend needs to provide system-unique object ids, so these remain unique across navigation
https://bugs.webkit.org/show_bug.cgi?id=62894

  • public/WebDevToolsAgent.h:
  • src/WebDevToolsAgentImpl.cpp: (WebKit::WebDevToolsAgentImpl::setAgentProcessIdentifier):
  • src/WebDevToolsAgentImpl.h:
Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90014 r90017  
     12011-06-29  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: backend needs to provide system-unique object ids, so these remain unique across navigation
     6        https://bugs.webkit.org/show_bug.cgi?id=62894
     7
     8        * inspector/InspectorController.cpp:
     9        (WebCore::InspectorController::setAgentProcessIdentifier):
     10        * inspector/InspectorController.h:
     11        * inspector/InspectorPageAgent.cpp:
     12        (WebCore::InspectorPageAgent::setAgentIdentifier):
     13        (WebCore::InspectorPageAgent::createIdentifier):
     14        (WebCore::InspectorPageAgent::frameForId):
     15        (WebCore::InspectorPageAgent::frameId):
     16        (WebCore::InspectorPageAgent::frameDestroyed):
     17        * inspector/InspectorPageAgent.h:
     18
    1192011-06-29  Pavel Feldman  <pfeldman@google.com>
    220
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r89652 r90017  
    350350}
    351351
     352void InspectorController::setAgentIdentifierPrefix(const String& prefix)
     353{
     354    m_pageAgent->setAgentIdentifierPrefix(prefix);
     355}
     356
    352357void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
    353358{
  • trunk/Source/WebCore/inspector/InspectorController.h

    r86564 r90017  
    9494    void disconnectFrontend();
    9595    void restoreInspectorStateFromCookie(const String& inspectorCookie);
     96    void setAgentIdentifierPrefix(const String&);
    9697
    9798    void showConsole();
  • trunk/Source/WebCore/inspector/InspectorPageAgent.cpp

    r89449 r90017  
    7070// This should be kept the same as the one in front-end/utilities.js
    7171static const char regexSpecialCharacters[] = "[](){}+-*.,?\\^$|";
    72 static unsigned int s_lastFrameIdentifier = 0;
     72static unsigned int s_lastUsedIdentifier = 0;
    7373}
    7474
     
    281281    m_instrumentingAgents->setInspectorPageAgent(0);
    282282    m_frontend = 0;
     283}
     284
     285void InspectorPageAgent::setAgentIdentifierPrefix(const String& prefix)
     286{
     287    m_agentIdentifierPrefix = prefix.isEmpty() ? String("") : prefix + ".";
    283288}
    284289
     
    561566}
    562567
     568String InspectorPageAgent::createIdentifier()
     569{
     570    return m_agentIdentifierPrefix + String::number(++s_lastUsedIdentifier);
     571}
     572
    563573Frame* InspectorPageAgent::frameForId(const String& frameId)
    564574{
    565     bool ok = false;
    566     unsigned int identifier = frameId.toUIntStrict(&ok);
    567     if (!ok || !identifier)
    568         return 0;
    569     return m_identifierToFrame.get(identifier);
     575    return frameId.isEmpty() ? 0 : m_identifierToFrame.get(frameId);
    570576}
    571577
     
    574580    if (!frame)
    575581        return "";
    576     unsigned int identifier = m_frameToIdentifier.get(frame);
    577     if (!identifier) {
    578         identifier = ++s_lastFrameIdentifier;
     582    String identifier = m_frameToIdentifier.get(frame);
     583    if (identifier.isNull()) {
     584        identifier = createIdentifier();
    579585        m_frameToIdentifier.set(frame, identifier);
    580586        m_identifierToFrame.set(identifier, frame);
    581587    }
    582     return String::number(identifier);
     588    return identifier;
    583589}
    584590
     
    590596void InspectorPageAgent::frameDestroyed(Frame* frame)
    591597{
    592     HashMap<Frame*, unsigned int>::iterator iterator = m_frameToIdentifier.find(frame);
     598    HashMap<Frame*, String>::iterator iterator = m_frameToIdentifier.find(frame);
    593599    if (iterator != m_frameToIdentifier.end()) {
    594600        m_identifierToFrame.remove(iterator->second);
  • trunk/Source/WebCore/inspector/InspectorPageAgent.h

    r89449 r90017  
    108108    void setFrontend(InspectorFrontend*);
    109109    void clearFrontend();
     110    void setAgentIdentifierPrefix(const String&);
    110111
    111112    // Cross-agents API
     
    118119    InspectorPageAgent(InstrumentingAgents*, Page*, InjectedScriptManager*);
    119120
     121    String createIdentifier();
     122
    120123    PassRefPtr<InspectorObject> buildObjectForFrame(Frame*);
    121124    PassRefPtr<InspectorObject> buildObjectForFrameTree(Frame*);
     
    125128    InjectedScriptManager* m_injectedScriptManager;
    126129    InspectorFrontend::Page* m_frontend;
     130    String m_agentIdentifierPrefix;
    127131    Vector<String> m_scriptsToEvaluateOnLoad;
    128     HashMap<Frame*, unsigned int> m_frameToIdentifier;
    129     HashMap<unsigned int, Frame*> m_identifierToFrame;
     132    HashMap<Frame*, String> m_frameToIdentifier;
     133    HashMap<String, Frame*> m_identifierToFrame;
    130134};
    131135
  • trunk/Source/WebKit/chromium/ChangeLog

    r89991 r90017  
     12011-06-29  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: backend needs to provide system-unique object ids, so these remain unique across navigation
     6        https://bugs.webkit.org/show_bug.cgi?id=62894
     7
     8        * public/WebDevToolsAgent.h:
     9        * src/WebDevToolsAgentImpl.cpp:
     10        (WebKit::WebDevToolsAgentImpl::setAgentProcessIdentifier):
     11        * src/WebDevToolsAgentImpl.h:
     12
    1132011-06-28  Ilya Sherman  <isherman@chromium.org>
    214
  • trunk/Source/WebKit/chromium/public/WebDevToolsAgent.h

    r89252 r90017  
    6060    virtual void inspectElementAt(const WebPoint&) = 0;
    6161    virtual void setRuntimeProperty(const WebString& name, const WebString& value) = 0;
     62    virtual void setAgentIdentifierPrefix(const WebString&) = 0;
    6263
    6364    // Exposed for LayoutTestController.
  • trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp

    r89252 r90017  
    307307}
    308308
     309void WebDevToolsAgentImpl::setAgentIdentifierPrefix(const WebString& prefix)
     310{
     311    inspectorController()->setAgentIdentifierPrefix(prefix);
     312}
     313
    309314void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script)
    310315{
  • trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h

    r89252 r90017  
    8282    virtual void setJavaScriptProfilingEnabled(bool);
    8383    virtual void setRuntimeProperty(const WebString& name, const WebString& value);
     84    virtual void setAgentIdentifierPrefix(const WebString&);
    8485
    8586    // InspectorClient implementation.
Note: See TracChangeset for help on using the changeset viewer.