OLD | NEW |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/page/Frame.h" | 47 #include "core/page/Frame.h" |
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 , m_referenceTime(frame->document()->loader()->timing()->referenceMonotonicT
ime()) |
57 { | 58 { |
| 59 ASSERT(m_referenceTime); |
58 ScriptWrappable::init(this); | 60 ScriptWrappable::init(this); |
59 } | 61 } |
60 | 62 |
61 Performance::~Performance() | 63 Performance::~Performance() |
62 { | 64 { |
63 } | 65 } |
64 | 66 |
65 const AtomicString& Performance::interfaceName() const | 67 const AtomicString& Performance::interfaceName() const |
66 { | 68 { |
67 return eventNames().interfaceForPerformance; | 69 return eventNames().interfaceForPerformance; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 281 |
280 void Performance::clearMeasures(const String& measureName) | 282 void Performance::clearMeasures(const String& measureName) |
281 { | 283 { |
282 if (!m_userTiming) | 284 if (!m_userTiming) |
283 m_userTiming = UserTiming::create(this); | 285 m_userTiming = UserTiming::create(this); |
284 m_userTiming->clearMeasures(measureName); | 286 m_userTiming->clearMeasures(measureName); |
285 } | 287 } |
286 | 288 |
287 double Performance::now() const | 289 double Performance::now() const |
288 { | 290 { |
289 return 1000.0 * m_frame->document()->loader()->timing()->monotonicTimeToZero
BasedDocumentTime(monotonicallyIncreasingTime()); | 291 return 1000.0 * (monotonicallyIncreasingTime() - m_referenceTime); |
290 } | 292 } |
291 | 293 |
292 } // namespace WebCore | 294 } // namespace WebCore |
OLD | NEW |