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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { | 170 class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { |
171 public: | 171 public: |
172 static scoped_ptr<LayerTreeHostImplTimeSourceAdapter> Create( | 172 static scoped_ptr<LayerTreeHostImplTimeSourceAdapter> Create( |
173 LayerTreeHostImpl* layer_tree_host_impl, | 173 LayerTreeHostImpl* layer_tree_host_impl, |
174 scoped_refptr<DelayBasedTimeSource> time_source) { | 174 scoped_refptr<DelayBasedTimeSource> time_source) { |
175 return make_scoped_ptr( | 175 return make_scoped_ptr( |
176 new LayerTreeHostImplTimeSourceAdapter(layer_tree_host_impl, | 176 new LayerTreeHostImplTimeSourceAdapter(layer_tree_host_impl, |
177 time_source)); | 177 time_source)); |
178 } | 178 } |
179 virtual ~LayerTreeHostImplTimeSourceAdapter() { | 179 ~LayerTreeHostImplTimeSourceAdapter() override { |
180 time_source_->SetClient(NULL); | 180 time_source_->SetClient(NULL); |
181 time_source_->SetActive(false); | 181 time_source_->SetActive(false); |
182 } | 182 } |
183 | 183 |
184 virtual void OnTimerTick() override { | 184 void OnTimerTick() override { |
185 // In single threaded mode we attempt to simulate changing the current | 185 // In single threaded mode we attempt to simulate changing the current |
186 // thread by maintaining a fake thread id. When we switch from one | 186 // thread by maintaining a fake thread id. When we switch from one |
187 // thread to another, we construct DebugScopedSetXXXThread objects that | 187 // thread to another, we construct DebugScopedSetXXXThread objects that |
188 // update the thread id. This lets DCHECKS that ensure we're on the | 188 // update the thread id. This lets DCHECKS that ensure we're on the |
189 // right thread to work correctly in single threaded mode. The problem | 189 // right thread to work correctly in single threaded mode. The problem |
190 // here is that the timer tasks are run via the message loop, and when | 190 // here is that the timer tasks are run via the message loop, and when |
191 // they run, we've had no chance to construct a DebugScopedSetXXXThread | 191 // they run, we've had no chance to construct a DebugScopedSetXXXThread |
192 // object. The result is that we report that we're running on the main | 192 // object. The result is that we report that we're running on the main |
193 // thread. In multi-threaded mode, this timer is run on the compositor | 193 // thread. In multi-threaded mode, this timer is run on the compositor |
194 // thread, so to keep this consistent in single-threaded mode, we'll | 194 // thread, so to keep this consistent in single-threaded mode, we'll |
(...skipping 3280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 } | 3475 } |
3476 | 3476 |
3477 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3477 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3478 std::vector<PictureLayerImpl*>::iterator it = | 3478 std::vector<PictureLayerImpl*>::iterator it = |
3479 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3479 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3480 DCHECK(it != picture_layers_.end()); | 3480 DCHECK(it != picture_layers_.end()); |
3481 picture_layers_.erase(it); | 3481 picture_layers_.erase(it); |
3482 } | 3482 } |
3483 | 3483 |
3484 } // namespace cc | 3484 } // namespace cc |
OLD | NEW |