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

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

Issue 1287513003: Handle Performance object creation on loader-less Documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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/Performance.cpp
diff --git a/Source/core/timing/Performance.cpp b/Source/core/timing/Performance.cpp
index 172865ee04fb13f9b485184dbafec4db54e783e3..e500be09c8599de11e7fae706950801682e22d19 100644
--- a/Source/core/timing/Performance.cpp
+++ b/Source/core/timing/Performance.cpp
@@ -39,8 +39,24 @@
namespace blink {
+static double toTimeOrigin(LocalFrame* frame)
+{
+ if (!frame)
+ return 0.0;
+
+ Document* document = frame->document();
+ if (!document)
+ return 0.0;
+
+ DocumentLoader* loader = document->loader();
+ if (!loader)
+ return 0.0;
+
+ return loader->timing().referenceMonotonicTime();
+}
+
Performance::Performance(LocalFrame* frame)
- : PerformanceBase(frame && frame->host() ? frame->document()->loader()->timing().referenceMonotonicTime() : 0.0)
+ : PerformanceBase(toTimeOrigin(frame))
, DOMWindowProperty(frame)
{
}
« 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