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

Side by Side Diff: media/renderers/skcanvas_video_renderer_unittest.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: Folded sync_point into sync_tokens 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "gpu/GLES2/gl2extchromium.h" 6 #include "gpu/GLES2/gl2extchromium.h"
7 #include "gpu/command_buffer/client/gles2_interface_stub.h" 7 #include "gpu/command_buffer/client/gles2_interface_stub.h"
8 #include "media/base/timestamp_constants.h" 8 #include "media/base/timestamp_constants.h"
9 #include "media/base/video_frame.h" 9 #include "media/base/video_frame.h"
10 #include "media/base/video_util.h" 10 #include "media/base/video_util.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 namespace { 462 namespace {
463 class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub { 463 class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub {
464 public: 464 public:
465 void GenTextures(GLsizei n, GLuint* textures) override { 465 void GenTextures(GLsizei n, GLuint* textures) override {
466 DCHECK_EQ(1, n); 466 DCHECK_EQ(1, n);
467 *textures = 1; 467 *textures = 1;
468 } 468 }
469 }; 469 };
470 void MailboxHoldersReleased(uint32 sync_point) {} 470 void MailboxHoldersReleased(const gpu::SyncToken& sync_token) {}
471 } // namespace 471 } // namespace
472 472
473 // Test that SkCanvasVideoRendererTest::Paint doesn't crash when GrContext is 473 // Test that SkCanvasVideoRendererTest::Paint doesn't crash when GrContext is
474 // abandoned. 474 // abandoned.
475 TEST_F(SkCanvasVideoRendererTest, ContextLost) { 475 TEST_F(SkCanvasVideoRendererTest, ContextLost) {
476 skia::RefPtr<const GrGLInterface> null_interface = 476 skia::RefPtr<const GrGLInterface> null_interface =
477 skia::AdoptRef(GrGLCreateNullInterface()); 477 skia::AdoptRef(GrGLCreateNullInterface());
478 auto gr_context = skia::AdoptRef(GrContext::Create( 478 auto gr_context = skia::AdoptRef(GrContext::Create(
479 kOpenGL_GrBackend, 479 kOpenGL_GrBackend,
480 reinterpret_cast<GrBackendContext>(null_interface.get()))); 480 reinterpret_cast<GrBackendContext>(null_interface.get())));
481 gr_context->abandonContext(); 481 gr_context->abandonContext();
482 482
483 SkCanvas canvas(AllocBitmap(kWidth, kHeight)); 483 SkCanvas canvas(AllocBitmap(kWidth, kHeight));
484 484
485 TestGLES2Interface gles2; 485 TestGLES2Interface gles2;
486 Context3D context_3d(&gles2, gr_context.get()); 486 Context3D context_3d(&gles2, gr_context.get());
487 gfx::Size size(kWidth, kHeight); 487 gfx::Size size(kWidth, kHeight);
488 gpu::MailboxHolder mailbox(gpu::Mailbox::Generate(), GL_TEXTURE_RECTANGLE_ARB, 488 gpu::MailboxHolder mailbox(gpu::Mailbox::Generate(), GL_TEXTURE_RECTANGLE_ARB,
489 0); 489 0);
490 auto video_frame = VideoFrame::WrapNativeTexture( 490 auto video_frame = VideoFrame::WrapNativeTexture(
491 PIXEL_FORMAT_UYVY, mailbox, base::Bind(MailboxHoldersReleased), size, 491 PIXEL_FORMAT_UYVY, mailbox, base::Bind(MailboxHoldersReleased), size,
492 gfx::Rect(size), size, kNoTimestamp()); 492 gfx::Rect(size), size, kNoTimestamp());
493 493
494 renderer_.Paint(video_frame, &canvas, kNaturalRect, 0xFF, 494 renderer_.Paint(video_frame, &canvas, kNaturalRect, 0xFF,
495 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_90, context_3d); 495 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_90, context_3d);
496 } 496 }
497 } // namespace media 497 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698