| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 LayerTreeHost::~LayerTreeHost() { | 116 LayerTreeHost::~LayerTreeHost() { |
| 117 if (root_layer_) | 117 if (root_layer_) |
| 118 root_layer_->SetLayerTreeHost(NULL); | 118 root_layer_->SetLayerTreeHost(NULL); |
| 119 DCHECK(proxy_); | 119 DCHECK(proxy_); |
| 120 DCHECK(proxy_->IsMainThread()); | 120 DCHECK(proxy_->IsMainThread()); |
| 121 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 121 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
| 122 proxy_->Stop(); | 122 proxy_->Stop(); |
| 123 s_num_layer_tree_instances--; | 123 s_num_layer_tree_instances--; |
| 124 RateLimiterMap::iterator it = rate_limiters_.begin(); | 124 RateLimiterMap::iterator it = rate_limiters_.begin(); |
| 125 if (it != rate_limiters_.end()) | 125 if (it != rate_limiters_.end()) |
| 126 it->second->stop(); | 126 it->second->Stop(); |
| 127 | 127 |
| 128 if (root_layer_) { | 128 if (root_layer_) { |
| 129 // The layer tree must be destroyed before the layer tree host. We've | 129 // The layer tree must be destroyed before the layer tree host. We've |
| 130 // made a contract with our animation controllers that the registrar | 130 // made a contract with our animation controllers that the registrar |
| 131 // will outlive them, and we must make good. | 131 // will outlive them, and we must make good. |
| 132 root_layer_ = NULL; | 132 root_layer_ = NULL; |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 void LayerTreeHost::SetSurfaceReady() { | 136 void LayerTreeHost::SetSurfaceReady() { |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 impl_transform_ = transform; | 817 impl_transform_ = transform; |
| 818 } | 818 } |
| 819 | 819 |
| 820 void LayerTreeHost::StartRateLimiter(WebKit::WebGraphicsContext3D* context3d) { | 820 void LayerTreeHost::StartRateLimiter(WebKit::WebGraphicsContext3D* context3d) { |
| 821 if (animating_) | 821 if (animating_) |
| 822 return; | 822 return; |
| 823 | 823 |
| 824 DCHECK(context3d); | 824 DCHECK(context3d); |
| 825 RateLimiterMap::iterator it = rate_limiters_.find(context3d); | 825 RateLimiterMap::iterator it = rate_limiters_.find(context3d); |
| 826 if (it != rate_limiters_.end()) { | 826 if (it != rate_limiters_.end()) { |
| 827 it->second->start(); | 827 it->second->Start(); |
| 828 } else { | 828 } else { |
| 829 scoped_refptr<RateLimiter> rate_limiter = | 829 scoped_refptr<RateLimiter> rate_limiter = |
| 830 RateLimiter::create(context3d, this, proxy_->MainThread()); | 830 RateLimiter::Create(context3d, this, proxy_->MainThread()); |
| 831 rate_limiters_[context3d] = rate_limiter; | 831 rate_limiters_[context3d] = rate_limiter; |
| 832 rate_limiter->start(); | 832 rate_limiter->Start(); |
| 833 } | 833 } |
| 834 } | 834 } |
| 835 | 835 |
| 836 void LayerTreeHost::StopRateLimiter(WebKit::WebGraphicsContext3D* context3d) { | 836 void LayerTreeHost::StopRateLimiter(WebKit::WebGraphicsContext3D* context3d) { |
| 837 RateLimiterMap::iterator it = rate_limiters_.find(context3d); | 837 RateLimiterMap::iterator it = rate_limiters_.find(context3d); |
| 838 if (it != rate_limiters_.end()) { | 838 if (it != rate_limiters_.end()) { |
| 839 it->second->stop(); | 839 it->second->Stop(); |
| 840 rate_limiters_.erase(it); | 840 rate_limiters_.erase(it); |
| 841 } | 841 } |
| 842 } | 842 } |
| 843 | 843 |
| 844 void LayerTreeHost::rateLimit() { | 844 void LayerTreeHost::RateLimit() { |
| 845 // Force a no-op command on the compositor context, so that any ratelimiting | 845 // Force a no-op command on the compositor context, so that any ratelimiting |
| 846 // commands will wait for the compositing context, and therefore for the | 846 // commands will wait for the compositing context, and therefore for the |
| 847 // SwapBuffers. | 847 // SwapBuffers. |
| 848 proxy_->ForceSerializeOnSwapBuffers(); | 848 proxy_->ForceSerializeOnSwapBuffers(); |
| 849 } | 849 } |
| 850 | 850 |
| 851 bool LayerTreeHost::RequestPartialTextureUpdate() { | 851 bool LayerTreeHost::RequestPartialTextureUpdate() { |
| 852 if (partial_texture_update_requests_ >= settings_.maxPartialTextureUpdates) | 852 if (partial_texture_update_requests_ >= settings_.maxPartialTextureUpdates) |
| 853 return false; | 853 return false; |
| 854 | 854 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 SetAnimationEventsRecursive(events, | 939 SetAnimationEventsRecursive(events, |
| 940 layer->children()[child_index].get(), | 940 layer->children()[child_index].get(), |
| 941 wall_clock_time); | 941 wall_clock_time); |
| 942 } | 942 } |
| 943 | 943 |
| 944 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { | 944 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { |
| 945 return proxy_->CapturePicture(); | 945 return proxy_->CapturePicture(); |
| 946 } | 946 } |
| 947 | 947 |
| 948 } // namespace cc | 948 } // namespace cc |
| OLD | NEW |