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 | 6 |
7 #include "cc/resource_update_controller.h" | 7 #include "cc/resource_update_controller.h" |
8 | 8 |
9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
10 #include "cc/test/fake_web_compositor_output_surface.h" | 10 #include "cc/test/fake_web_compositor_output_surface.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 protected: | 110 protected: |
111 virtual void SetUp() | 111 virtual void SetUp() |
112 { | 112 { |
113 m_context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::We
bGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this))); | 113 m_context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::We
bGraphicsContext3D>(new WebGraphicsContext3DForUploadTest(this))); |
114 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 150); | 114 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 150); |
115 m_bitmap.allocPixels(); | 115 m_bitmap.allocPixels(); |
116 | 116 |
117 for (int i = 0; i < 4; i++) { | 117 for (int i = 0; i < 4; i++) { |
118 m_textures[i] = PrioritizedTexture::create( | 118 m_textures[i] = PrioritizedTexture::create( |
119 m_textureManager.get(), IntSize(300, 150), GL_RGBA); | 119 m_textureManager.get(), gfx::Size(300, 150), GL_RGBA); |
120 m_textures[i]->setRequestPriority( | 120 m_textures[i]->setRequestPriority( |
121 PriorityCalculator::visiblePriority(true)); | 121 PriorityCalculator::visiblePriority(true)); |
122 } | 122 } |
123 m_textureManager->prioritizeTextures(); | 123 m_textureManager->prioritizeTextures(); |
124 | 124 |
125 DebugScopedSetImplThread implThread; | 125 DebugScopedSetImplThread implThread; |
126 m_resourceProvider = ResourceProvider::create(m_context.get()); | 126 m_resourceProvider = ResourceProvider::create(m_context.get()); |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 void appendFullUploadsOfIndexedTextureToUpdateQueue(int count, int textureIn
dex) | 130 void appendFullUploadsOfIndexedTextureToUpdateQueue(int count, int textureIn
dex) |
131 { | 131 { |
132 m_fullUploadCountExpected += count; | 132 m_fullUploadCountExpected += count; |
133 m_totalUploadCountExpected += count; | 133 m_totalUploadCountExpected += count; |
134 | 134 |
135 const IntRect rect(0, 0, 300, 150); | 135 const gfx::Rect rect(0, 0, 300, 150); |
136 const ResourceUpdate upload = ResourceUpdate::Create( | 136 const ResourceUpdate upload = ResourceUpdate::Create( |
137 m_textures[textureIndex].get(), &m_bitmap, rect, rect, IntSize()); | 137 m_textures[textureIndex].get(), &m_bitmap, rect, rect, gfx::Vector2d
()); |
138 for (int i = 0; i < count; i++) | 138 for (int i = 0; i < count; i++) |
139 m_queue->appendFullUpload(upload); | 139 m_queue->appendFullUpload(upload); |
140 } | 140 } |
141 | 141 |
142 void appendFullUploadsToUpdateQueue(int count) | 142 void appendFullUploadsToUpdateQueue(int count) |
143 { | 143 { |
144 appendFullUploadsOfIndexedTextureToUpdateQueue(count, 0); | 144 appendFullUploadsOfIndexedTextureToUpdateQueue(count, 0); |
145 } | 145 } |
146 | 146 |
147 void appendPartialUploadsOfIndexedTextureToUpdateQueue(int count, int textur
eIndex) | 147 void appendPartialUploadsOfIndexedTextureToUpdateQueue(int count, int textur
eIndex) |
148 { | 148 { |
149 m_partialCountExpected += count; | 149 m_partialCountExpected += count; |
150 m_totalUploadCountExpected += count; | 150 m_totalUploadCountExpected += count; |
151 | 151 |
152 const IntRect rect(0, 0, 100, 100); | 152 const gfx::Rect rect(0, 0, 100, 100); |
153 const ResourceUpdate upload = ResourceUpdate::Create( | 153 const ResourceUpdate upload = ResourceUpdate::Create( |
154 m_textures[textureIndex].get(), &m_bitmap, rect, rect, IntSize()); | 154 m_textures[textureIndex].get(), &m_bitmap, rect, rect, gfx::Vector2d
()); |
155 for (int i = 0; i < count; i++) | 155 for (int i = 0; i < count; i++) |
156 m_queue->appendPartialUpload(upload); | 156 m_queue->appendPartialUpload(upload); |
157 } | 157 } |
158 | 158 |
159 void appendPartialUploadsToUpdateQueue(int count) | 159 void appendPartialUploadsToUpdateQueue(int count) |
160 { | 160 { |
161 appendPartialUploadsOfIndexedTextureToUpdateQueue(count, 0); | 161 appendPartialUploadsOfIndexedTextureToUpdateQueue(count, 0); |
162 } | 162 } |
163 | 163 |
164 void setMaxUploadCountPerUpdate(int count) | 164 void setMaxUploadCountPerUpdate(int count) |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 if (thread.hasPendingTask()) | 471 if (thread.hasPendingTask()) |
472 runPendingTask(&thread, controller.get()); | 472 runPendingTask(&thread, controller.get()); |
473 } | 473 } |
474 | 474 |
475 EXPECT_FALSE(thread.hasPendingTask()); | 475 EXPECT_FALSE(thread.hasPendingTask()); |
476 EXPECT_TRUE(client.readyToFinalizeCalled()); | 476 EXPECT_TRUE(client.readyToFinalizeCalled()); |
477 EXPECT_EQ(2, m_numTotalUploads); | 477 EXPECT_EQ(2, m_numTotalUploads); |
478 } | 478 } |
479 | 479 |
480 } // namespace | 480 } // namespace |
OLD | NEW |