Commit 66f287b425bf6a828d70033568b0c356f354fbbc
- Diff rendering mode:
- inline
- side by side
WebCore/platform/TileCache.h
(2 / 2)
|   | |||
| 78 | 78 | #endif | |
| 79 | 79 | ||
| 80 | 80 | // Don't use WebKit timers to avoid interfering with the engine. | |
| 81 | OwnPtr<TileTimer> m_tilePaintTimer; | ||
| 82 | OwnPtr<TileTimer> m_tileCreationTimer; | ||
| 81 | TileTimer* m_tilePaintTimer; | ||
| 82 | TileTimer* m_tileCreationTimer; | ||
| 83 | 83 | ||
| 84 | 84 | IntSize m_tileSize; | |
| 85 | 85 |
WebCore/platform/qt/TileCacheQt.cpp
(49 / 13)
|   | |||
| 42 | 42 | Q_OBJECT | |
| 43 | 43 | public: | |
| 44 | 44 | TileTimer(TileCache* cache, void (TileCache::*f)()); | |
| 45 | void destroy(); | ||
| 45 | 46 | void startOneShot(double time); | |
| 46 | 47 | bool isActive() { return m_timer.isActive(); } | |
| 47 | 48 | ||
| … | … | ||
| 53 | 53 | void timerEvent(QTimerEvent* ev); | |
| 54 | 54 | ||
| 55 | 55 | private: | |
| 56 | void moveToEngineThread(); | ||
| 57 | |||
| 56 | 58 | QBasicTimer m_timer; | |
| 57 | 59 | TileCache* m_cache; | |
| 58 | 60 | void (TileCache::*m_timerFunction)(); | |
| … | … | ||
| 66 | 66 | , m_timerFunction(f) | |
| 67 | 67 | , m_inEngineThread(false) | |
| 68 | 68 | { | |
| 69 | #if ENABLE(ENGINE_THREAD) | ||
| 70 | moveToEngineThread(); | ||
| 71 | #endif | ||
| 69 | 72 | } | |
| 70 | |||
| 71 | void TileTimer::startOneShot(double time) | ||
| 73 | |||
| 74 | void TileTimer::moveToEngineThread() | ||
| 72 | 75 | { | |
| 73 | 76 | #if ENABLE(ENGINE_THREAD) | |
| 74 | if (!m_inEngineThread && EngineThread::isStarted() && QThread::currentThread() == QApplication::instance()->thread()) { | ||
| 75 | moveToThread(EngineThread::qThread()); | ||
| 77 | if (m_inEngineThread) | ||
| 78 | return; | ||
| 79 | if (thread() == EngineThread::qThread()) { | ||
| 76 | 80 | m_inEngineThread = true; | |
| 81 | return; | ||
| 77 | 82 | } | |
| 78 | QMetaObject::invokeMethod(this, "start", Qt::AutoConnection, Q_ARG(double, time)); | ||
| 83 | if (!EngineThread::isStarted() || QThread::currentThread() != thread()) | ||
| 84 | return; | ||
| 85 | moveToThread(EngineThread::qThread()); | ||
| 86 | m_inEngineThread = true; | ||
| 87 | #endif | ||
| 88 | } | ||
| 89 | |||
| 90 | void TileTimer::startOneShot(double time) | ||
| 91 | { | ||
| 92 | #if ENABLE(ENGINE_THREAD) | ||
| 93 | moveToEngineThread(); | ||
| 94 | |||
| 95 | if (EngineThread::isCurrent() && m_inEngineThread) | ||
| 96 | start(time); | ||
| 97 | else | ||
| 98 | QMetaObject::invokeMethod(this, "start", Qt::AutoConnection, Q_ARG(double, time)); | ||
| 79 | 99 | #else | |
| 80 | 100 | start(time); | |
| 81 | 101 | #endif | |
| … | … | ||
| 108 | 108 | ||
| 109 | 109 | void TileTimer::timerEvent(QTimerEvent* ev) | |
| 110 | 110 | { | |
| 111 | #if ENABLE(ENGINE_THREAD) | ||
| 112 | bool needsLock = EngineThread::isCurrent(); | ||
| 113 | if (needsLock) | ||
| 114 | EngineThread::lock(); | ||
| 115 | #endif | ||
| 111 | 116 | m_timer.stop(); | |
| 112 | (m_cache->*m_timerFunction)(); | ||
| 117 | if (m_cache) | ||
| 118 | (m_cache->*m_timerFunction)(); | ||
| 119 | #if ENABLE(ENGINE_THREAD) | ||
| 120 | if (needsLock) | ||
| 121 | EngineThread::unlock(); | ||
| 122 | #endif | ||
| 113 | 123 | } | |
| 124 | |||
| 125 | void TileTimer::destroy() | ||
| 126 | { | ||
| 127 | m_cache = 0; | ||
| 128 | QMetaObject::invokeMethod(this, "deleteLater", Qt::AutoConnection); | ||
| 129 | } | ||
| 114 | 130 | ||
| 115 | 131 | class Tile : public ThreadSafeShared<Tile> | |
| 116 | 132 | { | |
| … | … | ||
| 275 | 275 | ||
| 276 | 276 | TileCache::~TileCache() | |
| 277 | 277 | { | |
| 278 | m_tilePaintTimer->destroy(); | ||
| 279 | m_tilePaintTimer = 0; | ||
| 280 | m_tileCreationTimer->destroy(); | ||
| 281 | m_tileCreationTimer = 0; | ||
| 278 | 282 | } | |
| 279 | 283 | ||
| 280 | 284 | void TileCache::invalidate(const IntRect& dirtyRect) | |
| … | … | ||
| 301 | 301 | ||
| 302 | 302 | void TileCache::paintTiles() | |
| 303 | 303 | { | |
| 304 | #if ENABLE(ENGINE_THREAD) | ||
| 305 | EngineThread::lock(); | ||
| 306 | #endif | ||
| 307 | 304 | m_client->tileCachePaintBegin(); | |
| 308 | 305 | ||
| 309 | 306 | QRegion fullDirtyRegion; | |
| … | … | ||
| 325 | 325 | paintedArea.append(qrects[n]); | |
| 326 | 326 | ||
| 327 | 327 | m_client->tileCachePaintEnd(paintedArea); | |
| 328 | |||
| 329 | #if ENABLE(ENGINE_THREAD) | ||
| 330 | EngineThread::unlock(); | ||
| 331 | #endif | ||
| 332 | 328 | ||
| 333 | 329 | { | |
| 334 | 330 | // Swap the buffers atomically |

