Changeset 88940 in webkit
- Timestamp:
- Jun 15, 2011 8:44:00 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r88939 r88940 1 2011-06-15 Andrey Kosyakov <caseq@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: provide unique identifiers for frames 6 https://bugs.webkit.org/show_bug.cgi?id=62721 7 8 * inspector/InspectorInstrumentation.cpp: 9 (WebCore::InspectorInstrumentation::frameDestroyedImpl): 10 * inspector/InspectorInstrumentation.h: 11 (WebCore::InspectorInstrumentation::frameDestroyed): 12 * inspector/InspectorPageAgent.cpp: 13 (WebCore::InspectorPageAgent::frameForId): 14 (WebCore::InspectorPageAgent::frameId): 15 (WebCore::InspectorPageAgent::frameDestroyed): 16 * inspector/InspectorPageAgent.h: 17 * page/Frame.cpp: 18 (WebCore::Frame::~Frame): 19 1 20 2011-06-15 Andrey Kosyakov <caseq@chromium.org> 2 21 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r88937 r88940 631 631 } 632 632 633 void InspectorInstrumentation::frameDestroyedImpl(InstrumentingAgents* instrumentingAgents, Frame* frame) 634 { 635 if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent()) 636 inspectorPageAgent->frameDestroyed(frame); 637 } 638 633 639 InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InstrumentingAgents* instrumentingAgents, unsigned int length, unsigned int startLine) 634 640 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r88937 r88940 137 137 static void frameDetachedFromParent(Frame*); 138 138 static void didCommitLoad(Frame*, DocumentLoader*); 139 static void frameDestroyed(Frame*); 139 140 140 141 static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine); … … 264 265 static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*); 265 266 static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*); 267 static void frameDestroyedImpl(InstrumentingAgents*, Frame*); 266 268 267 269 static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned int length, unsigned int startLine); … … 854 856 } 855 857 858 inline void InspectorInstrumentation::frameDestroyed(Frame* frame) 859 { 860 #if ENABLE(INSPECTOR) 861 Page* page = frame->page(); 862 if (!page) 863 return; 864 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) 865 frameDestroyedImpl(instrumentingAgents, frame); 866 #endif 867 } 868 856 869 inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned int length, unsigned int startLine) 857 870 { -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r86760 r88940 70 70 // This should be kept the same as the one in front-end/utilities.js 71 71 static const char regexSpecialCharacters[] = "[](){}+-*.,?\\^$|"; 72 static unsigned int s_lastFrameIdentifier = 0; 72 73 } 73 74 … … 563 564 Frame* InspectorPageAgent::frameForId(const String& frameId) 564 565 { 565 Frame* mainFrame = m_page->mainFrame(); 566 for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext(mainFrame)) { 567 if (pointerAsId(frame) == frameId) 568 return frame; 569 } 570 return 0; 566 bool ok = false; 567 unsigned int identifier = frameId.toUIntStrict(&ok); 568 if (!ok || !identifier) 569 return 0; 570 return m_identifierToFrame.get(identifier); 571 571 } 572 572 573 573 String InspectorPageAgent::frameId(Frame* frame) 574 574 { 575 return pointerAsId(frame); 575 if (!frame) 576 return ""; 577 unsigned int identifier = m_frameToIdentifier.get(frame); 578 if (!identifier) { 579 identifier = ++s_lastFrameIdentifier; 580 m_frameToIdentifier.set(frame, identifier); 581 m_identifierToFrame.set(identifier, frame); 582 } 583 return String::number(identifier); 576 584 } 577 585 … … 579 587 { 580 588 return pointerAsId(loader); 589 } 590 591 void InspectorPageAgent::frameDestroyed(Frame* frame) 592 { 593 HashMap<Frame*, unsigned int>::iterator iterator = m_frameToIdentifier.find(frame); 594 if (iterator != m_frameToIdentifier.end()) { 595 m_identifierToFrame.remove(iterator->second); 596 m_frameToIdentifier.remove(iterator); 597 } 581 598 } 582 599 -
trunk/Source/WebCore/inspector/InspectorPageAgent.h
r86562 r88940 34 34 #if ENABLE(INSPECTOR) 35 35 36 #include "Frame.h" 36 37 #include "InspectorFrontend.h" 37 38 #include "PlatformString.h" 39 #include <wtf/HashMap.h> 38 40 #include <wtf/RefCounted.h> 39 41 #include <wtf/Vector.h> … … 99 101 void frameNavigated(DocumentLoader*); 100 102 void frameDetached(Frame*); 103 void frameDestroyed(Frame*); 101 104 102 105 // Inspector Controller API … … 121 124 InspectorFrontend::Page* m_frontend; 122 125 Vector<String> m_scriptsToEvaluateOnLoad; 126 HashMap<Frame*, unsigned int> m_frameToIdentifier; 127 HashMap<unsigned int, Frame*> m_identifierToFrame; 123 128 }; 124 129 -
trunk/Source/WebCore/page/Frame.cpp
r88737 r88940 58 58 #include "HTMLTableCellElement.h" 59 59 #include "HitTestResult.h" 60 #include "InspectorInstrumentation.h" 60 61 #include "Logging.h" 61 62 #include "MediaFeatureNames.h" … … 238 239 for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it) 239 240 (*it)->frameDestroyed(); 241 242 InspectorInstrumentation::frameDestroyed(this); 240 243 241 244 if (m_view) {
Note: See TracChangeset
for help on using the changeset viewer.