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/layers/texture_layer_unittest.cc

Issue 189333003: cc: Allow pepper to avoid DCHECK but reuse gpu::Mailbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: baddcheck: compile Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/texture_layer.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('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/layers/texture_layer.h" 5 #include "cc/layers/texture_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 452 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
453 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); 453 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_);
454 454
455 // Test destructor. 455 // Test destructor.
456 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); 456 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1));
457 test_layer->SetTextureMailbox( 457 test_layer->SetTextureMailbox(
458 test_data_.mailbox1_, 458 test_data_.mailbox1_,
459 SingleReleaseCallback::Create(test_data_.release_mailbox1_)); 459 SingleReleaseCallback::Create(test_data_.release_mailbox1_));
460 } 460 }
461 461
462 TEST_F(TextureLayerTest, SetTextureMailboxWithoutReleaseCallback) {
463 scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL);
464 ASSERT_TRUE(test_layer.get());
465
466 // These use the same gpu::Mailbox, but different sync points.
467 TextureMailbox mailbox1(MailboxFromChar('a'), GL_TEXTURE_2D, 1);
468 TextureMailbox mailbox2(MailboxFromChar('a'), GL_TEXTURE_2D, 2);
469
470 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0);
471 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
472 layer_tree_host_->SetRootLayer(test_layer);
473 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
474
475 // Set the mailbox the first time. It should cause a commit.
476 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0);
477 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1));
478 test_layer->SetTextureMailboxWithoutReleaseCallback(mailbox1);
479 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
480
481 // Set the mailbox again with a new sync point, as the backing texture has
482 // been updated. It should cause a new commit.
483 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0);
484 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1));
485 test_layer->SetTextureMailboxWithoutReleaseCallback(mailbox2);
486 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
487 }
488
462 class TextureLayerMailboxHolderTest : public TextureLayerTest { 489 class TextureLayerMailboxHolderTest : public TextureLayerTest {
463 public: 490 public:
464 TextureLayerMailboxHolderTest() 491 TextureLayerMailboxHolderTest()
465 : main_thread_("MAIN") { 492 : main_thread_("MAIN") {
466 main_thread_.Start(); 493 main_thread_.Start();
467 } 494 }
468 495
469 void Wait(const base::Thread& thread) { 496 void Wait(const base::Thread& thread) {
470 bool manual_reset = false; 497 bool manual_reset = false;
471 bool initially_signaled = false; 498 bool initially_signaled = false;
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 int callback_count_; 2191 int callback_count_;
2165 scoped_refptr<Layer> root_; 2192 scoped_refptr<Layer> root_;
2166 scoped_refptr<TextureLayer> layer_; 2193 scoped_refptr<TextureLayer> layer_;
2167 }; 2194 };
2168 2195
2169 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 2196 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
2170 TextureLayerWithMailboxImplThreadDeleted); 2197 TextureLayerWithMailboxImplThreadDeleted);
2171 2198
2172 } // namespace 2199 } // namespace
2173 } // namespace cc 2200 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698