- Revision
- 218953
- Author
- [email protected]
- Date
- 2017-06-29 12:13:10 -0700 (Thu, 29 Jun 2017)
Log Message
statistics.mostRecentUserInteraction should be of type WallTime
https://bugs.webkit.org/show_bug.cgi?id=173974
Reviewed by Brent Fulgham.
statistics.mostRecentUserInteraction should be of type WallTime for clarity.
Source/WebCore:
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::logUserInteraction):
(WebCore::ResourceLoadObserver::clearUserInteraction):
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::encode):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::ResourceLoadStatistics::toString):
(WebCore::ResourceLoadStatistics::merge):
* loader/ResourceLoadStatistics.h:
(WebCore::ResourceLoadStatistics::mostRecentUserInteractionTime): Deleted.
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::shouldPartitionCookies):
(WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
(WebCore::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
Source/WebKit2:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
(IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (218952 => 218953)
--- trunk/Source/WebCore/ChangeLog 2017-06-29 19:11:37 UTC (rev 218952)
+++ trunk/Source/WebCore/ChangeLog 2017-06-29 19:13:10 UTC (rev 218953)
@@ -1,3 +1,28 @@
+2017-06-29 Chris Dumez <[email protected]>
+
+ statistics.mostRecentUserInteraction should be of type WallTime
+ https://bugs.webkit.org/show_bug.cgi?id=173974
+
+ Reviewed by Brent Fulgham.
+
+ statistics.mostRecentUserInteraction should be of type WallTime for clarity.
+
+ * loader/ResourceLoadObserver.cpp:
+ (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
+ (WebCore::ResourceLoadObserver::logUserInteraction):
+ (WebCore::ResourceLoadObserver::clearUserInteraction):
+ * loader/ResourceLoadStatistics.cpp:
+ (WebCore::ResourceLoadStatistics::encode):
+ (WebCore::ResourceLoadStatistics::decode):
+ (WebCore::ResourceLoadStatistics::toString):
+ (WebCore::ResourceLoadStatistics::merge):
+ * loader/ResourceLoadStatistics.h:
+ (WebCore::ResourceLoadStatistics::mostRecentUserInteractionTime): Deleted.
+ * loader/ResourceLoadStatisticsStore.cpp:
+ (WebCore::shouldPartitionCookies):
+ (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
+ (WebCore::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
+
2017-06-29 JF Bastien <[email protected]>
WebAssembly: disable some APIs under CSP
Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (218952 => 218953)
--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp 2017-06-29 19:11:37 UTC (rev 218952)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp 2017-06-29 19:13:10 UTC (rev 218953)
@@ -43,7 +43,6 @@
#include "SharedBuffer.h"
#include "URL.h"
#include <wtf/CrossThreadCopier.h>
-#include <wtf/CurrentTime.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/WorkQueue.h>
#include <wtf/text/StringBuilder.h>
@@ -357,11 +356,11 @@
auto locker = holdLock(m_store->statisticsLock());
auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomainString);
WallTime newTime = reduceTimeResolution(WallTime::now());
- if (newTime == statistics.mostRecentUserInteractionTime())
+ if (newTime == statistics.mostRecentUserInteractionTime)
return;
statistics.hadUserInteraction = true;
- statistics.mostRecentUserInteraction = newTime.secondsSinceEpoch().value();
+ statistics.mostRecentUserInteractionTime = newTime;
}
m_store->fireDataModificationHandler();
@@ -379,7 +378,7 @@
auto locker = holdLock(m_store->statisticsLock());
auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomainString);
statistics.hadUserInteraction = true;
- statistics.mostRecentUserInteraction = WTF::currentTime();
+ statistics.mostRecentUserInteractionTime = WallTime::now();
}
m_store->fireShouldPartitionCookiesHandler({ primaryDomainString }, { }, false);
@@ -395,7 +394,7 @@
auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
statistics.hadUserInteraction = false;
- statistics.mostRecentUserInteraction = 0;
+ statistics.mostRecentUserInteractionTime = { };
}
bool ResourceLoadObserver::hasHadUserInteraction(const URL& url)
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (218952 => 218953)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2017-06-29 19:11:37 UTC (rev 218952)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2017-06-29 19:13:10 UTC (rev 218953)
@@ -51,7 +51,7 @@
// User interaction
encoder.encodeBool("hadUserInteraction", hadUserInteraction);
- encoder.encodeDouble("mostRecentUserInteraction", mostRecentUserInteraction);
+ encoder.encodeDouble("mostRecentUserInteraction", mostRecentUserInteractionTime.secondsSinceEpoch().value());
encoder.encodeBool("grandfathered", grandfathered);
// Top frame stats
@@ -183,8 +183,10 @@
if (version < 3)
return true;
- if (!decoder.decodeDouble("mostRecentUserInteraction", mostRecentUserInteraction))
+ double mostRecentUserInteractionTimeAsDouble;
+ if (!decoder.decodeDouble("mostRecentUserInteraction", mostRecentUserInteractionTimeAsDouble))
return false;
+ mostRecentUserInteractionTime = WallTime::fromRawSeconds(mostRecentUserInteractionTimeAsDouble);
if (!decoder.decodeBool("grandfathered", grandfathered))
return false;
@@ -226,7 +228,7 @@
appendBoolean(builder, "hadUserInteraction", hadUserInteraction);
builder.append('\n');
builder.appendLiteral(" mostRecentUserInteraction: ");
- builder.appendNumber(mostRecentUserInteraction);
+ builder.appendNumber(mostRecentUserInteractionTime.secondsSinceEpoch().value());
builder.append('\n');
appendBoolean(builder, " grandfathered", grandfathered);
builder.append('\n');
@@ -317,14 +319,14 @@
if (!other.hadUserInteraction) {
// If user interaction has been reset do so here too.
// Else, do nothing.
- if (!other.mostRecentUserInteraction) {
+ if (!other.mostRecentUserInteractionTime) {
hadUserInteraction = false;
- mostRecentUserInteraction = 0;
+ mostRecentUserInteractionTime = { };
}
} else {
hadUserInteraction = true;
- if (mostRecentUserInteraction < other.mostRecentUserInteraction)
- mostRecentUserInteraction = other.mostRecentUserInteraction;
+ if (mostRecentUserInteractionTime < other.mostRecentUserInteractionTime)
+ mostRecentUserInteractionTime = other.mostRecentUserInteractionTime;
}
grandfathered |= other.grandfathered;
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.h (218952 => 218953)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.h 2017-06-29 19:11:37 UTC (rev 218952)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.h 2017-06-29 19:13:10 UTC (rev 218953)
@@ -55,15 +55,12 @@
void merge(const ResourceLoadStatistics&);
- WallTime mostRecentUserInteractionTime() const { return WallTime::fromRawSeconds(mostRecentUserInteraction); }
-
String highLevelDomain;
// User interaction
bool hadUserInteraction { false };
// Timestamp. Default value is negative, 0 means it was reset.
- // FIXME: Can this use WallTime?
- double mostRecentUserInteraction { -1 };
+ WallTime mostRecentUserInteractionTime { WallTime::fromRawSeconds(-1) };
bool grandfathered { false };
// Top frame stats
Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp (218952 => 218953)
--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp 2017-06-29 19:11:37 UTC (rev 218952)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp 2017-06-29 19:13:10 UTC (rev 218953)
@@ -34,7 +34,6 @@
#include "SharedBuffer.h"
#include "URL.h"
#include <wtf/CrossThreadCopier.h>
-#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/RunLoop.h>
@@ -249,8 +248,7 @@
static inline bool shouldPartitionCookies(const ResourceLoadStatistics& statistic)
{
- return statistic.isPrevalentResource
- && (!statistic.hadUserInteraction || WallTime::now() > statistic.mostRecentUserInteractionTime() + timeToLiveCookiePartitionFree);
+ return statistic.isPrevalentResource && (!statistic.hadUserInteraction || WallTime::now() > statistic.mostRecentUserInteractionTime + timeToLiveCookiePartitionFree);
}
void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
@@ -341,11 +339,11 @@
if (!resourceStatistic.hadUserInteraction)
return false;
- if (WallTime::now() > resourceStatistic.mostRecentUserInteractionTime() + timeToLiveUserInteraction) {
+ if (WallTime::now() > resourceStatistic.mostRecentUserInteractionTime + timeToLiveUserInteraction) {
// Drop privacy sensitive data because we no longer need it.
- // Set timestamp to 0.0 so that statistics merge will know
+ // Set timestamp to 0 so that statistics merge will know
// it has been reset as opposed to its default -1.
- resourceStatistic.mostRecentUserInteraction = 0;
+ resourceStatistic.mostRecentUserInteractionTime = { };
resourceStatistic.hadUserInteraction = false;
return false;
@@ -385,7 +383,7 @@
if (!statistic.isPrevalentResource)
continue;
- unsigned daysSinceUserInteraction = statistic.mostRecentUserInteraction <= 0 ? 0 : std::floor((WallTime::now() - statistic.mostRecentUserInteractionTime()) / 24_h);
+ unsigned daysSinceUserInteraction = statistic.mostRecentUserInteractionTime <= WallTime() ? 0 : std::floor((WallTime::now() - statistic.mostRecentUserInteractionTime) / 24_h);
sorted.append(PrevalentResourceTelemetry {
statistic.dataRecordsRemoved,
statistic.hadUserInteraction,
Modified: trunk/Source/WebKit2/ChangeLog (218952 => 218953)
--- trunk/Source/WebKit2/ChangeLog 2017-06-29 19:11:37 UTC (rev 218952)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-29 19:13:10 UTC (rev 218953)
@@ -1,3 +1,16 @@
+2017-06-29 Chris Dumez <[email protected]>
+
+ statistics.mostRecentUserInteraction should be of type WallTime
+ https://bugs.webkit.org/show_bug.cgi?id=173974
+
+ Reviewed by Brent Fulgham.
+
+ statistics.mostRecentUserInteraction should be of type WallTime for clarity.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
+ (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
+
2017-06-29 Wenson Hsieh <[email protected]>
Replace staging-prefixed UIKit drag and drop delegate methods with their public SDK versions
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (218952 => 218953)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2017-06-29 19:11:37 UTC (rev 218952)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2017-06-29 19:13:10 UTC (rev 218953)
@@ -2244,7 +2244,7 @@
// User interaction
encoder << statistics.hadUserInteraction;
- encoder << statistics.mostRecentUserInteraction;
+ encoder << statistics.mostRecentUserInteractionTime.secondsSinceEpoch().value();
encoder << statistics.grandfathered;
// Top frame stats
@@ -2288,8 +2288,10 @@
if (!decoder.decode(statistics.hadUserInteraction))
return false;
- if (!decoder.decode(statistics.mostRecentUserInteraction))
+ double mostRecentUserInteractionTimeAsDouble;
+ if (!decoder.decode(mostRecentUserInteractionTimeAsDouble))
return false;
+ statistics.mostRecentUserInteractionTime = WallTime::fromRawSeconds(mostRecentUserInteractionTimeAsDouble);
if (!decoder.decode(statistics.grandfathered))
return false;