| 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 16 matching lines...) Expand all Loading... |
| 27 #define DisplayRefreshMonitor_h | 27 #define DisplayRefreshMonitor_h |
| 28 | 28 |
| 29 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) | 29 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) |
| 30 | 30 |
| 31 #include "PlatformScreen.h" | 31 #include "PlatformScreen.h" |
| 32 #include <wtf/HashMap.h> | 32 #include <wtf/HashMap.h> |
| 33 #include <wtf/HashSet.h> | 33 #include <wtf/HashSet.h> |
| 34 #include <wtf/RefCounted.h> | 34 #include <wtf/RefCounted.h> |
| 35 #include <wtf/RefPtr.h> | 35 #include <wtf/RefPtr.h> |
| 36 #include <wtf/Threading.h> | 36 #include <wtf/Threading.h> |
| 37 #if PLATFORM(BLACKBERRY) | |
| 38 #include <BlackBerryPlatformAnimationFrameRateController.h> | |
| 39 #endif | |
| 40 | 37 |
| 41 #if PLATFORM(MAC) | 38 #if PLATFORM(MAC) |
| 42 typedef struct __CVDisplayLink *CVDisplayLinkRef; | 39 typedef struct __CVDisplayLink *CVDisplayLinkRef; |
| 43 #endif | 40 #endif |
| 44 | 41 |
| 45 namespace WebCore { | 42 namespace WebCore { |
| 46 | 43 |
| 47 class DisplayRefreshMonitor; | 44 class DisplayRefreshMonitor; |
| 48 class DisplayRefreshMonitorManager; | 45 class DisplayRefreshMonitorManager; |
| 49 | 46 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 67 { | 64 { |
| 68 m_displayID = displayID; | 65 m_displayID = displayID; |
| 69 m_displayIDIsSet = true; | 66 m_displayIDIsSet = true; |
| 70 } | 67 } |
| 71 | 68 |
| 72 bool m_scheduled; | 69 bool m_scheduled; |
| 73 bool m_displayIDIsSet; | 70 bool m_displayIDIsSet; |
| 74 PlatformDisplayID m_displayID; | 71 PlatformDisplayID m_displayID; |
| 75 }; | 72 }; |
| 76 | 73 |
| 77 #if PLATFORM(BLACKBERRY) | |
| 78 class DisplayAnimationClient : public BlackBerry::Platform::AnimationFrameRateCl
ient { | |
| 79 public: | |
| 80 DisplayAnimationClient(DisplayRefreshMonitor *); | |
| 81 ~DisplayAnimationClient() { } | |
| 82 private: | |
| 83 virtual void animationFrameChanged(); | |
| 84 DisplayRefreshMonitor *m_monitor; | |
| 85 }; | |
| 86 #endif | |
| 87 | |
| 88 // | 74 // |
| 89 // Monitor for display refresh messages for a given screen | 75 // Monitor for display refresh messages for a given screen |
| 90 // | 76 // |
| 91 | 77 |
| 92 class DisplayRefreshMonitor : public RefCounted<DisplayRefreshMonitor> { | 78 class DisplayRefreshMonitor : public RefCounted<DisplayRefreshMonitor> { |
| 93 public: | 79 public: |
| 94 static PassRefPtr<DisplayRefreshMonitor> create(PlatformDisplayID displayID) | 80 static PassRefPtr<DisplayRefreshMonitor> create(PlatformDisplayID displayID) |
| 95 { | 81 { |
| 96 return adoptRef(new DisplayRefreshMonitor(displayID)); | 82 return adoptRef(new DisplayRefreshMonitor(displayID)); |
| 97 } | 83 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 124 double m_monotonicAnimationStartTime; | 110 double m_monotonicAnimationStartTime; |
| 125 bool m_active; | 111 bool m_active; |
| 126 bool m_scheduled; | 112 bool m_scheduled; |
| 127 bool m_previousFrameDone; | 113 bool m_previousFrameDone; |
| 128 int m_unscheduledFireCount; // Number of times the display link has fired wi
th no clients. | 114 int m_unscheduledFireCount; // Number of times the display link has fired wi
th no clients. |
| 129 PlatformDisplayID m_displayID; | 115 PlatformDisplayID m_displayID; |
| 130 Mutex m_mutex; | 116 Mutex m_mutex; |
| 131 | 117 |
| 132 typedef HashSet<DisplayRefreshMonitorClient*> DisplayRefreshMonitorClientSet
; | 118 typedef HashSet<DisplayRefreshMonitorClient*> DisplayRefreshMonitorClientSet
; |
| 133 DisplayRefreshMonitorClientSet m_clients; | 119 DisplayRefreshMonitorClientSet m_clients; |
| 134 #if PLATFORM(BLACKBERRY) | |
| 135 public: | |
| 136 void displayLinkFired(); | |
| 137 private: | |
| 138 DisplayAnimationClient *m_animationClient; | |
| 139 void startAnimationClient(); | |
| 140 void stopAnimationClient(); | |
| 141 #endif | |
| 142 #if PLATFORM(MAC) | 120 #if PLATFORM(MAC) |
| 143 public: | 121 public: |
| 144 void displayLinkFired(double nowSeconds, double outputTimeSeconds); | 122 void displayLinkFired(double nowSeconds, double outputTimeSeconds); |
| 145 private: | 123 private: |
| 146 CVDisplayLinkRef m_displayLink; | 124 CVDisplayLinkRef m_displayLink; |
| 147 #endif | 125 #endif |
| 148 }; | 126 }; |
| 149 | 127 |
| 150 // | 128 // |
| 151 // Singleton manager for all the DisplayRefreshMonitors. This is the interface t
o the | 129 // Singleton manager for all the DisplayRefreshMonitors. This is the interface t
o the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 173 // We know nothing about the values of PlatformDisplayIDs, so use UnsignedWi
thZeroKeyHashTraits. | 151 // We know nothing about the values of PlatformDisplayIDs, so use UnsignedWi
thZeroKeyHashTraits. |
| 174 typedef HashMap<uint64_t, RefPtr<DisplayRefreshMonitor>, WTF::IntHash<uint64
_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t> > DisplayRefreshMonitorMap; | 152 typedef HashMap<uint64_t, RefPtr<DisplayRefreshMonitor>, WTF::IntHash<uint64
_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t> > DisplayRefreshMonitorMap; |
| 175 DisplayRefreshMonitorMap m_monitors; | 153 DisplayRefreshMonitorMap m_monitors; |
| 176 }; | 154 }; |
| 177 | 155 |
| 178 } | 156 } |
| 179 | 157 |
| 180 #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) | 158 #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) |
| 181 | 159 |
| 182 #endif | 160 #endif |
| OLD | NEW |