OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded(double timestamp) | 47 void DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded(double timestamp) |
48 { | 48 { |
49 if (m_scheduled) { | 49 if (m_scheduled) { |
50 m_scheduled = false; | 50 m_scheduled = false; |
51 displayRefreshFired(timestamp); | 51 displayRefreshFired(timestamp); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 DisplayRefreshMonitor::DisplayRefreshMonitor(PlatformDisplayID displayID) | 55 DisplayRefreshMonitor::DisplayRefreshMonitor(PlatformDisplayID displayID) |
56 : m_monotonicAnimationStartTime(0) | 56 : m_timestamp(0) |
57 , m_active(true) | 57 , m_active(true) |
58 , m_scheduled(false) | 58 , m_scheduled(false) |
59 , m_previousFrameDone(true) | 59 , m_previousFrameDone(true) |
60 , m_displayID(displayID) | 60 , m_displayID(displayID) |
61 #if PLATFORM(MAC) | 61 #if PLATFORM(MAC) |
62 , m_displayLink(0) | 62 , m_displayLink(0) |
63 #endif | 63 #endif |
64 #if PLATFORM(BLACKBERRY) | 64 #if PLATFORM(BLACKBERRY) |
65 , m_animationClient(0) | 65 , m_animationClient(0) |
66 #endif | 66 #endif |
67 { | 67 { |
68 } | 68 } |
69 | 69 |
70 void DisplayRefreshMonitor::refreshDisplayOnMainThread(void* data) | 70 void DisplayRefreshMonitor::refreshDisplayOnMainThread(void* data) |
71 { | 71 { |
72 DisplayRefreshMonitor* monitor = static_cast<DisplayRefreshMonitor*>(data); | 72 DisplayRefreshMonitor* monitor = static_cast<DisplayRefreshMonitor*>(data); |
73 monitor->notifyClients(); | 73 monitor->notifyClients(); |
74 } | 74 } |
75 | 75 |
76 void DisplayRefreshMonitor::notifyClients() | 76 void DisplayRefreshMonitor::notifyClients() |
77 { | 77 { |
78 double monotonicAnimationStartTime; | 78 double timestamp; |
79 { | 79 { |
80 MutexLocker lock(m_mutex); | 80 MutexLocker lock(m_mutex); |
81 m_scheduled = false; | 81 m_scheduled = false; |
82 monotonicAnimationStartTime = m_monotonicAnimationStartTime; | 82 timestamp = m_timestamp; |
83 } | 83 } |
84 | 84 |
85 for (size_t i = 0; i < m_clients.size(); ++i) | 85 for (size_t i = 0; i < m_clients.size(); ++i) |
86 m_clients[i]->fireDisplayRefreshIfNeeded(monotonicAnimationStartTime); | 86 m_clients[i]->fireDisplayRefreshIfNeeded(timestamp); |
87 | 87 |
88 { | 88 { |
89 MutexLocker lock(m_mutex); | 89 MutexLocker lock(m_mutex); |
90 m_previousFrameDone = true; | 90 m_previousFrameDone = true; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 DisplayRefreshMonitorManager* DisplayRefreshMonitorManager::sharedManager() | 94 DisplayRefreshMonitorManager* DisplayRefreshMonitorManager::sharedManager() |
95 { | 95 { |
96 DEFINE_STATIC_LOCAL(DisplayRefreshMonitorManager, manager, ()); | 96 DEFINE_STATIC_LOCAL(DisplayRefreshMonitorManager, manager, ()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 unregisterClient(client); | 161 unregisterClient(client); |
162 client->setDisplayID(displayID); | 162 client->setDisplayID(displayID); |
163 registerClient(client); | 163 registerClient(client); |
164 if (client->m_scheduled) | 164 if (client->m_scheduled) |
165 scheduleAnimation(client); | 165 scheduleAnimation(client); |
166 } | 166 } |
167 | 167 |
168 } | 168 } |
169 | 169 |
170 #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) | 170 #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) |
OLD | NEW |