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

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

Issue 1287043002: cc: Setup API to release OutputSurface from LTHClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 5 years, 3 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/delegated_frame_provider.h" 8 #include "cc/layers/delegated_frame_provider.h"
9 #include "cc/layers/delegated_frame_resource_collection.h" 9 #include "cc/layers/delegated_frame_resource_collection.h"
10 #include "cc/layers/heads_up_display_layer.h" 10 #include "cc/layers/heads_up_display_layer.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 376
377 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } 377 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); }
378 378
379 void AfterTest() override {} 379 void AfterTest() override {}
380 }; 380 };
381 381
382 SINGLE_AND_MULTI_THREAD_TEST_F( 382 SINGLE_AND_MULTI_THREAD_TEST_F(
383 LayerTreeHostClientNotReadyDoesNotCreateOutputSurface); 383 LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
384 384
385 class LayerTreeHostClientTakeAwayOutputSurface
386 : public LayerTreeHostContextTest {
387 public:
388 LayerTreeHostClientTakeAwayOutputSurface()
389 : LayerTreeHostContextTest(), setos_counter_(0), made_visible_(false) {}
390
391 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
392
393 void RequestNewOutputSurface() override {
394 if (!made_visible_)
no sievers 2015/09/11 22:44:50 You mean 'if (made_visible_)'? Or you could simply
sohanjg 2015/09/14 13:01:27 Done.
395 CreateAndSetOutputSurface();
396 }
397
398 void CreateAndSetOutputSurface() {
399 scoped_ptr<OutputSurface> surface =
400 LayerTreeHostContextTest::CreateOutputSurface();
401 CHECK(surface);
402 layer_tree_host()->SetOutputSurface(surface.Pass());
403 setos_counter_++;
404 }
405
406 void HideAndReleaseOutputSurface() {
407 EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
408 layer_tree_host()->SetVisible(false);
409 made_visible_ = false;
410 scoped_ptr<OutputSurface> surface =
411 layer_tree_host()->ReleaseOutputSurface();
412 CHECK(surface);
413 MainThreadTaskRunner()->PostTask(
414 FROM_HERE,
415 base::Bind(&LayerTreeHostClientTakeAwayOutputSurface::MakeVisible,
416 base::Unretained(this)));
417 }
418
419 void DidInitializeOutputSurface() override {
420 if (setos_counter_ == 0) {
no sievers 2015/09/11 22:44:50 == 1? Otherwise this is unreachable, and it probab
sohanjg 2015/09/14 13:01:27 Done.
421 EXPECT_TRUE(layer_tree_host()->visible());
422 MainThreadTaskRunner()->PostTask(
423 FROM_HERE, base::Bind(&LayerTreeHostClientTakeAwayOutputSurface::
424 HideAndReleaseOutputSurface,
425 base::Unretained(this)));
426 } else {
427 EndTest();
428 }
429 }
430
431 void MakeVisible() {
432 EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
433 layer_tree_host()->SetVisible(true);
434 made_visible_ = true;
435 }
436
437 void AfterTest() override {}
438
439 int setos_counter_;
440 bool made_visible_;
441 };
442
443 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostClientTakeAwayOutputSurface);
444
385 class MultipleCompositeDoesNotCreateOutputSurface 445 class MultipleCompositeDoesNotCreateOutputSurface
386 : public LayerTreeHostContextTest { 446 : public LayerTreeHostContextTest {
387 public: 447 public:
388 MultipleCompositeDoesNotCreateOutputSurface() 448 MultipleCompositeDoesNotCreateOutputSurface()
389 : LayerTreeHostContextTest(), request_count_(0) {} 449 : LayerTreeHostContextTest(), request_count_(0) {}
390 450
391 void InitializeSettings(LayerTreeSettings* settings) override { 451 void InitializeSettings(LayerTreeSettings* settings) override {
392 settings->single_thread_proxy_scheduler = false; 452 settings->single_thread_proxy_scheduler = false;
393 settings->use_zero_copy = true; 453 settings->use_zero_copy = true;
394 } 454 }
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 void AfterTest() override {} 1618 void AfterTest() override {}
1559 1619
1560 bool deferred_; 1620 bool deferred_;
1561 }; 1621 };
1562 1622
1563 SINGLE_AND_MULTI_THREAD_TEST_F( 1623 SINGLE_AND_MULTI_THREAD_TEST_F(
1564 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1624 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1565 1625
1566 } // namespace 1626 } // namespace
1567 } // namespace cc 1627 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698