| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebFrameTime_h | 31 #ifndef WebFrameTime_h |
| 32 #define WebFrameTime_h | 32 #define WebFrameTime_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 struct WebFrameTime { | 38 struct WebFrameTime { |
| 39 // Before C++0x we can't define a static const member with floating point |
| 40 // value so are forced to use a function here. When we can use C++0x |
| 41 // replace this with (for better performance); |
| 42 // static constexpr double Undefined() { return -1.0 }; |
| 43 inline static const double Undefined() |
| 44 { |
| 45 return -1; |
| 46 } |
| 47 |
| 48 WebFrameTime() |
| 49 : lastFrameTime(Undefined()) |
| 50 , renderDeadline(Undefined()) |
| 51 , displayFrameTime(Undefined()) |
| 52 , predictedNextDisplayFrameTime(Undefined()) |
| 53 { } |
| 54 |
| 39 WebFrameTime(double lastFrameTime, double renderDeadline, double displayFram
eTime, double predictedNextDisplayFrameTime) | 55 WebFrameTime(double lastFrameTime, double renderDeadline, double displayFram
eTime, double predictedNextDisplayFrameTime) |
| 40 : lastFrameTime(lastFrameTime) | 56 : lastFrameTime(lastFrameTime) |
| 41 , renderDeadline(renderDeadline) | 57 , renderDeadline(renderDeadline) |
| 42 , displayFrameTime(displayFrameTime) | 58 , displayFrameTime(displayFrameTime) |
| 43 , predictedNextDisplayFrameTime(predictedNextDisplayFrameTime) | 59 , predictedNextDisplayFrameTime(predictedNextDisplayFrameTime) |
| 44 { } | 60 { } |
| 45 | 61 |
| 62 bool isNull() const |
| 63 { |
| 64 return ( |
| 65 lastFrameTime == Undefined() |
| 66 && renderDeadline == Undefined() |
| 67 && displayFrameTime == Undefined() |
| 68 && predictedNextDisplayFrameTime == Undefined()); |
| 69 } |
| 70 |
| 46 // FIXME(mithro): Upgrade the time in CLOCK_MONOTONIC values to use a | 71 // FIXME(mithro): Upgrade the time in CLOCK_MONOTONIC values to use a |
| 47 // TimeTick like class rather than a bare double. | 72 // TimeTick like class rather than a bare double. |
| 48 | 73 |
| 49 // Time in CLOCK_MONOTONIC that is the most recent vsync time. | 74 // Time in CLOCK_MONOTONIC that is the most recent vsync time. |
| 50 double lastFrameTime; | 75 double lastFrameTime; |
| 51 | 76 |
| 52 // Time in CLOCK_MONOTONIC by which rendering must be finished by to not | 77 // Time in CLOCK_MONOTONIC by which rendering must be finished by to not |
| 53 // stall the pipeline. | 78 // stall the pipeline. |
| 54 double renderDeadline; | 79 double renderDeadline; |
| 55 | 80 |
| 56 // Time in CLOCK_MONOTONIC that the frame will hit the glass of the display | 81 // Time in CLOCK_MONOTONIC that the frame will hit the glass of the display |
| 57 // if rendered within the deadline. This time may be identical to | 82 // if rendered within the deadline. This time may be identical to |
| 58 // lastFrameTime. | 83 // lastFrameTime. |
| 59 double displayFrameTime; | 84 double displayFrameTime; |
| 60 | 85 |
| 61 // Time in CLOCK_MONOTONIC that is the predicated next value for | 86 // Time in CLOCK_MONOTONIC that is the predicated next value for |
| 62 // displayFrameTime. The next displayFrameTime should be this value or | 87 // displayFrameTime. The next displayFrameTime should be this value or |
| 63 // greater. | 88 // greater. |
| 64 double predictedNextDisplayFrameTime; | 89 double predictedNextDisplayFrameTime; |
| 65 }; | 90 }; |
| 66 | 91 |
| 67 } // namespace blink | 92 } // namespace blink |
| 68 | 93 |
| 69 #endif | 94 #endif |
| OLD | NEW |