Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + autogen Created 5 years, 1 month 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
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/delegated_frame_provider.h" 8 #include "cc/layers/delegated_frame_provider.h"
9 #include "cc/layers/delegated_frame_resource_collection.h" 9 #include "cc/layers/delegated_frame_resource_collection.h"
10 #include "cc/layers/heads_up_display_layer.h" 10 #include "cc/layers/heads_up_display_layer.h"
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 LayerTreeHostContextTestDontUseLostResources() : lost_context_(false) { 903 LayerTreeHostContextTestDontUseLostResources() : lost_context_(false) {
904 context_should_support_io_surface_ = true; 904 context_should_support_io_surface_ = true;
905 905
906 child_output_surface_ = FakeOutputSurface::Create3d(); 906 child_output_surface_ = FakeOutputSurface::Create3d();
907 child_output_surface_->BindToClient(&output_surface_client_); 907 child_output_surface_->BindToClient(&output_surface_client_);
908 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); 908 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
909 child_resource_provider_ = FakeResourceProvider::Create( 909 child_resource_provider_ = FakeResourceProvider::Create(
910 child_output_surface_.get(), shared_bitmap_manager_.get()); 910 child_output_surface_.get(), shared_bitmap_manager_.get());
911 } 911 }
912 912
913 static void EmptyReleaseCallback(unsigned sync_point, bool lost) {} 913 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token,
914 bool lost) {}
914 915
915 void SetupTree() override { 916 void SetupTree() override {
916 gpu::gles2::GLES2Interface* gl = 917 gpu::gles2::GLES2Interface* gl =
917 child_output_surface_->context_provider()->ContextGL(); 918 child_output_surface_->context_provider()->ContextGL();
918 919
919 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 920 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
920 921
921 scoped_ptr<RenderPass> pass_for_quad = RenderPass::Create(); 922 scoped_ptr<RenderPass> pass_for_quad = RenderPass::Create();
922 pass_for_quad->SetNew( 923 pass_for_quad->SetNew(
923 // AppendOneOfEveryQuadType() makes a RenderPass quad with this id. 924 // AppendOneOfEveryQuadType() makes a RenderPass quad with this id.
(...skipping 18 matching lines...) Expand all
942 delegated_frame_provider_ = new DelegatedFrameProvider( 943 delegated_frame_provider_ = new DelegatedFrameProvider(
943 delegated_resource_collection_.get(), frame_data.Pass()); 944 delegated_resource_collection_.get(), frame_data.Pass());
944 945
945 ResourceId resource = child_resource_provider_->CreateResource( 946 ResourceId resource = child_resource_provider_->CreateResource(
946 gfx::Size(4, 4), ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); 947 gfx::Size(4, 4), ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
947 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), 948 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(),
948 resource); 949 resource);
949 950
950 gpu::Mailbox mailbox; 951 gpu::Mailbox mailbox;
951 gl->GenMailboxCHROMIUM(mailbox.name); 952 gl->GenMailboxCHROMIUM(mailbox.name);
952 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); 953 gpu::SyncToken sync_token(gl->InsertSyncPointCHROMIUM());
953 954
954 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 955 scoped_refptr<Layer> root = Layer::Create(layer_settings());
955 root->SetBounds(gfx::Size(10, 10)); 956 root->SetBounds(gfx::Size(10, 10));
956 root->SetIsDrawable(true); 957 root->SetIsDrawable(true);
957 958
958 scoped_refptr<FakeDelegatedRendererLayer> delegated = 959 scoped_refptr<FakeDelegatedRendererLayer> delegated =
959 FakeDelegatedRendererLayer::Create(layer_settings(), 960 FakeDelegatedRendererLayer::Create(layer_settings(),
960 delegated_frame_provider_.get()); 961 delegated_frame_provider_.get());
961 delegated->SetBounds(gfx::Size(10, 10)); 962 delegated->SetBounds(gfx::Size(10, 10));
962 delegated->SetIsDrawable(true); 963 delegated->SetIsDrawable(true);
963 root->AddChild(delegated); 964 root->AddChild(delegated);
964 965
965 scoped_refptr<PictureLayer> layer = 966 scoped_refptr<PictureLayer> layer =
966 PictureLayer::Create(layer_settings(), &client_); 967 PictureLayer::Create(layer_settings(), &client_);
967 layer->SetBounds(gfx::Size(10, 10)); 968 layer->SetBounds(gfx::Size(10, 10));
968 layer->SetIsDrawable(true); 969 layer->SetIsDrawable(true);
969 root->AddChild(layer); 970 root->AddChild(layer);
970 971
971 scoped_refptr<TextureLayer> texture = 972 scoped_refptr<TextureLayer> texture =
972 TextureLayer::CreateForMailbox(layer_settings_, NULL); 973 TextureLayer::CreateForMailbox(layer_settings_, NULL);
973 texture->SetBounds(gfx::Size(10, 10)); 974 texture->SetBounds(gfx::Size(10, 10));
974 texture->SetIsDrawable(true); 975 texture->SetIsDrawable(true);
975 texture->SetTextureMailbox( 976 texture->SetTextureMailbox(
976 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), 977 TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D),
977 SingleReleaseCallback::Create( 978 SingleReleaseCallback::Create(
978 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: 979 base::Bind(&LayerTreeHostContextTestDontUseLostResources::
979 EmptyReleaseCallback))); 980 EmptyReleaseCallback)));
980 root->AddChild(texture); 981 root->AddChild(texture);
981 982
982 scoped_refptr<PictureLayer> mask = 983 scoped_refptr<PictureLayer> mask =
983 PictureLayer::Create(layer_settings_, &client_); 984 PictureLayer::Create(layer_settings_, &client_);
984 mask->SetBounds(gfx::Size(10, 10)); 985 mask->SetBounds(gfx::Size(10, 10));
985 986
986 scoped_refptr<PictureLayer> layer_with_mask = 987 scoped_refptr<PictureLayer> layer_with_mask =
987 PictureLayer::Create(layer_settings_, &client_); 988 PictureLayer::Create(layer_settings_, &client_);
988 layer_with_mask->SetBounds(gfx::Size(10, 10)); 989 layer_with_mask->SetBounds(gfx::Size(10, 10));
989 layer_with_mask->SetIsDrawable(true); 990 layer_with_mask->SetIsDrawable(true);
(...skipping 15 matching lines...) Expand all
1005 scoped_refptr<VideoLayer> video_scaled_hw = VideoLayer::Create( 1006 scoped_refptr<VideoLayer> video_scaled_hw = VideoLayer::Create(
1006 layer_settings_, &scaled_hw_frame_provider_, media::VIDEO_ROTATION_0); 1007 layer_settings_, &scaled_hw_frame_provider_, media::VIDEO_ROTATION_0);
1007 video_scaled_hw->SetBounds(gfx::Size(10, 10)); 1008 video_scaled_hw->SetBounds(gfx::Size(10, 10));
1008 video_scaled_hw->SetIsDrawable(true); 1009 video_scaled_hw->SetIsDrawable(true);
1009 root->AddChild(video_scaled_hw); 1010 root->AddChild(video_scaled_hw);
1010 1011
1011 color_video_frame_ = VideoFrame::CreateColorFrame( 1012 color_video_frame_ = VideoFrame::CreateColorFrame(
1012 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); 1013 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
1013 hw_video_frame_ = VideoFrame::WrapNativeTexture( 1014 hw_video_frame_ = VideoFrame::WrapNativeTexture(
1014 media::PIXEL_FORMAT_ARGB, 1015 media::PIXEL_FORMAT_ARGB,
1015 gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point), 1016 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D),
1016 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), 1017 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4),
1017 gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), base::TimeDelta()); 1018 gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), base::TimeDelta());
1018 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( 1019 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture(
1019 media::PIXEL_FORMAT_ARGB, 1020 media::PIXEL_FORMAT_ARGB,
1020 gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point), 1021 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D),
1021 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), 1022 media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4),
1022 gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), base::TimeDelta()); 1023 gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), base::TimeDelta());
1023 1024
1024 color_frame_provider_.set_frame(color_video_frame_); 1025 color_frame_provider_.set_frame(color_video_frame_);
1025 hw_frame_provider_.set_frame(hw_video_frame_); 1026 hw_frame_provider_.set_frame(hw_video_frame_);
1026 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); 1027 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_);
1027 1028
1028 scoped_refptr<IOSurfaceLayer> io_surface = 1029 scoped_refptr<IOSurfaceLayer> io_surface =
1029 IOSurfaceLayer::Create(layer_settings_); 1030 IOSurfaceLayer::Create(layer_settings_);
1030 io_surface->SetBounds(gfx::Size(10, 10)); 1031 io_surface->SetBounds(gfx::Size(10, 10));
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 void AfterTest() override {} 1623 void AfterTest() override {}
1623 1624
1624 bool deferred_; 1625 bool deferred_;
1625 }; 1626 };
1626 1627
1627 SINGLE_AND_MULTI_THREAD_TEST_F( 1628 SINGLE_AND_MULTI_THREAD_TEST_F(
1628 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1629 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1629 1630
1630 } // namespace 1631 } // namespace
1631 } // namespace cc 1632 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698