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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 21 matching lines...) Expand all
32 #include "config.h" 32 #include "config.h"
33 #include "core/timing/Performance.h" 33 #include "core/timing/Performance.h"
34 34
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
37 #include "core/loader/DocumentLoader.h" 37 #include "core/loader/DocumentLoader.h"
38 #include "core/timing/PerformanceTiming.h" 38 #include "core/timing/PerformanceTiming.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 static double toTimeOrigin(LocalFrame* frame)
43 {
44 if (!frame)
45 return 0.0;
46
47 Document* document = frame->document();
48 if (!document)
49 return 0.0;
50
51 DocumentLoader* loader = document->loader();
52 if (!loader)
53 return 0.0;
54
55 return loader->timing().referenceMonotonicTime();
56 }
57
42 Performance::Performance(LocalFrame* frame) 58 Performance::Performance(LocalFrame* frame)
43 : PerformanceBase(frame && frame->host() ? frame->document()->loader()->timi ng().referenceMonotonicTime() : 0.0) 59 : PerformanceBase(toTimeOrigin(frame))
44 , DOMWindowProperty(frame) 60 , DOMWindowProperty(frame)
45 { 61 {
46 } 62 }
47 63
48 Performance::~Performance() 64 Performance::~Performance()
49 { 65 {
50 } 66 }
51 67
52 ExecutionContext* Performance::executionContext() const 68 ExecutionContext* Performance::executionContext() const
53 { 69 {
(...skipping 25 matching lines...) Expand all
79 95
80 DEFINE_TRACE(Performance) 96 DEFINE_TRACE(Performance)
81 { 97 {
82 visitor->trace(m_navigation); 98 visitor->trace(m_navigation);
83 visitor->trace(m_timing); 99 visitor->trace(m_timing);
84 DOMWindowProperty::trace(visitor); 100 DOMWindowProperty::trace(visitor);
85 PerformanceBase::trace(visitor); 101 PerformanceBase::trace(visitor);
86 } 102 }
87 103
88 } // namespace blink 104 } // namespace blink
OLDNEW
« 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