Changeset 166264 in webkit
- Timestamp:
- Mar 25, 2014 3:56:58 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r166261 r166264 1 2014-03-25 Brian Burg <bburg@apple.com> 2 3 Web Replay: resource unique identifiers should be unique-per-frame, not globally 4 https://bugs.webkit.org/show_bug.cgi?id=130632 5 6 Reviewed by Timothy Hatcher. 7 8 For replay purposes, we want to deterministically assign resource load identifiers 9 to resource loaders, provided that the resource loaders are created in the same 10 order. 11 12 To do this, we convert unique identifiers from being globally-unique to being 13 frame-unique. When a new frame is being loaded, unique identifiers for 14 subresources of that frame begin counting from 1. 15 16 No new tests. Identifier invariants are exercised by existing assertions and tests. 17 18 * loader/ProgressTracker.cpp: 19 (WebCore::ProgressTracker::ProgressTracker): 20 (WebCore::ProgressTracker::reset): 21 (WebCore::ProgressTracker::createUniqueIdentifier): 22 * loader/ProgressTracker.h: 23 1 24 2014-03-25 Jer Noble <jer.noble@apple.com> 2 25 -
trunk/Source/WebCore/loader/ProgressTracker.cpp
r165676 r166264 74 74 }; 75 75 76 unsigned long ProgressTracker::s_uniqueIdentifier = 0;77 78 76 ProgressTracker::ProgressTracker(ProgressTrackerClient& client) 79 77 : m_client(client) … … 85 83 , m_finalProgressChangedSent(false) 86 84 , m_progressValue(0) 85 , m_nextUniqueIdentifier(1) 87 86 , m_numProgressTrackedFrames(0) 88 87 , m_progressHeartbeatTimer(this, &ProgressTracker::progressHeartbeatTimerFired) … … 115 114 m_numProgressTrackedFrames = 0; 116 115 m_originatingProgressFrame = 0; 116 // Don't reset m_nextUniqueIdentifier. More loads could start after reset() is called. 117 117 118 118 m_heartbeatsWithNoProgress = 0; … … 295 295 unsigned long ProgressTracker::createUniqueIdentifier() 296 296 { 297 return ++s_uniqueIdentifier;297 return m_nextUniqueIdentifier++; 298 298 } 299 299 -
trunk/Source/WebCore/loader/ProgressTracker.h
r165676 r166264 47 47 ~ProgressTracker(); 48 48 49 staticunsigned long createUniqueIdentifier();49 unsigned long createUniqueIdentifier(); 50 50 51 51 double estimatedProgress() const; … … 69 69 void progressHeartbeatTimerFired(Timer<ProgressTracker>&); 70 70 71 static unsigned long s_uniqueIdentifier;72 73 71 ProgressTrackerClient& m_client; 74 72 long long m_totalPageAndResourceBytesToLoad; … … 81 79 double m_progressValue; 82 80 RefPtr<Frame> m_originatingProgressFrame; 81 unsigned long m_nextUniqueIdentifier; 83 82 84 83 int m_numProgressTrackedFrames; -
trunk/Tools/ChangeLog
r166260 r166264 1 2014-03-25 Brian Burg <bburg@apple.com> 2 3 Web Replay: resource unique identifiers should be unique-per-frame, not globally 4 https://bugs.webkit.org/show_bug.cgi?id=130623 5 6 Reviewed by Timothy Hatcher. 7 8 The resource loader callback dumping routines assumed that resource identifiers 9 were globally unique. Its map of resource identifiers to URLs must also track the 10 frame associated with the resource. 11 12 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: 13 (WTR::dumpResourceURL): Additionally take a WKBundleFrameRef argument, and use the 14 opaque pointer as part of the key for assignedUrlsCache. The frame pointer is 15 stable as long as the frame is valid. 16 (WTR::InjectedBundlePage::didInitiateLoadForResource): 17 (WTR::InjectedBundlePage::willSendRequestForFrame): 18 (WTR::InjectedBundlePage::didReceiveResponseForResource): 19 (WTR::InjectedBundlePage::didFinishLoadForResource): 20 (WTR::InjectedBundlePage::didFailLoadForResource): 21 1 22 2014-03-25 Andy Estes <aestes@apple.com> 2 23 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
r164295 r166264 255 255 } 256 256 257 static HashMap<uint64_t, String> assignedUrlsCache; 258 259 static inline void dumpResourceURL(uint64_t identifier, StringBuilder& stringBuilder) 260 { 261 if (assignedUrlsCache.contains(identifier)) 262 stringBuilder.append(assignedUrlsCache.get(identifier)); 257 static HashMap<std::pair<WKBundleFrameRef, uint64_t>, String> assignedUrlsCache; 258 259 static inline void dumpResourceURL(WKBundleFrameRef frame, uint64_t identifier, StringBuilder& stringBuilder) 260 { 261 std::pair<WKBundleFrameRef, uint64_t> key = std::make_pair(frame, identifier); 262 if (assignedUrlsCache.contains(key)) 263 stringBuilder.append(assignedUrlsCache.get(key)); 263 264 else 264 265 stringBuilder.appendLiteral("<unknown>"); … … 1028 1029 } 1029 1030 1030 void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef page, WKBundleFrameRef , uint64_t identifier, WKURLRequestRef request, bool)1031 void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLRequestRef request, bool) 1031 1032 { 1032 1033 if (!InjectedBundle::shared().isTestRunning()) … … 1034 1035 1035 1036 WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request)); 1036 assignedUrlsCache.add(identifier, pathSuitableForTestResult(url.get())); 1037 auto result = assignedUrlsCache.add(std::make_pair(frame, identifier), pathSuitableForTestResult(url.get())); 1038 // It is a bug in WebCore if multiple resources had the same frame/identifier pair. 1039 ASSERT_UNUSED(result, result.isNewEntry); 1037 1040 } 1038 1041 … … 1054 1057 && InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) { 1055 1058 StringBuilder stringBuilder; 1056 dumpResourceURL( identifier, stringBuilder);1059 dumpResourceURL(frame, identifier, stringBuilder); 1057 1060 stringBuilder.appendLiteral(" - willSendRequest "); 1058 1061 dumpRequestDescriptionSuitableForTestResult(request, stringBuilder); … … 1105 1108 } 1106 1109 1107 void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef page, WKBundleFrameRef , uint64_t identifier, WKURLResponseRef response)1110 void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLResponseRef response) 1108 1111 { 1109 1112 if (!InjectedBundle::shared().isTestRunning()) … … 1112 1115 if (InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) { 1113 1116 StringBuilder stringBuilder; 1114 dumpResourceURL( identifier, stringBuilder);1117 dumpResourceURL(frame, identifier, stringBuilder); 1115 1118 stringBuilder.appendLiteral(" - didReceiveResponse "); 1116 1119 dumpResponseDescriptionSuitableForTestResult(response, stringBuilder); … … 1139 1142 } 1140 1143 1141 void InjectedBundlePage::didFinishLoadForResource(WKBundlePageRef, WKBundleFrameRef , uint64_t identifier)1144 void InjectedBundlePage::didFinishLoadForResource(WKBundlePageRef, WKBundleFrameRef frame, uint64_t identifier) 1142 1145 { 1143 1146 if (!InjectedBundle::shared().isTestRunning()) … … 1148 1151 1149 1152 StringBuilder stringBuilder; 1150 dumpResourceURL( identifier, stringBuilder);1153 dumpResourceURL(frame, identifier, stringBuilder); 1151 1154 stringBuilder.appendLiteral(" - didFinishLoading\n"); 1152 1155 InjectedBundle::shared().outputText(stringBuilder.toString()); 1153 1156 } 1154 1157 1155 void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef , uint64_t identifier, WKErrorRef error)1158 void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef frame, uint64_t identifier, WKErrorRef error) 1156 1159 { 1157 1160 if (!InjectedBundle::shared().isTestRunning()) … … 1162 1165 1163 1166 StringBuilder stringBuilder; 1164 dumpResourceURL( identifier, stringBuilder);1167 dumpResourceURL(frame, identifier, stringBuilder); 1165 1168 stringBuilder.appendLiteral(" - didFailLoadingWithError: "); 1166 1169
Note: See TracChangeset
for help on using the changeset viewer.