OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 627 |
628 void CCLayerTreeHost::startRateLimiter(GraphicsContext3D* context) | 628 void CCLayerTreeHost::startRateLimiter(GraphicsContext3D* context) |
629 { | 629 { |
630 if (m_animating) | 630 if (m_animating) |
631 return; | 631 return; |
632 ASSERT(context); | 632 ASSERT(context); |
633 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 633 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
634 if (it != m_rateLimiters.end()) | 634 if (it != m_rateLimiters.end()) |
635 it->second->start(); | 635 it->second->start(); |
636 else { | 636 else { |
637 RefPtr<RateLimiter> rateLimiter = RateLimiter::create(context); | 637 RefPtr<RateLimiter> rateLimiter = RateLimiter::create(context, this); |
638 m_rateLimiters.set(context, rateLimiter); | 638 m_rateLimiters.set(context, rateLimiter); |
639 rateLimiter->start(); | 639 rateLimiter->start(); |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
| 643 void CCLayerTreeHost::rateLimit() |
| 644 { |
| 645 // Force a no-op command on the compositor context, so that any ratelimiting
commands will wait for the compositing |
| 646 // context, and therefore for the SwapBuffers. |
| 647 m_proxy->forceSerializeOnSwapBuffers(); |
| 648 } |
| 649 |
643 void CCLayerTreeHost::stopRateLimiter(GraphicsContext3D* context) | 650 void CCLayerTreeHost::stopRateLimiter(GraphicsContext3D* context) |
644 { | 651 { |
645 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 652 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
646 if (it != m_rateLimiters.end()) { | 653 if (it != m_rateLimiters.end()) { |
647 it->second->stop(); | 654 it->second->stop(); |
648 m_rateLimiters.remove(it); | 655 m_rateLimiters.remove(it); |
649 } | 656 } |
650 } | 657 } |
651 | 658 |
652 bool CCLayerTreeHost::requestPartialTextureUpdate() | 659 bool CCLayerTreeHost::requestPartialTextureUpdate() |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { | 702 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { |
696 if (layer->id() == events[eventIndex].layerId) | 703 if (layer->id() == events[eventIndex].layerId) |
697 layer->notifyAnimationStarted(events[eventIndex], wallClockTime); | 704 layer->notifyAnimationStarted(events[eventIndex], wallClockTime); |
698 } | 705 } |
699 | 706 |
700 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 707 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
701 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 708 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
702 } | 709 } |
703 | 710 |
704 } // namespace WebCore | 711 } // namespace WebCore |
OLD | NEW |