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

Side by Side Diff: cc/gl_renderer_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address code review comments and fix all cc_unittests Created 8 years, 1 month 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 // 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 "cc/gl_renderer.h" 6 #include "cc/gl_renderer.h"
7 7
8 #include "CCDrawQuad.h" 8 #include "CCDrawQuad.h"
9 #include "cc/prioritized_texture_manager.h" 9 #include "cc/prioritized_texture_manager.h"
10 #include "cc/resource_provider.h" 10 #include "cc/resource_provider.h"
(...skipping 25 matching lines...) Expand all
36 { 36 {
37 if (name == GL_EXTENSIONS) 37 if (name == GL_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 DCHECK(Proxy::isImplThread());
47 // In single threaded mode we expect this callback on main thread. 46 // In single threaded mode we expect this callback on main thread.
48 DebugScopedSetMainThread main; 47 // DebugScopedSetMainThread main; // TODO: eviction
danakj 2012/10/25 05:06:06 Left a comment in here by mistake?
49 m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation) ; 48 m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation) ;
50 } 49 }
51 50
52 private: 51 private:
53 int m_frame; 52 int m_frame;
54 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChange dCallback; 53 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChange dCallback;
55 }; 54 };
56 55
57 class FakeRendererClient : public RendererClient { 56 class FakeRendererClient : public RendererClient {
58 public: 57 public:
(...skipping 22 matching lines...) Expand all
81 int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCou nt; } 80 int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCou nt; }
82 81
83 RenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.back(); } 82 RenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.back(); }
84 const RenderPassList& renderPassesInDrawOrder() const { return m_renderPasse sInDrawOrder; } 83 const RenderPassList& renderPassesInDrawOrder() const { return m_renderPasse sInDrawOrder; }
85 const RenderPassIdHashMap& renderPasses() const { return m_renderPasses; } 84 const RenderPassIdHashMap& renderPasses() const { return m_renderPasses; }
86 85
87 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBy tes; } 86 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBy tes; }
88 87
89 private: 88 private:
90 int m_setFullRootLayerDamageCount; 89 int m_setFullRootLayerDamageCount;
91 DebugScopedSetImplThread m_implThread;
92 scoped_ptr<LayerImpl> m_rootLayer; 90 scoped_ptr<LayerImpl> m_rootLayer;
93 RenderPassList m_renderPassesInDrawOrder; 91 RenderPassList m_renderPassesInDrawOrder;
94 RenderPassIdHashMap m_renderPasses; 92 RenderPassIdHashMap m_renderPasses;
95 size_t m_memoryAllocationLimitBytes; 93 size_t m_memoryAllocationLimitBytes;
96 }; 94 };
97 95
98 class FakeRendererGL : public GLRenderer { 96 class FakeRendererGL : public GLRenderer {
99 public: 97 public:
100 FakeRendererGL(RendererClient* client, ResourceProvider* resourceProvider) : GLRenderer(client, resourceProvider) { } 98 FakeRendererGL(RendererClient* client, ResourceProvider* resourceProvider) : GLRenderer(client, resourceProvider, false) { }
101 99
102 // GLRenderer methods. 100 // GLRenderer methods.
103 101
104 // Changing visibility to public. 102 // Changing visibility to public.
105 using GLRenderer::initialize; 103 using GLRenderer::initialize;
106 using GLRenderer::isFramebufferDiscarded; 104 using GLRenderer::isFramebufferDiscarded;
107 }; 105 };
108 106
109 class GLRendererTest : public testing::Test { 107 class GLRendererTest : public testing::Test {
110 protected: 108 protected:
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 FakeRendererGL renderer(&mockClient, resourceProvider.get()); 417 FakeRendererGL renderer(&mockClient, resourceProvider.get());
420 418
421 mockClient.rootRenderPass()->setHasTransparentBackground(true); 419 mockClient.rootRenderPass()->setHasTransparentBackground(true);
422 420
423 EXPECT_TRUE(renderer.initialize()); 421 EXPECT_TRUE(renderer.initialize());
424 422
425 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses()); 423 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses());
426 424
427 EXPECT_EQ(1, context->clearCount()); 425 EXPECT_EQ(1, context->clearCount());
428 } 426 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698