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

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

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc2a95fe Android fixes. Created 7 years 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
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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 content->SetBounds(gfx::Size(10, 10)); 1157 content->SetBounds(gfx::Size(10, 10));
1158 content->SetAnchorPoint(gfx::PointF()); 1158 content->SetAnchorPoint(gfx::PointF());
1159 content->SetIsDrawable(true); 1159 content->SetIsDrawable(true);
1160 root->AddChild(content); 1160 root->AddChild(content);
1161 1161
1162 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); 1162 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL);
1163 texture->SetBounds(gfx::Size(10, 10)); 1163 texture->SetBounds(gfx::Size(10, 10));
1164 texture->SetAnchorPoint(gfx::PointF()); 1164 texture->SetAnchorPoint(gfx::PointF());
1165 texture->SetIsDrawable(true); 1165 texture->SetIsDrawable(true);
1166 texture->SetTextureMailbox( 1166 texture->SetTextureMailbox(
1167 TextureMailbox(mailbox, sync_point), 1167 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point),
1168 SingleReleaseCallback::Create(base::Bind( 1168 SingleReleaseCallback::Create(
1169 &LayerTreeHostContextTestDontUseLostResources:: 1169 base::Bind(&LayerTreeHostContextTestDontUseLostResources::
1170 EmptyReleaseCallback))); 1170 EmptyReleaseCallback)));
1171 root->AddChild(texture); 1171 root->AddChild(texture);
1172 1172
1173 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); 1173 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_);
1174 mask->SetBounds(gfx::Size(10, 10)); 1174 mask->SetBounds(gfx::Size(10, 10));
1175 mask->SetAnchorPoint(gfx::PointF()); 1175 mask->SetAnchorPoint(gfx::PointF());
1176 1176
1177 scoped_refptr<ContentLayer> content_with_mask = 1177 scoped_refptr<ContentLayer> content_with_mask =
1178 ContentLayer::Create(&client_); 1178 ContentLayer::Create(&client_);
1179 content_with_mask->SetBounds(gfx::Size(10, 10)); 1179 content_with_mask->SetBounds(gfx::Size(10, 10));
1180 content_with_mask->SetAnchorPoint(gfx::PointF()); 1180 content_with_mask->SetAnchorPoint(gfx::PointF());
(...skipping 17 matching lines...) Expand all
1198 1198
1199 scoped_refptr<VideoLayer> video_scaled_hw = 1199 scoped_refptr<VideoLayer> video_scaled_hw =
1200 VideoLayer::Create(&scaled_hw_frame_provider_); 1200 VideoLayer::Create(&scaled_hw_frame_provider_);
1201 video_scaled_hw->SetBounds(gfx::Size(10, 10)); 1201 video_scaled_hw->SetBounds(gfx::Size(10, 10));
1202 video_scaled_hw->SetAnchorPoint(gfx::PointF()); 1202 video_scaled_hw->SetAnchorPoint(gfx::PointF());
1203 video_scaled_hw->SetIsDrawable(true); 1203 video_scaled_hw->SetIsDrawable(true);
1204 root->AddChild(video_scaled_hw); 1204 root->AddChild(video_scaled_hw);
1205 1205
1206 color_video_frame_ = VideoFrame::CreateColorFrame( 1206 color_video_frame_ = VideoFrame::CreateColorFrame(
1207 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); 1207 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
1208 hw_video_frame_ = VideoFrame::WrapNativeTexture( 1208 hw_video_frame_ =
1209 make_scoped_ptr(new VideoFrame::MailboxHolder( 1209 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder(
1210 mailbox, 1210 mailbox, GL_TEXTURE_2D, sync_point)),
1211 sync_point, 1211 gpu::MailboxHolder::ReleaseCallback(),
1212 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), 1212 gfx::Size(4, 4),
1213 GL_TEXTURE_2D, 1213 gfx::Rect(0, 0, 4, 4),
1214 gfx::Size(4, 4), 1214 gfx::Size(4, 4),
1215 gfx::Rect(0, 0, 4, 4), 1215 base::TimeDelta(),
1216 gfx::Size(4, 4), 1216 VideoFrame::ReadPixelsCB());
1217 base::TimeDelta(), 1217 scaled_hw_video_frame_ =
1218 VideoFrame::ReadPixelsCB(), 1218 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder(
1219 base::Closure()); 1219 mailbox, GL_TEXTURE_2D, sync_point)),
1220 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( 1220 gpu::MailboxHolder::ReleaseCallback(),
1221 make_scoped_ptr(new VideoFrame::MailboxHolder( 1221 gfx::Size(4, 4),
1222 mailbox, 1222 gfx::Rect(0, 0, 3, 2),
1223 sync_point, 1223 gfx::Size(4, 4),
1224 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), 1224 base::TimeDelta(),
1225 GL_TEXTURE_2D, 1225 VideoFrame::ReadPixelsCB());
1226 gfx::Size(4, 4),
1227 gfx::Rect(0, 0, 3, 2),
1228 gfx::Size(4, 4),
1229 base::TimeDelta(),
1230 VideoFrame::ReadPixelsCB(),
1231 base::Closure());
1232 1226
1233 color_frame_provider_.set_frame(color_video_frame_); 1227 color_frame_provider_.set_frame(color_video_frame_);
1234 hw_frame_provider_.set_frame(hw_video_frame_); 1228 hw_frame_provider_.set_frame(hw_video_frame_);
1235 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); 1229 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_);
1236 1230
1237 if (!delegating_renderer()) { 1231 if (!delegating_renderer()) {
1238 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 1232 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335
1239 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); 1233 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create();
1240 io_surface->SetBounds(gfx::Size(10, 10)); 1234 io_surface->SetBounds(gfx::Size(10, 10));
1241 io_surface->SetAnchorPoint(gfx::PointF()); 1235 io_surface->SetAnchorPoint(gfx::PointF());
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 protected: 2286 protected:
2293 FakeContentLayerClient client_; 2287 FakeContentLayerClient client_;
2294 scoped_refptr<FakeContentLayer> layer_; 2288 scoped_refptr<FakeContentLayer> layer_;
2295 int num_commits_; 2289 int num_commits_;
2296 }; 2290 };
2297 2291
2298 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); 2292 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback);
2299 2293
2300 } // namespace 2294 } // namespace
2301 } // namespace cc 2295 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698