OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 332 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
333 if (host_impl->active_tree()->source_frame_number() < 1) | 333 if (host_impl->active_tree()->source_frame_number() < 1) |
334 return; | 334 return; |
335 | 335 |
336 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 336 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
337 FakeDelegatedRendererLayerImpl* delegated_impl = | 337 FakeDelegatedRendererLayerImpl* delegated_impl = |
338 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 338 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
339 | 339 |
340 TestContextProvider* context_provider = static_cast<TestContextProvider*>( | 340 TestContextProvider* context_provider = static_cast<TestContextProvider*>( |
341 host_impl->output_surface()->context_provider().get()); | 341 host_impl->output_surface()->context_provider()); |
342 | 342 |
343 ++num_activates_; | 343 ++num_activates_; |
344 switch (num_activates_) { | 344 switch (num_activates_) { |
345 case 2: | 345 case 2: |
346 EXPECT_TRUE(delegated_impl->ChildId()); | 346 EXPECT_TRUE(delegated_impl->ChildId()); |
347 EXPECT_FALSE(did_reset_child_id_); | 347 EXPECT_FALSE(did_reset_child_id_); |
348 | 348 |
349 context_provider->ContextGL()->LoseContextCHROMIUM( | 349 context_provider->ContextGL()->LoseContextCHROMIUM( |
350 GL_GUILTY_CONTEXT_RESET_ARB, | 350 GL_GUILTY_CONTEXT_RESET_ARB, |
351 GL_INNOCENT_CONTEXT_RESET_ARB); | 351 GL_INNOCENT_CONTEXT_RESET_ARB); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 // thing, which is to make sure we can handle an invalid frame when using | 412 // thing, which is to make sure we can handle an invalid frame when using |
413 // a stale layer from before the context was lost. | 413 // a stale layer from before the context was lost. |
414 DCHECK(delegated_.get() == old_delegated.get()); | 414 DCHECK(delegated_.get() == old_delegated.get()); |
415 } | 415 } |
416 | 416 |
417 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 417 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
418 if (host_impl->active_tree()->source_frame_number() < 1) | 418 if (host_impl->active_tree()->source_frame_number() < 1) |
419 return; | 419 return; |
420 | 420 |
421 TestContextProvider* context_provider = static_cast<TestContextProvider*>( | 421 TestContextProvider* context_provider = static_cast<TestContextProvider*>( |
422 host_impl->output_surface()->context_provider().get()); | 422 host_impl->output_surface()->context_provider()); |
423 | 423 |
424 ++num_activates_; | 424 ++num_activates_; |
425 switch (num_activates_) { | 425 switch (num_activates_) { |
426 case 2: | 426 case 2: |
427 context_provider->ContextGL()->LoseContextCHROMIUM( | 427 context_provider->ContextGL()->LoseContextCHROMIUM( |
428 GL_GUILTY_CONTEXT_RESET_ARB, | 428 GL_GUILTY_CONTEXT_RESET_ARB, |
429 GL_INNOCENT_CONTEXT_RESET_ARB); | 429 GL_INNOCENT_CONTEXT_RESET_ARB); |
430 break; | 430 break; |
431 case 3: | 431 case 3: |
432 EndTest(); | 432 EndTest(); |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 } | 2192 } |
2193 | 2193 |
2194 scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2194 scoped_refptr<DelegatedRendererLayer> delegated_thief_; |
2195 }; | 2195 }; |
2196 | 2196 |
2197 SINGLE_AND_MULTI_THREAD_TEST_F( | 2197 SINGLE_AND_MULTI_THREAD_TEST_F( |
2198 LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2198 LayerTreeHostDelegatedTestRemoveAndChangeResources); |
2199 | 2199 |
2200 } // namespace | 2200 } // namespace |
2201 } // namespace cc | 2201 } // namespace cc |
OLD | NEW |