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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 | 3475 |
3476 unsigned num_textures() const { return num_textures_; } | 3476 unsigned num_textures() const { return num_textures_; } |
3477 | 3477 |
3478 private: | 3478 private: |
3479 base::hash_map<WebKit::WebGLId, bool> textures_; | 3479 base::hash_map<WebKit::WebGLId, bool> textures_; |
3480 unsigned num_textures_; | 3480 unsigned num_textures_; |
3481 }; | 3481 }; |
3482 | 3482 |
3483 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { | 3483 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { |
3484 scoped_ptr<TestWebGraphicsContext3D> context = | 3484 scoped_ptr<TestWebGraphicsContext3D> context = |
3485 TestWebGraphicsContext3D::Create(); | 3485 TestWebGraphicsContext3D::CreateShared(); |
3486 TestWebGraphicsContext3D* context3d = context.get(); | 3486 TestWebGraphicsContext3D* context3d = context.get(); |
3487 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( | 3487 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( |
3488 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 3488 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
3489 host_impl_->InitializeRenderer(output_surface.Pass()); | 3489 host_impl_->InitializeRenderer(output_surface.Pass()); |
3490 | 3490 |
3491 scoped_ptr<LayerImpl> root_layer = | 3491 scoped_ptr<LayerImpl> root_layer = |
3492 LayerImpl::Create(host_impl_->active_tree(), 1); | 3492 LayerImpl::Create(host_impl_->active_tree(), 1); |
3493 root_layer->SetBounds(gfx::Size(10, 10)); | 3493 root_layer->SetBounds(gfx::Size(10, 10)); |
3494 root_layer->SetAnchorPoint(gfx::PointF()); | 3494 root_layer->SetAnchorPoint(gfx::PointF()); |
3495 | 3495 |
(...skipping 2519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6015 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); | 6015 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); |
6016 SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); | 6016 SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); |
6017 | 6017 |
6018 // Software draw. | 6018 // Software draw. |
6019 DrawFrame(); | 6019 DrawFrame(); |
6020 | 6020 |
6021 // DeferredInitialize and hardware draw. | 6021 // DeferredInitialize and hardware draw. |
6022 EXPECT_FALSE(did_try_initialize_renderer_); | 6022 EXPECT_FALSE(did_try_initialize_renderer_); |
6023 EXPECT_TRUE(output_surface_ptr->SetAndInitializeContext3D( | 6023 EXPECT_TRUE(output_surface_ptr->SetAndInitializeContext3D( |
6024 scoped_ptr<WebKit::WebGraphicsContext3D>( | 6024 scoped_ptr<WebKit::WebGraphicsContext3D>( |
6025 TestWebGraphicsContext3D::Create()))); | 6025 TestWebGraphicsContext3D::CreateShared()))); |
6026 EXPECT_TRUE(did_try_initialize_renderer_); | 6026 EXPECT_TRUE(did_try_initialize_renderer_); |
6027 | 6027 |
6028 // Defer intialized GL draw. | 6028 // Defer intialized GL draw. |
6029 DrawFrame(); | 6029 DrawFrame(); |
6030 | 6030 |
6031 // Revert back to software. | 6031 // Revert back to software. |
6032 did_try_initialize_renderer_ = false; | 6032 did_try_initialize_renderer_ = false; |
6033 output_surface_ptr->ReleaseGL(); | 6033 output_surface_ptr->ReleaseGL(); |
6034 EXPECT_TRUE(did_try_initialize_renderer_); | 6034 EXPECT_TRUE(did_try_initialize_renderer_); |
6035 DrawFrame(); | 6035 DrawFrame(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6091 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); | 6091 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); |
6092 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); | 6092 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); |
6093 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); | 6093 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); |
6094 host_impl_->SetVisible(false); | 6094 host_impl_->SetVisible(false); |
6095 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); | 6095 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); |
6096 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); | 6096 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); |
6097 } | 6097 } |
6098 | 6098 |
6099 } // namespace | 6099 } // namespace |
6100 } // namespace cc | 6100 } // namespace cc |
OLD | NEW |