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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp

Issue 10690121: Merge 121076 - [chromium] LayerRendererChromium is not getting visibility messages in single thread… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); 82 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
83 83
84 if (m_textureUsageHint == FramebufferAttachment) 84 if (m_textureUsageHint == FramebufferAttachment)
85 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE _2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAM EBUFFER_ATTACHMENT_ANGLE)); 85 GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE _2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAM EBUFFER_ATTACHMENT_ANGLE));
86 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { 86 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) {
87 Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_ context->getExtensions()); 87 Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_ context->getExtensions());
88 GC3Denum storageFormat = textureToStorageFormat(format); 88 GC3Denum storageFormat = textureToStorageFormat(format);
89 extensions->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFor mat, size.width(), size.height()); 89 extensions->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFor mat, size.width(), size.height());
90 } else 90 } else
91 GLC(m_context.get(), m_context->texImage2DResourceSafe(GraphicsContext3D ::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext 3D::UNSIGNED_BYTE)); 91 GLC(m_context.get(), m_context->texImage2DResourceSafe(GraphicsContext3D ::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext 3D::UNSIGNED_BYTE));
92 m_allocatedTextureIds.add(textureId);
92 return textureId; 93 return textureId;
93 } 94 }
94 95
95 void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format) 96 void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format)
96 { 97 {
97 m_currentMemoryUseBytes -= TextureManager::memoryUseBytes(size, format); 98 m_currentMemoryUseBytes -= TextureManager::memoryUseBytes(size, format);
98 GLC(m_context.get(), m_context->deleteTexture(textureId)); 99 GLC(m_context.get(), m_context->deleteTexture(textureId));
100 ASSERT(m_allocatedTextureIds.contains(textureId));
101 m_allocatedTextureIds.remove(textureId);
102 }
103
104 void TrackingTextureAllocator::deleteAllTextures()
105 {
106 for (HashSet<unsigned>::const_iterator it = m_allocatedTextureIds.begin(); i t != m_allocatedTextureIds.end(); ++it)
107 GLC(m_context.get(), m_context->deleteTexture(*it));
108 m_currentMemoryUseBytes = 0;
109 m_allocatedTextureIds.clear();
99 } 110 }
100 111
101 } 112 }
102 113
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698