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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp

Issue 2399733002: DrawingBuffer cleanup: Part 1 of many (Closed)
Patch Set: Fix size update Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox, 319 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
320 &releaseCallback)); 320 &releaseCallback));
321 EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize()); 321 EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());
322 EXPECT_TRUE(textureMailbox.is_overlay_candidate()); 322 EXPECT_TRUE(textureMailbox.is_overlay_candidate());
323 testing::Mock::VerifyAndClearExpectations(m_gl); 323 testing::Mock::VerifyAndClearExpectations(m_gl);
324 324
325 GLuint m_imageId2 = m_gl->nextImageIdToBeCreated(); 325 GLuint m_imageId2 = m_gl->nextImageIdToBeCreated();
326 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1); 326 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1);
327 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1); 327 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1);
328 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1); 328 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1);
329 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1);
330 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1);
329 // Resize to 100x50. 331 // Resize to 100x50.
330 m_drawingBuffer->reset(alternateSize); 332 m_drawingBuffer->reset(alternateSize);
331 releaseCallback->Run(gpu::SyncToken(), false /* lostResource */); 333 releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
332 testing::Mock::VerifyAndClearExpectations(m_gl); 334 testing::Mock::VerifyAndClearExpectations(m_gl);
333 335
334 GLuint m_imageId3 = m_gl->nextImageIdToBeCreated(); 336 GLuint m_imageId3 = m_gl->nextImageIdToBeCreated();
335 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1); 337 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1);
336 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1);
337 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1);
338 // Produce a mailbox at this size. 338 // Produce a mailbox at this size.
339 m_drawingBuffer->markContentsChanged(); 339 m_drawingBuffer->markContentsChanged();
340 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox, 340 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
341 &releaseCallback)); 341 &releaseCallback));
342 EXPECT_EQ(alternateSize, m_gl->mostRecentlyProducedSize()); 342 EXPECT_EQ(alternateSize, m_gl->mostRecentlyProducedSize());
343 EXPECT_TRUE(textureMailbox.is_overlay_candidate()); 343 EXPECT_TRUE(textureMailbox.is_overlay_candidate());
344 testing::Mock::VerifyAndClearExpectations(m_gl); 344 testing::Mock::VerifyAndClearExpectations(m_gl);
345 345
346 GLuint m_imageId4 = m_gl->nextImageIdToBeCreated(); 346 GLuint m_imageId4 = m_gl->nextImageIdToBeCreated();
347 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1); 347 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1);
348 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1); 348 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1);
349 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1); 349 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1);
350 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1);
351 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1);
350 // Reset to initial size. 352 // Reset to initial size.
351 m_drawingBuffer->reset(initialSize); 353 m_drawingBuffer->reset(initialSize);
352 releaseCallback->Run(gpu::SyncToken(), false /* lostResource */); 354 releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
353 testing::Mock::VerifyAndClearExpectations(m_gl); 355 testing::Mock::VerifyAndClearExpectations(m_gl);
354 356
355 GLuint m_imageId5 = m_gl->nextImageIdToBeCreated(); 357 GLuint m_imageId5 = m_gl->nextImageIdToBeCreated();
356 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1); 358 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1);
357 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1);
358 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1);
359 // Prepare another mailbox and verify that it's the correct size. 359 // Prepare another mailbox and verify that it's the correct size.
360 m_drawingBuffer->markContentsChanged(); 360 m_drawingBuffer->markContentsChanged();
361 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox, 361 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
362 &releaseCallback)); 362 &releaseCallback));
363 EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize()); 363 EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());
364 EXPECT_TRUE(textureMailbox.is_overlay_candidate()); 364 EXPECT_TRUE(textureMailbox.is_overlay_candidate());
365 testing::Mock::VerifyAndClearExpectations(m_gl); 365 testing::Mock::VerifyAndClearExpectations(m_gl);
366 366
367 // Prepare one final mailbox and verify that it's the correct size. 367 // Prepare one final mailbox and verify that it's the correct size.
368 releaseCallback->Run(gpu::SyncToken(), false /* lostResource */); 368 releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 m_drawingBuffer->setIsHidden(true); 589 m_drawingBuffer->setIsHidden(true);
590 releaseCallback->Run(waitSyncToken, false /* lostResource */); 590 releaseCallback->Run(waitSyncToken, false /* lostResource */);
591 // m_drawingBuffer deletes mailbox immediately when hidden. 591 // m_drawingBuffer deletes mailbox immediately when hidden.
592 592
593 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); 593 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken());
594 594
595 m_drawingBuffer->beginDestruction(); 595 m_drawingBuffer->beginDestruction();
596 } 596 }
597 597
598 } // namespace blink 598 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698