OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "config.h" | 5 #include "config.h" |
6 #include "CCRendererGL.h" | 6 #include "CCRendererGL.h" |
7 | 7 |
8 #include "CCDrawQuad.h" | 8 #include "CCDrawQuad.h" |
9 #include "CCPrioritizedTextureManager.h" | 9 #include "CCPrioritizedTextureManager.h" |
10 #include "CCResourceProvider.h" | 10 #include "CCResourceProvider.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 { | 36 { |
37 if (name == GraphicsContext3D::EXTENSIONS) | 37 if (name == GraphicsContext3D::EXTENSIONS) |
38 return WebString("GL_CHROMIUM_set_visibility GL_CHROMIUM_gpu_memory_
manager GL_CHROMIUM_discard_framebuffer"); | 38 return WebString("GL_CHROMIUM_set_visibility GL_CHROMIUM_gpu_memory_
manager GL_CHROMIUM_discard_framebuffer"); |
39 return WebString(); | 39 return WebString(); |
40 } | 40 } |
41 | 41 |
42 // Methods added for test. | 42 // Methods added for test. |
43 int frameCount() { return m_frame; } | 43 int frameCount() { return m_frame; } |
44 void setMemoryAllocation(WebGraphicsMemoryAllocation allocation) | 44 void setMemoryAllocation(WebGraphicsMemoryAllocation allocation) |
45 { | 45 { |
46 ASSERT(CCProxy::isImplThread()); | 46 DCHECK(CCProxy::isImplThread()); |
47 // In single threaded mode we expect this callback on main thread. | 47 // In single threaded mode we expect this callback on main thread. |
48 DebugScopedSetMainThread main; | 48 DebugScopedSetMainThread main; |
49 m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation)
; | 49 m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation)
; |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 int m_frame; | 53 int m_frame; |
54 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChange
dCallback; | 54 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChange
dCallback; |
55 }; | 55 }; |
56 | 56 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); | 395 FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); |
396 | 396 |
397 mockClient.rootRenderPass()->setHasTransparentBackground(false); | 397 mockClient.rootRenderPass()->setHasTransparentBackground(false); |
398 | 398 |
399 EXPECT_TRUE(renderer.initialize()); | 399 EXPECT_TRUE(renderer.initialize()); |
400 | 400 |
401 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa
sses()); | 401 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa
sses()); |
402 | 402 |
403 // On DEBUG builds, render passes with opaque background clear to blue to | 403 // On DEBUG builds, render passes with opaque background clear to blue to |
404 // easily see regions that were not drawn on the screen. | 404 // easily see regions that were not drawn on the screen. |
405 #if defined(NDEBUG) | 405 #ifdef NDEBUG |
406 EXPECT_EQ(0, context->clearCount()); | 406 EXPECT_EQ(0, context->clearCount()); |
407 #else | 407 #else |
408 EXPECT_EQ(1, context->clearCount()); | 408 EXPECT_EQ(1, context->clearCount()); |
409 #endif | 409 #endif |
410 } | 410 } |
411 | 411 |
412 TEST(CCRendererGLTest2, transparentBackground) | 412 TEST(CCRendererGLTest2, transparentBackground) |
413 { | 413 { |
414 FakeCCRendererClient mockClient; | 414 FakeCCRendererClient mockClient; |
415 scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::crea
te(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); | 415 scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::crea
te(scoped_ptr<WebKit::WebGraphicsContext3D>(new ClearCountingContext))); |
416 ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext
->context3D()); | 416 ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext
->context3D()); |
417 scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(c
cContext.get())); | 417 scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(c
cContext.get())); |
418 FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); | 418 FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); |
419 | 419 |
420 mockClient.rootRenderPass()->setHasTransparentBackground(true); | 420 mockClient.rootRenderPass()->setHasTransparentBackground(true); |
421 | 421 |
422 EXPECT_TRUE(renderer.initialize()); | 422 EXPECT_TRUE(renderer.initialize()); |
423 | 423 |
424 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa
sses()); | 424 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa
sses()); |
425 | 425 |
426 EXPECT_EQ(1, context->clearCount()); | 426 EXPECT_EQ(1, context->clearCount()); |
427 } | 427 } |
OLD | NEW |