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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 326 } |
327 | 327 |
328 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 328 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
329 if (host_impl->active_tree()->source_frame_number() < 1) | 329 if (host_impl->active_tree()->source_frame_number() < 1) |
330 return; | 330 return; |
331 | 331 |
332 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 332 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
333 FakeDelegatedRendererLayerImpl* delegated_impl = | 333 FakeDelegatedRendererLayerImpl* delegated_impl = |
334 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 334 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
335 | 335 |
336 ContextProvider* context_provider = | 336 TestContextProvider* context_provider = static_cast<TestContextProvider*>( |
337 host_impl->output_surface()->context_provider(); | 337 host_impl->output_surface()->context_provider().get()); |
338 | 338 |
339 ++num_activates_; | 339 ++num_activates_; |
340 switch (num_activates_) { | 340 switch (num_activates_) { |
341 case 2: | 341 case 2: |
342 EXPECT_TRUE(delegated_impl->ChildId()); | 342 EXPECT_TRUE(delegated_impl->ChildId()); |
343 EXPECT_FALSE(did_reset_child_id_); | 343 EXPECT_FALSE(did_reset_child_id_); |
344 | 344 |
345 context_provider->Context3d()->loseContextCHROMIUM( | 345 context_provider->TestContext3d()->loseContextCHROMIUM( |
346 GL_GUILTY_CONTEXT_RESET_ARB, | 346 GL_GUILTY_CONTEXT_RESET_ARB, |
347 GL_INNOCENT_CONTEXT_RESET_ARB); | 347 GL_INNOCENT_CONTEXT_RESET_ARB); |
348 break; | 348 break; |
349 case 3: | 349 case 3: |
350 EXPECT_TRUE(delegated_impl->ChildId()); | 350 EXPECT_TRUE(delegated_impl->ChildId()); |
351 EXPECT_TRUE(did_reset_child_id_); | 351 EXPECT_TRUE(did_reset_child_id_); |
352 EndTest(); | 352 EndTest(); |
353 break; | 353 break; |
354 } | 354 } |
355 } | 355 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // Make sure we end up using the same layer, or we won't test the right | 406 // Make sure we end up using the same layer, or we won't test the right |
407 // thing, which is to make sure we can handle an invalid frame when using | 407 // thing, which is to make sure we can handle an invalid frame when using |
408 // a stale layer from before the context was lost. | 408 // a stale layer from before the context was lost. |
409 DCHECK(delegated_.get() == old_delegated.get()); | 409 DCHECK(delegated_.get() == old_delegated.get()); |
410 } | 410 } |
411 | 411 |
412 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 412 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
413 if (host_impl->active_tree()->source_frame_number() < 1) | 413 if (host_impl->active_tree()->source_frame_number() < 1) |
414 return; | 414 return; |
415 | 415 |
416 ContextProvider* context_provider = | 416 TestContextProvider* context_provider = static_cast<TestContextProvider*>( |
417 host_impl->output_surface()->context_provider(); | 417 host_impl->output_surface()->context_provider().get()); |
418 | 418 |
419 ++num_activates_; | 419 ++num_activates_; |
420 switch (num_activates_) { | 420 switch (num_activates_) { |
421 case 2: | 421 case 2: |
422 context_provider->Context3d()->loseContextCHROMIUM( | 422 context_provider->TestContext3d()->loseContextCHROMIUM( |
423 GL_GUILTY_CONTEXT_RESET_ARB, | 423 GL_GUILTY_CONTEXT_RESET_ARB, |
424 GL_INNOCENT_CONTEXT_RESET_ARB); | 424 GL_INNOCENT_CONTEXT_RESET_ARB); |
425 break; | 425 break; |
426 case 3: | 426 case 3: |
427 EndTest(); | 427 EndTest(); |
428 break; | 428 break; |
429 } | 429 } |
430 } | 430 } |
431 | 431 |
432 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 432 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 } | 2358 } |
2359 | 2359 |
2360 scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2360 scoped_refptr<DelegatedRendererLayer> delegated_thief_; |
2361 }; | 2361 }; |
2362 | 2362 |
2363 SINGLE_AND_MULTI_THREAD_TEST_F( | 2363 SINGLE_AND_MULTI_THREAD_TEST_F( |
2364 LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2364 LayerTreeHostDelegatedTestRemoveAndChangeResources); |
2365 | 2365 |
2366 } // namespace | 2366 } // namespace |
2367 } // namespace cc | 2367 } // namespace cc |
OLD | NEW |