| 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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
| 9 #include "cc/heads_up_display_layer.h" | 9 #include "cc/heads_up_display_layer.h" |
| 10 #include "cc/io_surface_layer.h" | 10 #include "cc/io_surface_layer.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 class LayerTreeHostContextTestLostContextSucceedsWithContent : | 383 class LayerTreeHostContextTestLostContextSucceedsWithContent : |
| 384 public LayerTreeHostContextTestLostContextSucceeds { | 384 public LayerTreeHostContextTestLostContextSucceeds { |
| 385 public: | 385 public: |
| 386 | 386 |
| 387 LayerTreeHostContextTestLostContextSucceedsWithContent() | 387 LayerTreeHostContextTestLostContextSucceedsWithContent() |
| 388 : LayerTreeHostContextTestLostContextSucceeds() { | 388 : LayerTreeHostContextTestLostContextSucceeds() { |
| 389 } | 389 } |
| 390 | 390 |
| 391 virtual void setupTree() OVERRIDE { | 391 virtual void setupTree() OVERRIDE { |
| 392 root_ = Layer::create(); | 392 root_ = Layer::Create(); |
| 393 root_->setBounds(gfx::Size(10, 10)); | 393 root_->SetBounds(gfx::Size(10, 10)); |
| 394 root_->setAnchorPoint(gfx::PointF()); | 394 root_->SetAnchorPoint(gfx::PointF()); |
| 395 root_->setIsDrawable(true); | 395 root_->SetIsDrawable(true); |
| 396 | 396 |
| 397 content_ = FakeContentLayer::Create(&client_); | 397 content_ = FakeContentLayer::Create(&client_); |
| 398 content_->setBounds(gfx::Size(10, 10)); | 398 content_->SetBounds(gfx::Size(10, 10)); |
| 399 content_->setAnchorPoint(gfx::PointF()); | 399 content_->SetAnchorPoint(gfx::PointF()); |
| 400 content_->setIsDrawable(true); | 400 content_->SetIsDrawable(true); |
| 401 if (use_surface_) { | 401 if (use_surface_) { |
| 402 content_->setForceRenderSurface(true); | 402 content_->SetForceRenderSurface(true); |
| 403 // Filters require us to create an offscreen context. | 403 // Filters require us to create an offscreen context. |
| 404 WebKit::WebFilterOperations filters; | 404 WebKit::WebFilterOperations filters; |
| 405 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5f)); | 405 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5f)); |
| 406 content_->setFilters(filters); | 406 content_->SetFilters(filters); |
| 407 content_->setBackgroundFilters(filters); | 407 content_->SetBackgroundFilters(filters); |
| 408 } | 408 } |
| 409 | 409 |
| 410 root_->addChild(content_); | 410 root_->AddChild(content_); |
| 411 | 411 |
| 412 m_layerTreeHost->setRootLayer(root_); | 412 m_layerTreeHost->setRootLayer(root_); |
| 413 LayerTreeHostContextTest::setupTree(); | 413 LayerTreeHostContextTest::setupTree(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { | 416 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { |
| 417 // Invalidate the render surface so we don't try to use a cached copy of the | 417 // Invalidate the render surface so we don't try to use a cached copy of the |
| 418 // surface. We want to make sure to test the drawing paths for drawing to | 418 // surface. We want to make sure to test the drawing paths for drawing to |
| 419 // a child surface. | 419 // a child surface. |
| 420 content_->setNeedsDisplay(); | 420 content_->SetNeedsDisplay(); |
| 421 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); | 421 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); |
| 422 } | 422 } |
| 423 | 423 |
| 424 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 424 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 425 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( | 425 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( |
| 426 host_impl->rootLayer()->children()[0]); | 426 host_impl->rootLayer()->children()[0]); |
| 427 // Even though the context was lost, we should have a resource. The | 427 // Even though the context was lost, we should have a resource. The |
| 428 // TestWebGraphicsContext3D ensures that this resource is created with | 428 // TestWebGraphicsContext3D ensures that this resource is created with |
| 429 // the active context. | 429 // the active context. |
| 430 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); | 430 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 TEST_F(LayerTreeHostContextTestLostContextSucceedsWithContent, | 483 TEST_F(LayerTreeHostContextTestLostContextSucceedsWithContent, |
| 484 WithSurface_MultiThread) { | 484 WithSurface_MultiThread) { |
| 485 use_surface_ = true; | 485 use_surface_ = true; |
| 486 runTest(true); | 486 runTest(true); |
| 487 } | 487 } |
| 488 | 488 |
| 489 class LayerTreeHostContextTestOffscreenContextFails | 489 class LayerTreeHostContextTestOffscreenContextFails |
| 490 : public LayerTreeHostContextTest { | 490 : public LayerTreeHostContextTest { |
| 491 public: | 491 public: |
| 492 virtual void setupTree() OVERRIDE { | 492 virtual void setupTree() OVERRIDE { |
| 493 root_ = Layer::create(); | 493 root_ = Layer::Create(); |
| 494 root_->setBounds(gfx::Size(10, 10)); | 494 root_->SetBounds(gfx::Size(10, 10)); |
| 495 root_->setAnchorPoint(gfx::PointF()); | 495 root_->SetAnchorPoint(gfx::PointF()); |
| 496 root_->setIsDrawable(true); | 496 root_->SetIsDrawable(true); |
| 497 | 497 |
| 498 content_ = FakeContentLayer::Create(&client_); | 498 content_ = FakeContentLayer::Create(&client_); |
| 499 content_->setBounds(gfx::Size(10, 10)); | 499 content_->SetBounds(gfx::Size(10, 10)); |
| 500 content_->setAnchorPoint(gfx::PointF()); | 500 content_->SetAnchorPoint(gfx::PointF()); |
| 501 content_->setIsDrawable(true); | 501 content_->SetIsDrawable(true); |
| 502 content_->setForceRenderSurface(true); | 502 content_->SetForceRenderSurface(true); |
| 503 // Filters require us to create an offscreen context. | 503 // Filters require us to create an offscreen context. |
| 504 WebKit::WebFilterOperations filters; | 504 WebKit::WebFilterOperations filters; |
| 505 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5f)); | 505 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5f)); |
| 506 content_->setFilters(filters); | 506 content_->SetFilters(filters); |
| 507 content_->setBackgroundFilters(filters); | 507 content_->SetBackgroundFilters(filters); |
| 508 | 508 |
| 509 root_->addChild(content_); | 509 root_->AddChild(content_); |
| 510 | 510 |
| 511 m_layerTreeHost->setRootLayer(root_); | 511 m_layerTreeHost->setRootLayer(root_); |
| 512 LayerTreeHostContextTest::setupTree(); | 512 LayerTreeHostContextTest::setupTree(); |
| 513 } | 513 } |
| 514 | 514 |
| 515 virtual void beginTest() OVERRIDE { | 515 virtual void beginTest() OVERRIDE { |
| 516 times_to_fail_create_offscreen_ = 1; | 516 times_to_fail_create_offscreen_ = 1; |
| 517 postSetNeedsCommitToMainThread(); | 517 postSetNeedsCommitToMainThread(); |
| 518 } | 518 } |
| 519 | 519 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 public LayerTreeHostContextTest { | 644 public LayerTreeHostContextTest { |
| 645 public: | 645 public: |
| 646 LayerTreeHostContextTestLostContextAndEvictTextures() | 646 LayerTreeHostContextTestLostContextAndEvictTextures() |
| 647 : LayerTreeHostContextTest(), | 647 : LayerTreeHostContextTest(), |
| 648 layer_(FakeContentLayer::Create(&client_)), | 648 layer_(FakeContentLayer::Create(&client_)), |
| 649 impl_host_(0), | 649 impl_host_(0), |
| 650 num_commits_(0) { | 650 num_commits_(0) { |
| 651 } | 651 } |
| 652 | 652 |
| 653 virtual void setupTree() OVERRIDE { | 653 virtual void setupTree() OVERRIDE { |
| 654 layer_->setBounds(gfx::Size(10, 20)); | 654 layer_->SetBounds(gfx::Size(10, 20)); |
| 655 m_layerTreeHost->setRootLayer(layer_); | 655 m_layerTreeHost->setRootLayer(layer_); |
| 656 LayerTreeHostContextTest::setupTree(); | 656 LayerTreeHostContextTest::setupTree(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 virtual void beginTest() OVERRIDE { | 659 virtual void beginTest() OVERRIDE { |
| 660 postSetNeedsCommitToMainThread(); | 660 postSetNeedsCommitToMainThread(); |
| 661 } | 661 } |
| 662 | 662 |
| 663 void PostEvictTextures() { | 663 void PostEvictTextures() { |
| 664 if (ImplThread()) { | 664 if (ImplThread()) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 scoped_ptr<TestWebGraphicsContext3D> context = | 748 scoped_ptr<TestWebGraphicsContext3D> context = |
| 749 LayerTreeHostContextTest::CreateContext3d(); | 749 LayerTreeHostContextTest::CreateContext3d(); |
| 750 if (times_to_lose_on_end_query_) { | 750 if (times_to_lose_on_end_query_) { |
| 751 --times_to_lose_on_end_query_; | 751 --times_to_lose_on_end_query_; |
| 752 context->set_times_end_query_succeeds(5); | 752 context->set_times_end_query_succeeds(5); |
| 753 } | 753 } |
| 754 return context.Pass(); | 754 return context.Pass(); |
| 755 } | 755 } |
| 756 | 756 |
| 757 virtual void setupTree() OVERRIDE { | 757 virtual void setupTree() OVERRIDE { |
| 758 parent_->setBounds(gfx::Size(num_children_, 1)); | 758 parent_->SetBounds(gfx::Size(num_children_, 1)); |
| 759 | 759 |
| 760 for (int i = 0; i < num_children_; i++) { | 760 for (int i = 0; i < num_children_; i++) { |
| 761 scoped_refptr<FakeContentLayer> child = | 761 scoped_refptr<FakeContentLayer> child = |
| 762 FakeContentLayer::Create(&client_); | 762 FakeContentLayer::Create(&client_); |
| 763 child->setPosition(gfx::PointF(i, 0.f)); | 763 child->SetPosition(gfx::PointF(i, 0.f)); |
| 764 child->setBounds(gfx::Size(1, 1)); | 764 child->SetBounds(gfx::Size(1, 1)); |
| 765 parent_->addChild(child); | 765 parent_->AddChild(child); |
| 766 } | 766 } |
| 767 | 767 |
| 768 m_layerTreeHost->setRootLayer(parent_); | 768 m_layerTreeHost->setRootLayer(parent_); |
| 769 LayerTreeHostContextTest::setupTree(); | 769 LayerTreeHostContextTest::setupTree(); |
| 770 } | 770 } |
| 771 | 771 |
| 772 virtual void beginTest() OVERRIDE { | 772 virtual void beginTest() OVERRIDE { |
| 773 postSetNeedsCommitToMainThread(); | 773 postSetNeedsCommitToMainThread(); |
| 774 } | 774 } |
| 775 | 775 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 802 LayerTreeHostContextTestLayersNotified() | 802 LayerTreeHostContextTestLayersNotified() |
| 803 : LayerTreeHostContextTest(), | 803 : LayerTreeHostContextTest(), |
| 804 num_commits_(0) { | 804 num_commits_(0) { |
| 805 } | 805 } |
| 806 | 806 |
| 807 virtual void setupTree() OVERRIDE { | 807 virtual void setupTree() OVERRIDE { |
| 808 root_ = FakeContentLayer::Create(&client_); | 808 root_ = FakeContentLayer::Create(&client_); |
| 809 child_ = FakeContentLayer::Create(&client_); | 809 child_ = FakeContentLayer::Create(&client_); |
| 810 grandchild_ = FakeContentLayer::Create(&client_); | 810 grandchild_ = FakeContentLayer::Create(&client_); |
| 811 | 811 |
| 812 root_->addChild(child_); | 812 root_->AddChild(child_); |
| 813 child_->addChild(grandchild_); | 813 child_->AddChild(grandchild_); |
| 814 | 814 |
| 815 m_layerTreeHost->setRootLayer(root_); | 815 m_layerTreeHost->setRootLayer(root_); |
| 816 LayerTreeHostContextTest::setupTree(); | 816 LayerTreeHostContextTest::setupTree(); |
| 817 } | 817 } |
| 818 | 818 |
| 819 virtual void beginTest() OVERRIDE { | 819 virtual void beginTest() OVERRIDE { |
| 820 postSetNeedsCommitToMainThread(); | 820 postSetNeedsCommitToMainThread(); |
| 821 } | 821 } |
| 822 | 822 |
| 823 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 823 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 | 880 |
| 881 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLayersNotified) | 881 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLayersNotified) |
| 882 | 882 |
| 883 class LayerTreeHostContextTestDontUseLostResources : | 883 class LayerTreeHostContextTestDontUseLostResources : |
| 884 public LayerTreeHostContextTest { | 884 public LayerTreeHostContextTest { |
| 885 public: | 885 public: |
| 886 virtual void setupTree() OVERRIDE { | 886 virtual void setupTree() OVERRIDE { |
| 887 context3d_->set_have_extension_io_surface(true); | 887 context3d_->set_have_extension_io_surface(true); |
| 888 context3d_->set_have_extension_egl_image(true); | 888 context3d_->set_have_extension_egl_image(true); |
| 889 | 889 |
| 890 scoped_refptr<Layer> root_ = Layer::create(); | 890 scoped_refptr<Layer> root_ = Layer::Create(); |
| 891 root_->setBounds(gfx::Size(10, 10)); | 891 root_->SetBounds(gfx::Size(10, 10)); |
| 892 root_->setAnchorPoint(gfx::PointF()); | 892 root_->SetAnchorPoint(gfx::PointF()); |
| 893 root_->setIsDrawable(true); | 893 root_->SetIsDrawable(true); |
| 894 | 894 |
| 895 scoped_refptr<FakeDelegatedRendererLayer> delegated_ = | 895 scoped_refptr<FakeDelegatedRendererLayer> delegated_ = |
| 896 FakeDelegatedRendererLayer::Create(); | 896 FakeDelegatedRendererLayer::Create(); |
| 897 delegated_->setBounds(gfx::Size(10, 10)); | 897 delegated_->SetBounds(gfx::Size(10, 10)); |
| 898 delegated_->setAnchorPoint(gfx::PointF()); | 898 delegated_->SetAnchorPoint(gfx::PointF()); |
| 899 delegated_->setIsDrawable(true); | 899 delegated_->SetIsDrawable(true); |
| 900 root_->addChild(delegated_); | 900 root_->AddChild(delegated_); |
| 901 | 901 |
| 902 scoped_refptr<ContentLayer> content_ = ContentLayer::create(&client_); | 902 scoped_refptr<ContentLayer> content_ = ContentLayer::Create(&client_); |
| 903 content_->setBounds(gfx::Size(10, 10)); | 903 content_->SetBounds(gfx::Size(10, 10)); |
| 904 content_->setAnchorPoint(gfx::PointF()); | 904 content_->SetAnchorPoint(gfx::PointF()); |
| 905 content_->setIsDrawable(true); | 905 content_->SetIsDrawable(true); |
| 906 root_->addChild(content_); | 906 root_->AddChild(content_); |
| 907 | 907 |
| 908 scoped_refptr<TextureLayer> texture_ = TextureLayer::create(NULL); | 908 scoped_refptr<TextureLayer> texture_ = TextureLayer::Create(NULL); |
| 909 texture_->setBounds(gfx::Size(10, 10)); | 909 texture_->SetBounds(gfx::Size(10, 10)); |
| 910 texture_->setAnchorPoint(gfx::PointF()); | 910 texture_->SetAnchorPoint(gfx::PointF()); |
| 911 texture_->setTextureId(TestWebGraphicsContext3D::kExternalTextureId); | 911 texture_->setTextureId(TestWebGraphicsContext3D::kExternalTextureId); |
| 912 texture_->setIsDrawable(true); | 912 texture_->SetIsDrawable(true); |
| 913 root_->addChild(texture_); | 913 root_->AddChild(texture_); |
| 914 | 914 |
| 915 scoped_refptr<ContentLayer> mask_ = ContentLayer::create(&client_); | 915 scoped_refptr<ContentLayer> mask_ = ContentLayer::Create(&client_); |
| 916 mask_->setBounds(gfx::Size(10, 10)); | 916 mask_->SetBounds(gfx::Size(10, 10)); |
| 917 mask_->setAnchorPoint(gfx::PointF()); | 917 mask_->SetAnchorPoint(gfx::PointF()); |
| 918 | 918 |
| 919 scoped_refptr<ContentLayer> content_with_mask_ = | 919 scoped_refptr<ContentLayer> content_with_mask_ = |
| 920 ContentLayer::create(&client_); | 920 ContentLayer::Create(&client_); |
| 921 content_with_mask_->setBounds(gfx::Size(10, 10)); | 921 content_with_mask_->SetBounds(gfx::Size(10, 10)); |
| 922 content_with_mask_->setAnchorPoint(gfx::PointF()); | 922 content_with_mask_->SetAnchorPoint(gfx::PointF()); |
| 923 content_with_mask_->setIsDrawable(true); | 923 content_with_mask_->SetIsDrawable(true); |
| 924 content_with_mask_->setMaskLayer(mask_.get()); | 924 content_with_mask_->SetMaskLayer(mask_.get()); |
| 925 root_->addChild(content_with_mask_); | 925 root_->AddChild(content_with_mask_); |
| 926 | 926 |
| 927 scoped_refptr<VideoLayer> video_color_ = VideoLayer::create( | 927 scoped_refptr<VideoLayer> video_color_ = VideoLayer::Create( |
| 928 &color_frame_provider_); | 928 &color_frame_provider_); |
| 929 video_color_->setBounds(gfx::Size(10, 10)); | 929 video_color_->SetBounds(gfx::Size(10, 10)); |
| 930 video_color_->setAnchorPoint(gfx::PointF()); | 930 video_color_->SetAnchorPoint(gfx::PointF()); |
| 931 video_color_->setIsDrawable(true); | 931 video_color_->SetIsDrawable(true); |
| 932 root_->addChild(video_color_); | 932 root_->AddChild(video_color_); |
| 933 | 933 |
| 934 scoped_refptr<VideoLayer> video_hw_ = VideoLayer::create( | 934 scoped_refptr<VideoLayer> video_hw_ = VideoLayer::Create( |
| 935 &hw_frame_provider_); | 935 &hw_frame_provider_); |
| 936 video_hw_->setBounds(gfx::Size(10, 10)); | 936 video_hw_->SetBounds(gfx::Size(10, 10)); |
| 937 video_hw_->setAnchorPoint(gfx::PointF()); | 937 video_hw_->SetAnchorPoint(gfx::PointF()); |
| 938 video_hw_->setIsDrawable(true); | 938 video_hw_->SetIsDrawable(true); |
| 939 root_->addChild(video_hw_); | 939 root_->AddChild(video_hw_); |
| 940 | 940 |
| 941 scoped_refptr<VideoLayer> video_scaled_hw_ = VideoLayer::create( | 941 scoped_refptr<VideoLayer> video_scaled_hw_ = VideoLayer::Create( |
| 942 &scaled_hw_frame_provider_); | 942 &scaled_hw_frame_provider_); |
| 943 video_scaled_hw_->setBounds(gfx::Size(10, 10)); | 943 video_scaled_hw_->SetBounds(gfx::Size(10, 10)); |
| 944 video_scaled_hw_->setAnchorPoint(gfx::PointF()); | 944 video_scaled_hw_->SetAnchorPoint(gfx::PointF()); |
| 945 video_scaled_hw_->setIsDrawable(true); | 945 video_scaled_hw_->SetIsDrawable(true); |
| 946 root_->addChild(video_scaled_hw_); | 946 root_->AddChild(video_scaled_hw_); |
| 947 | 947 |
| 948 scoped_refptr<IOSurfaceLayer> io_surface_ = IOSurfaceLayer::create(); | 948 scoped_refptr<IOSurfaceLayer> io_surface_ = IOSurfaceLayer::Create(); |
| 949 io_surface_->setBounds(gfx::Size(10, 10)); | 949 io_surface_->SetBounds(gfx::Size(10, 10)); |
| 950 io_surface_->setAnchorPoint(gfx::PointF()); | 950 io_surface_->SetAnchorPoint(gfx::PointF()); |
| 951 io_surface_->setIsDrawable(true); | 951 io_surface_->SetIsDrawable(true); |
| 952 io_surface_->setIOSurfaceProperties(1, gfx::Size(10, 10)); | 952 io_surface_->setIOSurfaceProperties(1, gfx::Size(10, 10)); |
| 953 root_->addChild(io_surface_); | 953 root_->AddChild(io_surface_); |
| 954 | 954 |
| 955 // Enable the hud. | 955 // Enable the hud. |
| 956 LayerTreeDebugState debug_state; | 956 LayerTreeDebugState debug_state; |
| 957 debug_state.showPropertyChangedRects = true; | 957 debug_state.showPropertyChangedRects = true; |
| 958 m_layerTreeHost->setDebugState(debug_state); | 958 m_layerTreeHost->setDebugState(debug_state); |
| 959 | 959 |
| 960 bool paint_scrollbar = true; | 960 bool paint_scrollbar = true; |
| 961 bool has_thumb = true; | 961 bool has_thumb = true; |
| 962 scoped_refptr<ScrollbarLayer> scrollbar_ = ScrollbarLayer::Create( | 962 scoped_refptr<ScrollbarLayer> scrollbar_ = ScrollbarLayer::Create( |
| 963 FakeWebScrollbar::Create().PassAs<WebKit::WebScrollbar>(), | 963 FakeWebScrollbar::Create().PassAs<WebKit::WebScrollbar>(), |
| 964 FakeScrollbarThemePainter::Create(paint_scrollbar) | 964 FakeScrollbarThemePainter::Create(paint_scrollbar) |
| 965 .PassAs<ScrollbarThemePainter>(), | 965 .PassAs<ScrollbarThemePainter>(), |
| 966 FakeWebScrollbarThemeGeometry::create(has_thumb) | 966 FakeWebScrollbarThemeGeometry::create(has_thumb) |
| 967 .PassAs<WebKit::WebScrollbarThemeGeometry>(), | 967 .PassAs<WebKit::WebScrollbarThemeGeometry>(), |
| 968 content_->id()); | 968 content_->id()); |
| 969 scrollbar_->setBounds(gfx::Size(10, 10)); | 969 scrollbar_->SetBounds(gfx::Size(10, 10)); |
| 970 scrollbar_->setAnchorPoint(gfx::PointF()); | 970 scrollbar_->SetAnchorPoint(gfx::PointF()); |
| 971 scrollbar_->setIsDrawable(true); | 971 scrollbar_->SetIsDrawable(true); |
| 972 root_->addChild(scrollbar_); | 972 root_->AddChild(scrollbar_); |
| 973 | 973 |
| 974 m_layerTreeHost->setRootLayer(root_); | 974 m_layerTreeHost->setRootLayer(root_); |
| 975 LayerTreeHostContextTest::setupTree(); | 975 LayerTreeHostContextTest::setupTree(); |
| 976 } | 976 } |
| 977 | 977 |
| 978 virtual void beginTest() OVERRIDE { | 978 virtual void beginTest() OVERRIDE { |
| 979 postSetNeedsCommitToMainThread(); | 979 postSetNeedsCommitToMainThread(); |
| 980 } | 980 } |
| 981 | 981 |
| 982 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 982 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 public: | 1134 public: |
| 1135 virtual void initializeSettings(LayerTreeSettings& settings) OVERRIDE { | 1135 virtual void initializeSettings(LayerTreeSettings& settings) OVERRIDE { |
| 1136 settings.implSidePainting = true; | 1136 settings.implSidePainting = true; |
| 1137 } | 1137 } |
| 1138 }; | 1138 }; |
| 1139 | 1139 |
| 1140 class LayerTreeHostContextTestImplSidePainting : | 1140 class LayerTreeHostContextTestImplSidePainting : |
| 1141 public ImplSidePaintingLayerTreeHostContextTest { | 1141 public ImplSidePaintingLayerTreeHostContextTest { |
| 1142 public: | 1142 public: |
| 1143 virtual void setupTree() OVERRIDE { | 1143 virtual void setupTree() OVERRIDE { |
| 1144 scoped_refptr<Layer> root = Layer::create(); | 1144 scoped_refptr<Layer> root = Layer::Create(); |
| 1145 root->setBounds(gfx::Size(10, 10)); | 1145 root->SetBounds(gfx::Size(10, 10)); |
| 1146 root->setAnchorPoint(gfx::PointF()); | 1146 root->SetAnchorPoint(gfx::PointF()); |
| 1147 root->setIsDrawable(true); | 1147 root->SetIsDrawable(true); |
| 1148 | 1148 |
| 1149 scoped_refptr<PictureLayer> picture = PictureLayer::create(&client_); | 1149 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&client_); |
| 1150 picture->setBounds(gfx::Size(10, 10)); | 1150 picture->SetBounds(gfx::Size(10, 10)); |
| 1151 picture->setAnchorPoint(gfx::PointF()); | 1151 picture->SetAnchorPoint(gfx::PointF()); |
| 1152 picture->setIsDrawable(true); | 1152 picture->SetIsDrawable(true); |
| 1153 root->addChild(picture); | 1153 root->AddChild(picture); |
| 1154 | 1154 |
| 1155 m_layerTreeHost->setRootLayer(root); | 1155 m_layerTreeHost->setRootLayer(root); |
| 1156 LayerTreeHostContextTest::setupTree(); | 1156 LayerTreeHostContextTest::setupTree(); |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 virtual void beginTest() OVERRIDE { | 1159 virtual void beginTest() OVERRIDE { |
| 1160 times_to_lose_during_commit_ = 1; | 1160 times_to_lose_during_commit_ = 1; |
| 1161 postSetNeedsCommitToMainThread(); | 1161 postSetNeedsCommitToMainThread(); |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 virtual void afterTest() OVERRIDE {} | 1164 virtual void afterTest() OVERRIDE {} |
| 1165 | 1165 |
| 1166 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 1166 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 1167 EXPECT_TRUE(succeeded); | 1167 EXPECT_TRUE(succeeded); |
| 1168 endTest(); | 1168 endTest(); |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 private: | 1171 private: |
| 1172 FakeContentLayerClient client_; | 1172 FakeContentLayerClient client_; |
| 1173 }; | 1173 }; |
| 1174 | 1174 |
| 1175 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) | 1175 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) |
| 1176 | 1176 |
| 1177 class ScrollbarLayerLostContext : public LayerTreeHostContextTest { | 1177 class ScrollbarLayerLostContext : public LayerTreeHostContextTest { |
| 1178 public: | 1178 public: |
| 1179 ScrollbarLayerLostContext() : commits_(0) {} | 1179 ScrollbarLayerLostContext() : commits_(0) {} |
| 1180 | 1180 |
| 1181 virtual void beginTest() OVERRIDE { | 1181 virtual void beginTest() OVERRIDE { |
| 1182 scoped_refptr<Layer> scroll_layer = Layer::create(); | 1182 scoped_refptr<Layer> scroll_layer = Layer::Create(); |
| 1183 scrollbar_layer_ = FakeScrollbarLayer::Create( | 1183 scrollbar_layer_ = FakeScrollbarLayer::Create( |
| 1184 false, true, scroll_layer->id()); | 1184 false, true, scroll_layer->id()); |
| 1185 scrollbar_layer_->setBounds(gfx::Size(10, 100)); | 1185 scrollbar_layer_->SetBounds(gfx::Size(10, 100)); |
| 1186 m_layerTreeHost->rootLayer()->addChild(scrollbar_layer_); | 1186 m_layerTreeHost->rootLayer()->AddChild(scrollbar_layer_); |
| 1187 m_layerTreeHost->rootLayer()->addChild(scroll_layer); | 1187 m_layerTreeHost->rootLayer()->AddChild(scroll_layer); |
| 1188 postSetNeedsCommitToMainThread(); | 1188 postSetNeedsCommitToMainThread(); |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 virtual void afterTest() OVERRIDE { | 1191 virtual void afterTest() OVERRIDE { |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1194 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 1195 LayerTreeHostContextTest::commitCompleteOnThread(impl); | 1195 LayerTreeHostContextTest::commitCompleteOnThread(impl); |
| 1196 | 1196 |
| 1197 ++commits_; | 1197 ++commits_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1219 | 1219 |
| 1220 private: | 1220 private: |
| 1221 int commits_; | 1221 int commits_; |
| 1222 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; | 1222 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; |
| 1223 }; | 1223 }; |
| 1224 | 1224 |
| 1225 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext) | 1225 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext) |
| 1226 | 1226 |
| 1227 } // namespace | 1227 } // namespace |
| 1228 } // namespace cc | 1228 } // namespace cc |
| OLD | NEW |