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

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

Issue 132233041: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ff7262fa Rebase. Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_copyrequest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/content_layer.h" 8 #include "cc/layers/content_layer.h"
9 #include "cc/layers/delegated_frame_provider.h" 9 #include "cc/layers/delegated_frame_provider.h"
10 #include "cc/layers/delegated_frame_resource_collection.h" 10 #include "cc/layers/delegated_frame_resource_collection.h"
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 content->SetBounds(gfx::Size(10, 10)); 997 content->SetBounds(gfx::Size(10, 10));
998 content->SetAnchorPoint(gfx::PointF()); 998 content->SetAnchorPoint(gfx::PointF());
999 content->SetIsDrawable(true); 999 content->SetIsDrawable(true);
1000 root->AddChild(content); 1000 root->AddChild(content);
1001 1001
1002 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); 1002 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL);
1003 texture->SetBounds(gfx::Size(10, 10)); 1003 texture->SetBounds(gfx::Size(10, 10));
1004 texture->SetAnchorPoint(gfx::PointF()); 1004 texture->SetAnchorPoint(gfx::PointF());
1005 texture->SetIsDrawable(true); 1005 texture->SetIsDrawable(true);
1006 texture->SetTextureMailbox( 1006 texture->SetTextureMailbox(
1007 TextureMailbox(mailbox, sync_point), 1007 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point),
1008 SingleReleaseCallback::Create( 1008 SingleReleaseCallback::Create(
1009 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: 1009 base::Bind(&LayerTreeHostContextTestDontUseLostResources::
1010 EmptyReleaseCallback))); 1010 EmptyReleaseCallback)));
1011 root->AddChild(texture); 1011 root->AddChild(texture);
1012 1012
1013 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); 1013 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_);
1014 mask->SetBounds(gfx::Size(10, 10)); 1014 mask->SetBounds(gfx::Size(10, 10));
1015 mask->SetAnchorPoint(gfx::PointF()); 1015 mask->SetAnchorPoint(gfx::PointF());
1016 1016
1017 scoped_refptr<ContentLayer> content_with_mask = 1017 scoped_refptr<ContentLayer> content_with_mask =
(...skipping 20 matching lines...) Expand all
1038 1038
1039 scoped_refptr<VideoLayer> video_scaled_hw = 1039 scoped_refptr<VideoLayer> video_scaled_hw =
1040 VideoLayer::Create(&scaled_hw_frame_provider_); 1040 VideoLayer::Create(&scaled_hw_frame_provider_);
1041 video_scaled_hw->SetBounds(gfx::Size(10, 10)); 1041 video_scaled_hw->SetBounds(gfx::Size(10, 10));
1042 video_scaled_hw->SetAnchorPoint(gfx::PointF()); 1042 video_scaled_hw->SetAnchorPoint(gfx::PointF());
1043 video_scaled_hw->SetIsDrawable(true); 1043 video_scaled_hw->SetIsDrawable(true);
1044 root->AddChild(video_scaled_hw); 1044 root->AddChild(video_scaled_hw);
1045 1045
1046 color_video_frame_ = VideoFrame::CreateColorFrame( 1046 color_video_frame_ = VideoFrame::CreateColorFrame(
1047 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); 1047 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
1048 hw_video_frame_ = VideoFrame::WrapNativeTexture( 1048 hw_video_frame_ =
1049 make_scoped_ptr(new VideoFrame::MailboxHolder( 1049 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder(
1050 mailbox, 1050 mailbox, GL_TEXTURE_2D, sync_point)),
1051 sync_point, 1051 media::VideoFrame::ReleaseMailboxCB(),
1052 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), 1052 gfx::Size(4, 4),
1053 GL_TEXTURE_2D, 1053 gfx::Rect(0, 0, 4, 4),
1054 gfx::Size(4, 4), 1054 gfx::Size(4, 4),
1055 gfx::Rect(0, 0, 4, 4), 1055 base::TimeDelta(),
1056 gfx::Size(4, 4), 1056 VideoFrame::ReadPixelsCB());
1057 base::TimeDelta(), 1057 scaled_hw_video_frame_ =
1058 VideoFrame::ReadPixelsCB(), 1058 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder(
1059 base::Closure()); 1059 mailbox, GL_TEXTURE_2D, sync_point)),
1060 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( 1060 media::VideoFrame::ReleaseMailboxCB(),
1061 make_scoped_ptr(new VideoFrame::MailboxHolder( 1061 gfx::Size(4, 4),
1062 mailbox, 1062 gfx::Rect(0, 0, 3, 2),
1063 sync_point, 1063 gfx::Size(4, 4),
1064 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), 1064 base::TimeDelta(),
1065 GL_TEXTURE_2D, 1065 VideoFrame::ReadPixelsCB());
1066 gfx::Size(4, 4),
1067 gfx::Rect(0, 0, 3, 2),
1068 gfx::Size(4, 4),
1069 base::TimeDelta(),
1070 VideoFrame::ReadPixelsCB(),
1071 base::Closure());
1072 1066
1073 color_frame_provider_.set_frame(color_video_frame_); 1067 color_frame_provider_.set_frame(color_video_frame_);
1074 hw_frame_provider_.set_frame(hw_video_frame_); 1068 hw_frame_provider_.set_frame(hw_video_frame_);
1075 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); 1069 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_);
1076 1070
1077 if (!delegating_renderer()) { 1071 if (!delegating_renderer()) {
1078 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 1072 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335
1079 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); 1073 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create();
1080 io_surface->SetBounds(gfx::Size(10, 10)); 1074 io_surface->SetBounds(gfx::Size(10, 10));
1081 io_surface->SetAnchorPoint(gfx::PointF()); 1075 io_surface->SetAnchorPoint(gfx::PointF());
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 1978
1985 protected: 1979 protected:
1986 FakeContentLayerClient client_; 1980 FakeContentLayerClient client_;
1987 scoped_refptr<FakeContentLayer> layer_; 1981 scoped_refptr<FakeContentLayer> layer_;
1988 }; 1982 };
1989 1983
1990 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); 1984 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback);
1991 1985
1992 } // namespace 1986 } // namespace
1993 } // namespace cc 1987 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_copyrequest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698