RESOLVED FIXED Bug 173972
Avoid copying ResourceLoadStatistics objects
https://bugs.webkit.org/show_bug.cgi?id=173972
Summary Avoid copying ResourceLoadStatistics objects
Chris Dumez
Reported 2017-06-29 09:58:42 PDT
Avoid copying ResourceLoadStatistics objects given that they are big. Make the type move-only to avoid such mistakes in the future.
Attachments
Patch (7.92 KB, patch)
2017-06-29 10:04 PDT, Chris Dumez
no flags
Patch (9.72 KB, patch)
2017-06-29 12:53 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-06-29 10:04:04 PDT
Chris Dumez
Comment 2 2017-06-29 10:05:38 PDT
Comment on attachment 314139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=314139&action=review > Source/WebCore/loader/ResourceLoadObserver.cpp:-155 > - auto targetStatistics = m_store->ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); Note that I stopped calling ensureResourceStatisticsForPrimaryDomain() here. Instead, I merely construct a ResourceLoadStatistics... > Source/WebCore/loader/ResourceLoadObserver.cpp:204 > + m_store->setResourceStatisticsForPrimaryDomain(targetPrimaryDomain, WTFMove(targetStatistics)); ... which gets inserted here. This avoids copying the statistics object and I don't think the call to ensureResourceStatisticsForPrimaryDomain() was really required here.
Geoffrey Garen
Comment 3 2017-06-29 10:26:58 PDT
Comment on attachment 314139 [details] Patch r=me
WebKit Commit Bot
Comment 4 2017-06-29 10:58:33 PDT
Comment on attachment 314139 [details] Patch Clearing flags on attachment: 314139 Committed r218944: <http://trac.webkit.org/changeset/218944>
WebKit Commit Bot
Comment 5 2017-06-29 10:58:35 PDT
All reviewed patches have been landed. Closing bug.
Brent Fulgham
Comment 6 2017-06-29 11:59:13 PDT
Comment on attachment 314139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=314139&action=review >> Source/WebCore/loader/ResourceLoadObserver.cpp:-155 >> - auto targetStatistics = m_store->ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); > > Note that I stopped calling ensureResourceStatisticsForPrimaryDomain() here. Instead, I merely construct a ResourceLoadStatistics... 'ensureResourceStatisticsForPrimaryDomain()' only returned a new ResourceLoadStatistics if it didn't already exist. I think your revised code prevents us from properly counting, because we never retrieve an existing ResourceLoadStatistic object for a domain so that we can update its counts. Looks like we don't have a good test for that behavior!
Chris Dumez
Comment 7 2017-06-29 12:24:56 PDT
Reverted r218944 for reason: Optimization is incorrect Committed r218955: <http://trac.webkit.org/changeset/218955>
Chris Dumez
Comment 8 2017-06-29 12:53:06 PDT
Brent Fulgham
Comment 9 2017-06-29 15:40:22 PDT
Comment on attachment 314154 [details] Patch r=me
WebKit Commit Bot
Comment 10 2017-06-29 16:07:52 PDT
Comment on attachment 314154 [details] Patch Clearing flags on attachment: 314154 Committed r218966: <http://trac.webkit.org/changeset/218966>
WebKit Commit Bot
Comment 11 2017-06-29 16:07:54 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.