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

Unified Diff: Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.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 side-by-side diff with in-line comments
Download patch
Index: Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (revision 122257)
+++ Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (working copy)
@@ -79,7 +79,6 @@
virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { }
- virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t) OVERRIDE { }
PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassRefPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr)
{
@@ -1790,7 +1789,7 @@
Mock::VerifyAndClearExpectations(&mockContext);
}
-class PartialSwapContext: public FakeWebGraphicsContext3D {
+class PartialSwapContext : public FakeWebGraphicsContext3D {
public:
WebString getString(WGC3Denum name)
{
@@ -2039,12 +2038,17 @@
// FakeWebGraphicsContext3D have an id of 1).
class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D {
public:
+ StrictWebGraphicsContext3D()
+ : FakeWebGraphicsContext3D()
+ {
+ m_nextTextureId = 7; // Start allocating texture ids larger than any other resource IDs so we can tell if someone's mixing up their resource types.
+ }
+
virtual WebGLId createBuffer() { return 2; }
virtual WebGLId createFramebuffer() { return 3; }
virtual WebGLId createProgram() { return 4; }
virtual WebGLId createRenderbuffer() { return 5; }
virtual WebGLId createShader(WGC3Denum) { return 6; }
- virtual WebGLId createTexture() { return 7; }
virtual void deleteBuffer(WebGLId id)
{
@@ -2076,10 +2080,17 @@
ADD_FAILURE() << "Trying to delete shader id " << id;
}
+ virtual WebGLId createTexture()
+ {
+ unsigned textureId = FakeWebGraphicsContext3D::createTexture();
+ m_allocatedTextureIds.add(textureId);
+ return textureId;
+ }
virtual void deleteTexture(WebGLId id)
{
- if (id != 7)
+ if (!m_allocatedTextureIds.contains(id))
ADD_FAILURE() << "Trying to delete texture id " << id;
+ m_allocatedTextureIds.remove(id);
}
virtual void bindBuffer(WGC3Denum, WebGLId id)
@@ -2114,7 +2125,7 @@
virtual void bindTexture(WGC3Denum, WebGLId id)
{
- if (id != 7 && id)
+ if (id && !m_allocatedTextureIds.contains(id))
ADD_FAILURE() << "Trying to bind texture id " << id;
}
@@ -2122,6 +2133,9 @@
{
return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow);
}
+
+private:
+ HashSet<unsigned> m_allocatedTextureIds;
};
// Fake video frame that represents a 4x4 YUV video frame.
@@ -2261,14 +2275,13 @@
class TrackingWebGraphicsContext3D : public FakeWebGraphicsContext3D {
public:
TrackingWebGraphicsContext3D()
- : m_nextTextureId(1)
+ : FakeWebGraphicsContext3D()
, m_numTextures(0)
{ }
virtual WebGLId createTexture() OVERRIDE
{
- WebGLId id = m_nextTextureId;
- ++m_nextTextureId;
+ WebGLId id = FakeWebGraphicsContext3D::createTexture();
m_textures.set(id, true);
++m_numTextures;
@@ -2300,7 +2313,6 @@
unsigned numTextures() const { return m_numTextures; }
private:
- WebGLId m_nextTextureId;
HashMap<WebGLId, bool> m_textures;
unsigned m_numTextures;
};

Powered by Google App Engine
This is Rietveld 408576698