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

Side by Side Diff: Source/core/page/Performance.cpp

Issue 23367007: Record the reference time when Performance is constructed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Store monotonic time Created 7 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 | « Source/core/page/Performance.h ('k') | 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 namespace WebCore { 49 namespace WebCore {
50 50
51 static const size_t defaultResourceTimingBufferSize = 150; 51 static const size_t defaultResourceTimingBufferSize = 150;
52 52
53 Performance::Performance(Frame* frame) 53 Performance::Performance(Frame* frame)
54 : DOMWindowProperty(frame) 54 : DOMWindowProperty(frame)
55 , m_resourceTimingBufferSize(defaultResourceTimingBufferSize) 55 , m_resourceTimingBufferSize(defaultResourceTimingBufferSize)
56 , m_userTiming(0) 56 , m_userTiming(0)
57 { 57 {
58 ASSERT(m_frame);
59 ASSERT(m_frame->document());
60 ASSERT(m_frame->document()->loader());
61 ASSERT(m_frame->document()->loader()->timing()->referenceMonotonicTime());
62 m_referenceTime = m_frame->document()->loader()->timing()->referenceMonotoni cTime();
tonyg 2013/08/23 00:01:06 I don't think the asserts are going to teach you a
58 ScriptWrappable::init(this); 63 ScriptWrappable::init(this);
59 } 64 }
60 65
61 Performance::~Performance() 66 Performance::~Performance()
62 { 67 {
63 } 68 }
64 69
65 const AtomicString& Performance::interfaceName() const 70 const AtomicString& Performance::interfaceName() const
66 { 71 {
67 return eventNames().interfaceForPerformance; 72 return eventNames().interfaceForPerformance;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 284
280 void Performance::clearMeasures(const String& measureName) 285 void Performance::clearMeasures(const String& measureName)
281 { 286 {
282 if (!m_userTiming) 287 if (!m_userTiming)
283 m_userTiming = UserTiming::create(this); 288 m_userTiming = UserTiming::create(this);
284 m_userTiming->clearMeasures(measureName); 289 m_userTiming->clearMeasures(measureName);
285 } 290 }
286 291
287 double Performance::now() const 292 double Performance::now() const
288 { 293 {
289 return 1000.0 * m_frame->document()->loader()->timing()->monotonicTimeToZero BasedDocumentTime(monotonicallyIncreasingTime()); 294 return 1000.0 * (monotonicallyIncreasingTime() - m_referenceTime);
290 } 295 }
291 296
292 } // namespace WebCore 297 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Performance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698