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

Unified Diff: media/base/video_frame_unittest.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: c301e01d Rebase. Created 6 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: media/base/video_frame_unittest.cc
diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc
index 9c7eab05995b7c2aa19a919fa8b46b80df6724dc..f3d8217bc02d27ee5c794fe01588fa582bbf0e8b 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -211,11 +211,12 @@ TEST(VideoFrame, CheckFrameExtents) {
VideoFrame::YV16, 3, 1, "9bb99ac3ff350644ebff4d28dc01b461");
}
-static void TextureCallback(uint32* called_sync_point, uint32 sync_point) {
- *called_sync_point = sync_point;
+static void TextureCallback(uint32* called_sync_point,
+ scoped_ptr<gpu::MailboxHolder> mailbox_holder) {
+ *called_sync_point = mailbox_holder->sync_point;
}
-// Verify the TextureNoLongerNeededCallback is called when VideoFrame is
+// Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
// destroyed with the original sync point.
TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
uint32 sync_point = 7;
@@ -223,24 +224,20 @@ TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
{
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
- make_scoped_ptr(new VideoFrame::MailboxHolder(
- gpu::Mailbox(),
- sync_point,
- base::Bind(&TextureCallback, &called_sync_point))),
- 5, // texture_target
- gfx::Size(10, 10), // coded_size
- gfx::Rect(10, 10), // visible_rect
- gfx::Size(10, 10), // natural_size
- base::TimeDelta(), // timestamp
- base::Callback<void(const SkBitmap&)>(), // read_pixels_cb
- base::Closure()); // no_longer_needed_cb
+ make_scoped_ptr(new gpu::MailboxHolder(gpu::Mailbox(), 5, sync_point)),
+ base::Bind(&TextureCallback, &called_sync_point),
+ gfx::Size(10, 10), // coded_size
+ gfx::Rect(10, 10), // visible_rect
+ gfx::Size(10, 10), // natural_size
+ base::TimeDelta(), // timestamp
+ base::Callback<void(const SkBitmap&)>()); // read_pixels_cb
EXPECT_EQ(0u, called_sync_point);
}
EXPECT_EQ(sync_point, called_sync_point);
}
-// Verify the TextureNoLongerNeededCallback is called when VideoFrame is
+// Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
// destroyed with the new sync point, when the mailbox is accessed by a caller.
TEST(VideoFrame, TextureNoLongerNeededCallbackAfterTakingAndReleasingMailbox) {
uint32 called_sync_point = 0;
@@ -252,27 +249,23 @@ TEST(VideoFrame, TextureNoLongerNeededCallbackAfterTakingAndReleasingMailbox) {
{
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
- make_scoped_ptr(new VideoFrame::MailboxHolder(
- mailbox,
- sync_point,
- base::Bind(&TextureCallback, &called_sync_point))),
- target,
- gfx::Size(10, 10), // coded_size
- gfx::Rect(10, 10), // visible_rect
- gfx::Size(10, 10), // natural_size
- base::TimeDelta(), // timestamp
- base::Callback<void(const SkBitmap&)>(), // read_pixels_cb
- base::Closure()); // no_longer_needed_cb
-
- VideoFrame::MailboxHolder* mailbox_holder = frame->texture_mailbox();
-
- EXPECT_EQ(mailbox.name[0], mailbox_holder->mailbox().name[0]);
- EXPECT_EQ(sync_point, mailbox_holder->sync_point());
- EXPECT_EQ(target, frame->texture_target());
+ make_scoped_ptr(new gpu::MailboxHolder(mailbox, target, sync_point)),
+ base::Bind(&TextureCallback, &called_sync_point),
+ gfx::Size(10, 10), // coded_size
+ gfx::Rect(10, 10), // visible_rect
+ gfx::Size(10, 10), // natural_size
+ base::TimeDelta(), // timestamp
+ base::Callback<void(const SkBitmap&)>()); // read_pixels_cb
+
+ gpu::MailboxHolder* mailbox_holder = frame->mailbox_holder();
+
+ EXPECT_EQ(mailbox.name[0], mailbox_holder->mailbox.name[0]);
+ EXPECT_EQ(target, mailbox_holder->texture_target);
+ EXPECT_EQ(sync_point, mailbox_holder->sync_point);
// Finish using the mailbox_holder and drop our reference.
sync_point = 10;
- mailbox_holder->Resync(sync_point);
+ mailbox_holder->sync_point = sync_point;
}
EXPECT_EQ(sync_point, called_sync_point);
}

Powered by Google App Engine
This is Rietveld 408576698