|
Lines 48-54
template<typename T> static inline Strin
Source/WebCore/loader/ResourceLoadObserver.cpp_sec1
|
| 48 |
return ResourceLoadStatistics::primaryDomain(value); |
48 |
return ResourceLoadStatistics::primaryDomain(value); |
| 49 |
} |
49 |
} |
| 50 |
|
50 |
|
| 51 |
static Seconds timestampResolution { 1_h }; |
51 |
static Seconds timestampResolution { 5_s }; |
| 52 |
static const Seconds minimumNotificationInterval { 5_s }; |
52 |
static const Seconds minimumNotificationInterval { 5_s }; |
| 53 |
|
53 |
|
| 54 |
ResourceLoadObserver& ResourceLoadObserver::shared() |
54 |
ResourceLoadObserver& ResourceLoadObserver::shared() |
|
Lines 127-133
bool ResourceLoadObserver::shouldLog(Pag
Source/WebCore/loader/ResourceLoadObserver.cpp_sec2
|
| 127 |
return DeprecatedGlobalSettings::resourceLoadStatisticsEnabled() && !page->usesEphemeralSession() && m_notificationCallback; |
127 |
return DeprecatedGlobalSettings::resourceLoadStatisticsEnabled() && !page->usesEphemeralSession() && m_notificationCallback; |
| 128 |
} |
128 |
} |
| 129 |
|
129 |
|
| 130 |
static WallTime reduceToHourlyTimeResolution(WallTime time) |
130 |
static WallTime reduceTimeResolution(WallTime time) |
| 131 |
{ |
131 |
{ |
| 132 |
return WallTime::fromRawSeconds(std::floor(time.secondsSinceEpoch() / timestampResolution) * timestampResolution.seconds()); |
132 |
return WallTime::fromRawSeconds(std::floor(time.secondsSinceEpoch() / timestampResolution) * timestampResolution.seconds()); |
| 133 |
} |
133 |
} |
|
Lines 170-176
void ResourceLoadObserver::logFrameNavig
Source/WebCore/loader/ResourceLoadObserver.cpp_sec3
|
| 170 |
if (targetHost != mainFrameHost |
170 |
if (targetHost != mainFrameHost |
| 171 |
&& !(areDomainsAssociated(page, targetPrimaryDomain, mainFramePrimaryDomain) || areDomainsAssociated(page, targetPrimaryDomain, sourcePrimaryDomain))) { |
171 |
&& !(areDomainsAssociated(page, targetPrimaryDomain, mainFramePrimaryDomain) || areDomainsAssociated(page, targetPrimaryDomain, sourcePrimaryDomain))) { |
| 172 |
auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); |
172 |
auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); |
| 173 |
targetStatistics.lastSeen = reduceToHourlyTimeResolution(WallTime::now()); |
173 |
targetStatistics.lastSeen = reduceTimeResolution(WallTime::now()); |
| 174 |
if (targetStatistics.subframeUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) |
174 |
if (targetStatistics.subframeUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) |
| 175 |
shouldCallNotificationCallback = true; |
175 |
shouldCallNotificationCallback = true; |
| 176 |
} |
176 |
} |
|
Lines 227-233
void ResourceLoadObserver::logSubresourc
Source/WebCore/loader/ResourceLoadObserver.cpp_sec4
|
| 227 |
bool shouldCallNotificationCallback = false; |
227 |
bool shouldCallNotificationCallback = false; |
| 228 |
{ |
228 |
{ |
| 229 |
auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); |
229 |
auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); |
| 230 |
targetStatistics.lastSeen = reduceToHourlyTimeResolution(WallTime::now()); |
230 |
targetStatistics.lastSeen = reduceTimeResolution(WallTime::now()); |
| 231 |
if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) |
231 |
if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) |
| 232 |
shouldCallNotificationCallback = true; |
232 |
shouldCallNotificationCallback = true; |
| 233 |
} |
233 |
} |
|
Lines 268-274
void ResourceLoadObserver::logWebSocketL
Source/WebCore/loader/ResourceLoadObserver.cpp_sec5
|
| 268 |
return; |
268 |
return; |
| 269 |
|
269 |
|
| 270 |
auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); |
270 |
auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); |
| 271 |
targetStatistics.lastSeen = reduceToHourlyTimeResolution(WallTime::now()); |
271 |
targetStatistics.lastSeen = reduceTimeResolution(WallTime::now()); |
| 272 |
if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) |
272 |
if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) |
| 273 |
scheduleNotificationIfNeeded(); |
273 |
scheduleNotificationIfNeeded(); |
| 274 |
} |
274 |
} |
|
Lines 285-291
void ResourceLoadObserver::logUserIntera
Source/WebCore/loader/ResourceLoadObserver.cpp_sec6
|
| 285 |
return; |
285 |
return; |
| 286 |
|
286 |
|
| 287 |
auto domain = primaryDomain(url); |
287 |
auto domain = primaryDomain(url); |
| 288 |
auto newTime = reduceToHourlyTimeResolution(WallTime::now()); |
288 |
auto newTime = reduceTimeResolution(WallTime::now()); |
| 289 |
auto lastReportedUserInteraction = m_lastReportedUserInteractionMap.get(domain); |
289 |
auto lastReportedUserInteraction = m_lastReportedUserInteractionMap.get(domain); |
| 290 |
if (newTime == lastReportedUserInteraction) |
290 |
if (newTime == lastReportedUserInteraction) |
| 291 |
return; |
291 |
return; |