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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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); |
352 context_provider->ContextGL()->Flush(); | 352 context_provider->ContextGL()->Flush(); |
353 break; | 353 break; |
354 case 3: | 354 case 3: |
355 EXPECT_TRUE(delegated_impl->ChildId()); | 355 if (HasImplThread()) |
356 EXPECT_TRUE(did_reset_child_id_); | 356 CheckForChildResetAndEnd(delegated_impl); |
357 EndTest(); | 357 break; |
358 case 4: | |
359 if (!HasImplThread()) | |
360 CheckForChildResetAndEnd(delegated_impl); | |
358 break; | 361 break; |
359 } | 362 } |
360 } | 363 } |
361 | 364 |
365 void CheckForChildResetAndEnd( | |
366 FakeDelegatedRendererLayerImpl* delegated_impl) { | |
367 EXPECT_TRUE(delegated_impl->ChildId()); | |
368 EXPECT_TRUE(did_reset_child_id_); | |
369 EndTest(); | |
370 } | |
371 | |
362 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 372 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
363 bool success) OVERRIDE { | 373 bool success) OVERRIDE { |
364 EXPECT_TRUE(success); | 374 EXPECT_TRUE(success); |
365 | 375 |
366 if (num_activates_ < 2) | 376 if (num_activates_ < 2) |
367 return; | 377 return; |
368 | 378 |
369 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 379 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
370 FakeDelegatedRendererLayerImpl* delegated_impl = | 380 FakeDelegatedRendererLayerImpl* delegated_impl = |
371 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 381 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
372 | 382 |
373 EXPECT_EQ(2, num_activates_); | 383 if (HasImplThread()) |
danakj
2014/08/20 18:22:10
{} because the else needs them
dneto
2014/08/20 19:15:20
Excellent. Control structures without braces freak
| |
384 EXPECT_EQ(2, num_activates_); | |
385 else | |
danakj
2014/08/20 18:22:10
{} because the body is more than one line
dneto
2014/08/20 19:15:20
Acknowledged.
| |
386 // The single thread proxy issues extra commits after the context is | |
387 // lost. http://crbug.com/287250 | |
388 EXPECT_EQ(3, num_activates_); | |
374 EXPECT_FALSE(delegated_impl->ChildId()); | 389 EXPECT_FALSE(delegated_impl->ChildId()); |
375 did_reset_child_id_ = true; | 390 did_reset_child_id_ = true; |
376 } | 391 } |
377 | 392 |
378 protected: | 393 protected: |
379 int num_activates_; | 394 int num_activates_; |
380 bool did_reset_child_id_; | 395 bool did_reset_child_id_; |
381 }; | 396 }; |
382 | 397 |
383 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCreateChildId); | 398 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCreateChildId); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 bool success) OVERRIDE { | 453 bool success) OVERRIDE { |
439 EXPECT_TRUE(success); | 454 EXPECT_TRUE(success); |
440 | 455 |
441 if (num_activates_ < 2) | 456 if (num_activates_ < 2) |
442 return; | 457 return; |
443 | 458 |
444 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 459 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
445 FakeDelegatedRendererLayerImpl* delegated_impl = | 460 FakeDelegatedRendererLayerImpl* delegated_impl = |
446 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 461 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
447 | 462 |
448 EXPECT_EQ(2, num_activates_); | 463 if (HasImplThread()) |
danakj
2014/08/20 18:22:10
{}
| |
464 EXPECT_EQ(2, num_activates_); | |
465 else | |
danakj
2014/08/20 18:22:10
{}
| |
466 // The single thread proxy issues extra commits after the context is | |
467 // lost. http://crbug.com/287250 | |
468 EXPECT_EQ(3, num_activates_); | |
449 // Resources should have gotten cleared after the context was lost. | 469 // Resources should have gotten cleared after the context was lost. |
450 EXPECT_EQ(0U, delegated_impl->Resources().size()); | 470 EXPECT_EQ(0U, delegated_impl->Resources().size()); |
451 } | 471 } |
452 | 472 |
453 virtual void AfterTest() OVERRIDE { | 473 virtual void AfterTest() OVERRIDE { |
454 LayerTreeHostDelegatedTestCaseSingleDelegatedLayer::AfterTest(); | 474 LayerTreeHostDelegatedTestCaseSingleDelegatedLayer::AfterTest(); |
455 EXPECT_EQ(2, num_output_surfaces_initialized_); | 475 EXPECT_EQ(2, num_output_surfaces_initialized_); |
456 } | 476 } |
457 | 477 |
458 protected: | 478 protected: |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2192 } | 2212 } |
2193 | 2213 |
2194 scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2214 scoped_refptr<DelegatedRendererLayer> delegated_thief_; |
2195 }; | 2215 }; |
2196 | 2216 |
2197 SINGLE_AND_MULTI_THREAD_TEST_F( | 2217 SINGLE_AND_MULTI_THREAD_TEST_F( |
2198 LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2218 LayerTreeHostDelegatedTestRemoveAndChangeResources); |
2199 | 2219 |
2200 } // namespace | 2220 } // namespace |
2201 } // namespace cc | 2221 } // namespace cc |
OLD | NEW |