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

Unified Diff: content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc

Issue 13749002: Cache OpenGL textures and other objects in CompositingIOSurfaceMac copy/transform code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks, per nick@'s comments. Created 7 years, 8 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
« no previous file with comments | « content/browser/renderer_host/compositing_iosurface_transformer_mac.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc
diff --git a/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc b/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc
index ad6c4bb0a388909261156eb4caf177231ed3c675..6f2562c19e344f0e2d96ece070313985a3d9c6d9 100644
--- a/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc
+++ b/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc
@@ -280,6 +280,7 @@ class CompositingIOSurfaceTransformerTest : public testing::Test {
}
virtual ~CompositingIOSurfaceTransformerTest() {
+ transformer_->ReleaseCachedGLObjects();
shader_program_cache_->Reset();
CGLSetCurrentContext(NULL);
CGLDestroyContext(context_);
@@ -289,25 +290,21 @@ class CompositingIOSurfaceTransformerTest : public testing::Test {
void RunResizeTest(const SkBitmap& src_bitmap, const gfx::Rect& src_rect,
const gfx::Size& dst_size) {
SCOPED_TRACE(::testing::Message()
- << "src_rect=" << src_rect.x() << ',' << src_rect.y()
+ << "src_rect=(" << src_rect.x() << ',' << src_rect.y()
<< ")x[" << src_rect.width() << 'x' << src_rect.height()
<< "]; dst_size=[" << dst_size.width() << 'x'
<< dst_size.height() << ']');
- const GLuint original_texture = CreateTextureWithImage(src_bitmap);
- EXPECT_NE(0u, original_texture);
-
// Do the scale operation on the GPU.
+ const GLuint original_texture = CreateTextureWithImage(src_bitmap);
+ ASSERT_NE(0u, original_texture);
GLuint scaled_texture = 0u;
- EXPECT_TRUE(transformer_->ResizeBilinear(
+ ASSERT_TRUE(transformer_->ResizeBilinear(
original_texture, src_rect, dst_size, &scaled_texture));
EXPECT_NE(0u, scaled_texture);
CGLFlushDrawable(context_); // Account for some buggy driver impls.
const SkBitmap result_bitmap = ReadBackTexture(scaled_texture, dst_size);
-
- // Delete the textures.
EXPECT_NO_GL_ERROR(glDeleteTextures(1, &original_texture));
- EXPECT_NO_GL_ERROR(glDeleteTextures(1, &scaled_texture));
// Compare the image read back to the version produced by a known-working
// software implementation. Allow up to 2 lines of mismatch due to how
@@ -322,21 +319,20 @@ class CompositingIOSurfaceTransformerTest : public testing::Test {
const SkBitmap& src_bitmap, const gfx::Rect& src_rect,
const gfx::Size& dst_size) {
SCOPED_TRACE(::testing::Message()
- << "src_rect=" << src_rect.x() << ',' << src_rect.y()
+ << "src_rect=(" << src_rect.x() << ',' << src_rect.y()
<< ")x[" << src_rect.width() << 'x' << src_rect.height()
<< "]; dst_size=[" << dst_size.width() << 'x'
<< dst_size.height() << ']');
- const GLuint original_texture = CreateTextureWithImage(src_bitmap);
- EXPECT_NE(0u, original_texture);
-
// Perform the RGB to YV12 conversion.
+ const GLuint original_texture = CreateTextureWithImage(src_bitmap);
+ ASSERT_NE(0u, original_texture);
GLuint texture_y = 0u;
GLuint texture_u = 0u;
GLuint texture_v = 0u;
gfx::Size packed_y_size;
gfx::Size packed_uv_size;
- EXPECT_TRUE(transformer_->TransformRGBToYV12(
+ ASSERT_TRUE(transformer_->TransformRGBToYV12(
original_texture, src_rect, dst_size,
&texture_y, &texture_u, &texture_v, &packed_y_size, &packed_uv_size));
EXPECT_NE(0u, texture_y);
@@ -344,6 +340,7 @@ class CompositingIOSurfaceTransformerTest : public testing::Test {
EXPECT_NE(0u, texture_v);
EXPECT_FALSE(packed_y_size.IsEmpty());
EXPECT_FALSE(packed_uv_size.IsEmpty());
+ EXPECT_NO_GL_ERROR(glDeleteTextures(1, &original_texture));
// Read-back the texture for each plane.
CGLFlushDrawable(context_); // Account for some buggy driver impls.
@@ -351,12 +348,6 @@ class CompositingIOSurfaceTransformerTest : public testing::Test {
const SkBitmap result_u_bitmap = ReadBackTexture(texture_u, packed_uv_size);
const SkBitmap result_v_bitmap = ReadBackTexture(texture_v, packed_uv_size);
- // Delete the textures.
- EXPECT_NO_GL_ERROR(glDeleteTextures(1, &original_texture));
- EXPECT_NO_GL_ERROR(glDeleteTextures(1, &texture_y));
- EXPECT_NO_GL_ERROR(glDeleteTextures(1, &texture_u));
- EXPECT_NO_GL_ERROR(glDeleteTextures(1, &texture_v));
-
// Compare the Y, U, and V planes read-back to the version produced by a
// known-working software implementation. Allow up to 2 lines of mismatch
// due to how implementations disagree on resolving the processing of edges.
« no previous file with comments | « content/browser/renderer_host/compositing_iosurface_transformer_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698