Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7799)

Unified Diff: Source/core/timing/MemoryInfo.cpp

Issue 893803003: Ensure that performance.memory is updated on first access. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/timing/MemoryInfo.cpp
diff --git a/Source/core/timing/MemoryInfo.cpp b/Source/core/timing/MemoryInfo.cpp
index d5466ee33fa0f79995d904e942063074d994c33c..e0b28c6ca85c412077d134fd6eb9a3ae7b31a0e9 100644
--- a/Source/core/timing/MemoryInfo.cpp
+++ b/Source/core/timing/MemoryInfo.cpp
@@ -42,11 +42,13 @@
namespace blink {
+static const double TwentyMinutesInSeconds = 20 * 60;
+
class HeapSizeCache {
WTF_MAKE_NONCOPYABLE(HeapSizeCache); WTF_MAKE_FAST_ALLOCATED;
public:
HeapSizeCache()
- : m_lastUpdateTime(0)
+ : m_lastUpdateTime(monotonicallyIncreasingTime() - TwentyMinutesInSeconds)
{
}
@@ -67,8 +69,6 @@ private:
{
// We rate-limit queries to once every twenty minutes to make it more difficult
// for attackers to compare memory usage before and after some event.
- const double TwentyMinutesInSeconds = 20 * 60;
-
double now = monotonicallyIncreasingTime();
if (now - m_lastUpdateTime >= TwentyMinutesInSeconds) {
update();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698