OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/timing/PerformanceTiming.h" | 32 #include "core/timing/PerformanceTiming.h" |
33 | 33 |
34 #include "bindings/core/v8/ScriptValue.h" | 34 #include "bindings/core/v8/ScriptValue.h" |
35 #include "bindings/core/v8/V8ObjectBuilder.h" | 35 #include "bindings/core/v8/V8ObjectBuilder.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/dom/DocumentTiming.h" | 37 #include "core/dom/DocumentTiming.h" |
38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
39 #include "core/loader/DocumentLoadTiming.h" | 39 #include "core/loader/DocumentLoadTiming.h" |
40 #include "core/loader/DocumentLoader.h" | 40 #include "core/loader/DocumentLoader.h" |
41 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
| 42 #include "core/timing/PerformanceBase.h" |
42 #include "platform/network/ResourceLoadTiming.h" | 43 #include "platform/network/ResourceLoadTiming.h" |
43 #include "platform/network/ResourceResponse.h" | 44 #include "platform/network/ResourceResponse.h" |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 static unsigned long long toIntegerMilliseconds(double seconds) | 48 static unsigned long long toIntegerMilliseconds(double seconds) |
48 { | 49 { |
49 ASSERT(seconds >= 0); | 50 ASSERT(seconds >= 0); |
50 return static_cast<unsigned long long>(seconds * 1000.0); | 51 double clampedSeconds = PerformanceBase::clampTimeResolution(seconds); |
| 52 return static_cast<unsigned long long>(clampedSeconds * 1000.0); |
51 } | 53 } |
52 | 54 |
53 static double toDoubleSeconds(unsigned long long integerMilliseconds) | 55 static double toDoubleSeconds(unsigned long long integerMilliseconds) |
54 { | 56 { |
55 return integerMilliseconds / 1000.0; | 57 return integerMilliseconds / 1000.0; |
56 } | 58 } |
57 | 59 |
58 PerformanceTiming::PerformanceTiming(LocalFrame* frame) | 60 PerformanceTiming::PerformanceTiming(LocalFrame* frame) |
59 : DOMWindowProperty(frame) | 61 : DOMWindowProperty(frame) |
60 { | 62 { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 407 |
406 return timing->pseudoWallTimeToMonotonicTime(toDoubleSeconds(integerMillisec
onds)); | 408 return timing->pseudoWallTimeToMonotonicTime(toDoubleSeconds(integerMillisec
onds)); |
407 } | 409 } |
408 | 410 |
409 DEFINE_TRACE(PerformanceTiming) | 411 DEFINE_TRACE(PerformanceTiming) |
410 { | 412 { |
411 DOMWindowProperty::trace(visitor); | 413 DOMWindowProperty::trace(visitor); |
412 } | 414 } |
413 | 415 |
414 } // namespace blink | 416 } // namespace blink |
OLD | NEW |