| OLD | NEW |
| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 178 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 179 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); | 179 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); |
| 180 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 180 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 181 } | 181 } |
| 182 | 182 |
| 183 virtual void TearDown() { | 183 virtual void TearDown() { |
| 184 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 184 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 185 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 185 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 186 | 186 |
| 187 layer_tree_host_->SetRootLayer(NULL); | 187 layer_tree_host_->SetRootLayer(NULL); |
| 188 layer_tree_host_.reset(); | 188 layer_tree_host_ = nullptr; |
| 189 } | 189 } |
| 190 | 190 |
| 191 scoped_ptr<MockLayerTreeHost> layer_tree_host_; | 191 scoped_ptr<MockLayerTreeHost> layer_tree_host_; |
| 192 FakeImplProxy proxy_; | 192 FakeImplProxy proxy_; |
| 193 FakeLayerTreeHostClient fake_client_; | 193 FakeLayerTreeHostClient fake_client_; |
| 194 TestSharedBitmapManager shared_bitmap_manager_; | 194 TestSharedBitmapManager shared_bitmap_manager_; |
| 195 FakeLayerTreeHostImpl host_impl_; | 195 FakeLayerTreeHostImpl host_impl_; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { | 198 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); | 415 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); |
| 416 event.Wait(); | 416 event.Wait(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 void CreateMainRef() { | 419 void CreateMainRef() { |
| 420 main_ref_ = TestMailboxHolder::Create( | 420 main_ref_ = TestMailboxHolder::Create( |
| 421 test_data_.mailbox1_, | 421 test_data_.mailbox1_, |
| 422 SingleReleaseCallback::Create(test_data_.release_mailbox1_)).Pass(); | 422 SingleReleaseCallback::Create(test_data_.release_mailbox1_)).Pass(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void ReleaseMainRef() { | 425 void ReleaseMainRef() { main_ref_ = nullptr; } |
| 426 main_ref_.reset(); | |
| 427 } | |
| 428 | 426 |
| 429 void CreateImplRef(scoped_ptr<SingleReleaseCallbackImpl>* impl_ref) { | 427 void CreateImplRef(scoped_ptr<SingleReleaseCallbackImpl>* impl_ref) { |
| 430 *impl_ref = main_ref_->holder()->GetCallbackForImplThread(); | 428 *impl_ref = main_ref_->holder()->GetCallbackForImplThread(); |
| 431 } | 429 } |
| 432 | 430 |
| 433 void CapturePostTasksAndWait(base::WaitableEvent* begin_capture, | 431 void CapturePostTasksAndWait(base::WaitableEvent* begin_capture, |
| 434 base::WaitableEvent* wait_for_capture, | 432 base::WaitableEvent* wait_for_capture, |
| 435 base::WaitableEvent* stop_capture) { | 433 base::WaitableEvent* stop_capture) { |
| 436 begin_capture->Wait(); | 434 begin_capture->Wait(); |
| 437 BlockingTaskRunner::CapturePostTasks capture( | 435 BlockingTaskRunner::CapturePostTasks capture( |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 | 923 |
| 926 class TextureLayerImplWithMailboxTest : public TextureLayerTest { | 924 class TextureLayerImplWithMailboxTest : public TextureLayerTest { |
| 927 protected: | 925 protected: |
| 928 TextureLayerImplWithMailboxTest() | 926 TextureLayerImplWithMailboxTest() |
| 929 : fake_client_( | 927 : fake_client_( |
| 930 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} | 928 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} |
| 931 | 929 |
| 932 virtual void SetUp() { | 930 virtual void SetUp() { |
| 933 TextureLayerTest::SetUp(); | 931 TextureLayerTest::SetUp(); |
| 934 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); | 932 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); |
| 935 EXPECT_TRUE(host_impl_.InitializeRenderer( | 933 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); |
| 936 FakeOutputSurface::Create3d().PassAs<OutputSurface>())); | |
| 937 } | 934 } |
| 938 | 935 |
| 939 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { | 936 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { |
| 940 bool will_draw = layer->WillDraw( | 937 bool will_draw = layer->WillDraw( |
| 941 mode, host_impl_.active_tree()->resource_provider()); | 938 mode, host_impl_.active_tree()->resource_provider()); |
| 942 if (will_draw) | 939 if (will_draw) |
| 943 layer->DidDraw(host_impl_.active_tree()->resource_provider()); | 940 layer->DidDraw(host_impl_.active_tree()->resource_provider()); |
| 944 return will_draw; | 941 return will_draw; |
| 945 } | 942 } |
| 946 | 943 |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 int callback_count_; | 1575 int callback_count_; |
| 1579 scoped_refptr<Layer> root_; | 1576 scoped_refptr<Layer> root_; |
| 1580 scoped_refptr<TextureLayer> layer_; | 1577 scoped_refptr<TextureLayer> layer_; |
| 1581 }; | 1578 }; |
| 1582 | 1579 |
| 1583 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1580 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1584 TextureLayerWithMailboxImplThreadDeleted); | 1581 TextureLayerWithMailboxImplThreadDeleted); |
| 1585 | 1582 |
| 1586 } // namespace | 1583 } // namespace |
| 1587 } // namespace cc | 1584 } // namespace cc |
| OLD | NEW |