| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 3284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3295 | 3295 |
| 3296 void ClearDidDrawCheck() { | 3296 void ClearDidDrawCheck() { |
| 3297 will_draw_called_ = false; | 3297 will_draw_called_ = false; |
| 3298 append_quads_called_ = false; | 3298 append_quads_called_ = false; |
| 3299 did_draw_called_ = false; | 3299 did_draw_called_ = false; |
| 3300 } | 3300 } |
| 3301 | 3301 |
| 3302 static void IgnoreResult(std::unique_ptr<CopyOutputResult> result) {} | 3302 static void IgnoreResult(std::unique_ptr<CopyOutputResult> result) {} |
| 3303 | 3303 |
| 3304 void AddCopyRequest() { | 3304 void AddCopyRequest() { |
| 3305 std::vector<std::unique_ptr<CopyOutputRequest>> requests; | 3305 test_properties()->copy_requests.push_back( |
| 3306 requests.push_back( | |
| 3307 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreResult))); | 3306 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreResult))); |
| 3308 test_properties()->force_render_surface = true; | |
| 3309 PassCopyRequests(&requests); | |
| 3310 } | 3307 } |
| 3311 | 3308 |
| 3312 protected: | 3309 protected: |
| 3313 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) | 3310 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) |
| 3314 : LayerImpl(tree_impl, id), | 3311 : LayerImpl(tree_impl, id), |
| 3315 will_draw_returns_false_(false), | 3312 will_draw_returns_false_(false), |
| 3316 will_draw_called_(false), | 3313 will_draw_called_(false), |
| 3317 append_quads_called_(false), | 3314 append_quads_called_(false), |
| 3318 did_draw_called_(false) { | 3315 did_draw_called_(false) { |
| 3319 SetBounds(gfx::Size(10, 10)); | 3316 SetBounds(gfx::Size(10, 10)); |
| (...skipping 4458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7778 | 7775 |
| 7779 TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) { | 7776 TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) { |
| 7780 scoped_refptr<TestContextProvider> context_provider = | 7777 scoped_refptr<TestContextProvider> context_provider = |
| 7781 TestContextProvider::Create(); | 7778 TestContextProvider::Create(); |
| 7782 | 7779 |
| 7783 CreateHostImpl(DefaultSettings(), | 7780 CreateHostImpl(DefaultSettings(), |
| 7784 FakeOutputSurface::Create3d(context_provider)); | 7781 FakeOutputSurface::Create3d(context_provider)); |
| 7785 | 7782 |
| 7786 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); | 7783 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); |
| 7787 | 7784 |
| 7788 std::vector<std::unique_ptr<CopyOutputRequest>> requests; | |
| 7789 requests.push_back(CopyOutputRequest::CreateRequest( | |
| 7790 base::Bind(&ShutdownReleasesContext_Callback))); | |
| 7791 | |
| 7792 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 7785 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
| 7793 root->PassCopyRequests(&requests); | 7786 root->test_properties()->copy_requests.push_back( |
| 7787 CopyOutputRequest::CreateRequest( |
| 7788 base::Bind(&ShutdownReleasesContext_Callback))); |
| 7794 | 7789 |
| 7795 LayerTreeHostImpl::FrameData frame; | 7790 LayerTreeHostImpl::FrameData frame; |
| 7796 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 7791 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
| 7797 host_impl_->DrawLayers(&frame); | 7792 host_impl_->DrawLayers(&frame); |
| 7798 host_impl_->DidDrawAllLayers(frame); | 7793 host_impl_->DidDrawAllLayers(frame); |
| 7799 | 7794 |
| 7800 // The CopyOutputResult's callback has a ref on the ContextProvider and a | 7795 // The CopyOutputResult's callback has a ref on the ContextProvider and a |
| 7801 // texture in a texture mailbox. | 7796 // texture in a texture mailbox. |
| 7802 EXPECT_FALSE(context_provider->HasOneRef()); | 7797 EXPECT_FALSE(context_provider->HasOneRef()); |
| 7803 EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures()); | 7798 EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures()); |
| (...skipping 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10751 | 10746 |
| 10752 // Re-initialize with a software output surface. | 10747 // Re-initialize with a software output surface. |
| 10753 output_surface_ = FakeOutputSurface::CreateSoftware( | 10748 output_surface_ = FakeOutputSurface::CreateSoftware( |
| 10754 base::WrapUnique(new SoftwareOutputDevice)); | 10749 base::WrapUnique(new SoftwareOutputDevice)); |
| 10755 host_impl_->InitializeRenderer(output_surface_.get()); | 10750 host_impl_->InitializeRenderer(output_surface_.get()); |
| 10756 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); | 10751 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); |
| 10757 } | 10752 } |
| 10758 | 10753 |
| 10759 } // namespace | 10754 } // namespace |
| 10760 } // namespace cc | 10755 } // namespace cc |
| OLD | NEW |