Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: cc/trees/layer_tree_host_unittest_delegated.cc

Issue 478703002: Remove cc::LayerTreeHostImpl::IsContextLost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ctx4
Patch Set: Include all changes. Prev patchset was second stage only Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // The single thread proxy notifies the layer tree host of surface loss
384 // after the commit is complete. So the commit number is 1 more than in the
385 // multithreaded case.
386 if (HasImplThread())
387 EXPECT_EQ(2, num_activates_);
388 else
389 EXPECT_EQ(3, num_activates_);
374 EXPECT_FALSE(delegated_impl->ChildId()); 390 EXPECT_FALSE(delegated_impl->ChildId());
375 did_reset_child_id_ = true; 391 did_reset_child_id_ = true;
376 } 392 }
377 393
378 protected: 394 protected:
379 int num_activates_; 395 int num_activates_;
380 bool did_reset_child_id_; 396 bool did_reset_child_id_;
381 }; 397 };
382 398
383 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCreateChildId); 399 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCreateChildId);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 bool success) OVERRIDE { 454 bool success) OVERRIDE {
439 EXPECT_TRUE(success); 455 EXPECT_TRUE(success);
440 456
441 if (num_activates_ < 2) 457 if (num_activates_ < 2)
442 return; 458 return;
443 459
444 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); 460 LayerImpl* root_impl = host_impl->active_tree()->root_layer();
445 FakeDelegatedRendererLayerImpl* delegated_impl = 461 FakeDelegatedRendererLayerImpl* delegated_impl =
446 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); 462 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
447 463
448 EXPECT_EQ(2, num_activates_); 464 // The single thread proxy notifies the layer tree host of surface loss
465 // after the commit is complete. So the commit number is 1 more than in the
466 // multithreaded case.
467 if (HasImplThread())
468 EXPECT_EQ(2, num_activates_);
469 else
470 EXPECT_EQ(3, num_activates_);
449 // Resources should have gotten cleared after the context was lost. 471 // Resources should have gotten cleared after the context was lost.
450 EXPECT_EQ(0U, delegated_impl->Resources().size()); 472 EXPECT_EQ(0U, delegated_impl->Resources().size());
451 } 473 }
452 474
453 virtual void AfterTest() OVERRIDE { 475 virtual void AfterTest() OVERRIDE {
454 LayerTreeHostDelegatedTestCaseSingleDelegatedLayer::AfterTest(); 476 LayerTreeHostDelegatedTestCaseSingleDelegatedLayer::AfterTest();
455 EXPECT_EQ(2, num_output_surfaces_initialized_); 477 EXPECT_EQ(2, num_output_surfaces_initialized_);
456 } 478 }
457 479
458 protected: 480 protected:
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 } 2214 }
2193 2215
2194 scoped_refptr<DelegatedRendererLayer> delegated_thief_; 2216 scoped_refptr<DelegatedRendererLayer> delegated_thief_;
2195 }; 2217 };
2196 2218
2197 SINGLE_AND_MULTI_THREAD_TEST_F( 2219 SINGLE_AND_MULTI_THREAD_TEST_F(
2198 LayerTreeHostDelegatedTestRemoveAndChangeResources); 2220 LayerTreeHostDelegatedTestRemoveAndChangeResources);
2199 2221
2200 } // namespace 2222 } // namespace
2201 } // namespace cc 2223 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698