| 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 "cc/resource_update_controller.h" | 5 #include "cc/resource_update_controller.h" |
| 6 | 6 |
| 7 #include "cc/prioritized_resource_manager.h" | 7 #include "cc/prioritized_resource_manager.h" |
| 8 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 8 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
| 9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
| 10 #include "cc/test/fake_proxy.h" | 10 #include "cc/test/fake_proxy.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 void updateTextures() | 179 void updateTextures() |
| 180 { | 180 { |
| 181 DebugScopedSetImplThreadAndMainThreadBlocked | 181 DebugScopedSetImplThreadAndMainThreadBlocked |
| 182 implThreadAndMainThreadBlocked(&m_proxy); | 182 implThreadAndMainThreadBlocked(&m_proxy); |
| 183 scoped_ptr<ResourceUpdateController> updateController = | 183 scoped_ptr<ResourceUpdateController> updateController = |
| 184 ResourceUpdateController::create( | 184 ResourceUpdateController::create( |
| 185 NULL, | 185 NULL, |
| 186 m_proxy.implThread(), | 186 m_proxy.implThread(), |
| 187 m_queue.Pass(), | 187 m_queue.Pass(), |
| 188 m_resourceProvider.get(), | 188 m_resourceProvider.get()); |
| 189 m_proxy.hasImplThread()); | |
| 190 updateController->finalize(); | 189 updateController->finalize(); |
| 191 } | 190 } |
| 192 | 191 |
| 193 void makeQueryResultAvailable() | 192 void makeQueryResultAvailable() |
| 194 { | 193 { |
| 195 m_queryResultsAvailable++; | 194 m_queryResultsAvailable++; |
| 196 } | 195 } |
| 197 | 196 |
| 198 protected: | 197 protected: |
| 199 // Classes required to interact and test the ResourceUpdateController | 198 // Classes required to interact and test the ResourceUpdateController |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 357 |
| 359 void setNow(base::TimeTicks time) { m_now = time; } | 358 void setNow(base::TimeTicks time) { m_now = time; } |
| 360 virtual base::TimeTicks now() const OVERRIDE { return m_now; } | 359 virtual base::TimeTicks now() const OVERRIDE { return m_now; } |
| 361 void setUpdateMoreTexturesTime(base::TimeDelta time) { m_updateMoreTexturesT
ime = time; } | 360 void setUpdateMoreTexturesTime(base::TimeDelta time) { m_updateMoreTexturesT
ime = time; } |
| 362 virtual base::TimeDelta updateMoreTexturesTime() const OVERRIDE { return m_u
pdateMoreTexturesTime; } | 361 virtual base::TimeDelta updateMoreTexturesTime() const OVERRIDE { return m_u
pdateMoreTexturesTime; } |
| 363 void setUpdateMoreTexturesSize(size_t size) { m_updateMoreTexturesSize = siz
e; } | 362 void setUpdateMoreTexturesSize(size_t size) { m_updateMoreTexturesSize = siz
e; } |
| 364 virtual size_t updateMoreTexturesSize() const OVERRIDE { return m_updateMore
TexturesSize; } | 363 virtual size_t updateMoreTexturesSize() const OVERRIDE { return m_updateMore
TexturesSize; } |
| 365 | 364 |
| 366 protected: | 365 protected: |
| 367 FakeResourceUpdateController(cc::ResourceUpdateControllerClient* client, cc:
:Thread* thread, scoped_ptr<ResourceUpdateQueue> queue, ResourceProvider* resour
ceProvider) | 366 FakeResourceUpdateController(cc::ResourceUpdateControllerClient* client, cc:
:Thread* thread, scoped_ptr<ResourceUpdateQueue> queue, ResourceProvider* resour
ceProvider) |
| 368 : cc::ResourceUpdateController(client, thread, queue.Pass(), resourcePro
vider, false) | 367 : cc::ResourceUpdateController(client, thread, queue.Pass(), resourcePro
vider) |
| 369 , m_updateMoreTexturesSize(0) { } | 368 , m_updateMoreTexturesSize(0) { } |
| 370 | 369 |
| 371 base::TimeTicks m_now; | 370 base::TimeTicks m_now; |
| 372 base::TimeDelta m_updateMoreTexturesTime; | 371 base::TimeDelta m_updateMoreTexturesTime; |
| 373 size_t m_updateMoreTexturesSize; | 372 size_t m_updateMoreTexturesSize; |
| 374 }; | 373 }; |
| 375 | 374 |
| 376 static void runPendingTask(FakeThread* thread, FakeResourceUpdateController* con
troller) | 375 static void runPendingTask(FakeThread* thread, FakeResourceUpdateController* con
troller) |
| 377 { | 376 { |
| 378 EXPECT_TRUE(thread->hasPendingTask()); | 377 EXPECT_TRUE(thread->hasPendingTask()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 runPendingTask(&thread, controller.get()); | 496 runPendingTask(&thread, controller.get()); |
| 498 } | 497 } |
| 499 | 498 |
| 500 EXPECT_FALSE(thread.hasPendingTask()); | 499 EXPECT_FALSE(thread.hasPendingTask()); |
| 501 EXPECT_TRUE(client.readyToFinalizeCalled()); | 500 EXPECT_TRUE(client.readyToFinalizeCalled()); |
| 502 EXPECT_EQ(2, m_numTotalUploads); | 501 EXPECT_EQ(2, m_numTotalUploads); |
| 503 } | 502 } |
| 504 | 503 |
| 505 } // namespace | 504 } // namespace |
| 506 } // namespace cc | 505 } // namespace cc |
| OLD | NEW |