diff options
author | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 05:40:48 +0000 |
---|---|---|
committer | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 05:40:48 +0000 |
commit | 0a3040277d432ddcde310cc6c0f78850d7453e2a (patch) | |
tree | 3e3d312651b9e4efe69c6739424fe4fbb3eed0b4 /cc | |
parent | f9132e9700af6f4ff57fc7b063ff6fe27299f30a (diff) | |
download | chromium_src-0a3040277d432ddcde310cc6c0f78850d7453e2a.zip chromium_src-0a3040277d432ddcde310cc6c0f78850d7453e2a.tar.gz chromium_src-0a3040277d432ddcde310cc6c0f78850d7453e2a.tar.bz2 |
cc: Chromify resource_update_queue
BUG=
Review URL: https://chromiumcodereview.appspot.com/12962007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/nine_patch_layer.cc | 2 | ||||
-rw-r--r-- | cc/layers/nine_patch_layer_unittest.cc | 24 | ||||
-rw-r--r-- | cc/layers/scrollbar_layer_unittest.cc | 4 | ||||
-rw-r--r-- | cc/layers/tiled_layer_unittest.cc | 36 | ||||
-rw-r--r-- | cc/resources/bitmap_content_layer_updater.cc | 4 | ||||
-rw-r--r-- | cc/resources/bitmap_skpicture_content_layer_updater.cc | 4 | ||||
-rw-r--r-- | cc/resources/image_layer_updater.cc | 4 | ||||
-rw-r--r-- | cc/resources/prioritized_resource_unittest.cc | 15 | ||||
-rw-r--r-- | cc/resources/resource_update_controller.cc | 24 | ||||
-rw-r--r-- | cc/resources/resource_update_controller_unittest.cc | 4 | ||||
-rw-r--r-- | cc/resources/resource_update_queue.cc | 83 | ||||
-rw-r--r-- | cc/resources/resource_update_queue.h | 40 | ||||
-rw-r--r-- | cc/resources/skpicture_content_layer_updater.cc | 4 | ||||
-rw-r--r-- | cc/test/fake_scrollbar_layer.cc | 8 | ||||
-rw-r--r-- | cc/test/tiled_layer_test_common.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 2 | ||||
-rw-r--r-- | cc/trees/thread_proxy.cc | 2 |
17 files changed, 126 insertions, 138 deletions
diff --git a/cc/layers/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc index ae874c0..f22fcba 100644 --- a/cc/layers/nine_patch_layer.cc +++ b/cc/layers/nine_patch_layer.cc @@ -69,7 +69,7 @@ void NinePatchLayer::Update(ResourceUpdateQueue* queue, contentRect, contentRect, gfx::Vector2d()); - queue->appendFullUpload(upload); + queue->AppendFullUpload(upload); bitmap_dirty_ = false; } } diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc index d45049c..2c57d26 100644 --- a/cc/layers/nine_patch_layer_unittest.cc +++ b/cc/layers/nine_patch_layer_unittest.cc @@ -84,8 +84,8 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) // No bitmap set should not trigger any uploads. testLayer->SetTexturePriorities(calculator); testLayer->Update(&queue, &occlusionTracker, NULL); - EXPECT_EQ(queue.fullUploadSize(), 0); - EXPECT_EQ(queue.partialUploadSize(), 0); + EXPECT_EQ(queue.FullUploadSize(), 0); + EXPECT_EQ(queue.PartialUploadSize(), 0); // Setting a bitmap set should trigger a single full upload. SkBitmap bitmap; @@ -94,9 +94,9 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) testLayer->SetBitmap(bitmap, gfx::Rect(5, 5, 1, 1)); testLayer->SetTexturePriorities(calculator); testLayer->Update(&queue, &occlusionTracker, NULL); - EXPECT_EQ(queue.fullUploadSize(), 1); - EXPECT_EQ(queue.partialUploadSize(), 0); - ResourceUpdate params = queue.takeFirstFullUpload(); + EXPECT_EQ(queue.FullUploadSize(), 1); + EXPECT_EQ(queue.PartialUploadSize(), 0); + ResourceUpdate params = queue.TakeFirstFullUpload(); EXPECT_TRUE(params.texture != NULL); // Upload the texture. @@ -117,8 +117,8 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) // Nothing changed, so no repeated upload. testLayer->SetTexturePriorities(calculator); testLayer->Update(&queue, &occlusionTracker, NULL); - EXPECT_EQ(queue.fullUploadSize(), 0); - EXPECT_EQ(queue.partialUploadSize(), 0); + EXPECT_EQ(queue.FullUploadSize(), 0); + EXPECT_EQ(queue.PartialUploadSize(), 0); { DebugScopedSetImplThread implThread(proxy()); @@ -129,8 +129,8 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) // Reupload after eviction testLayer->SetTexturePriorities(calculator); testLayer->Update(&queue, &occlusionTracker, NULL); - EXPECT_EQ(queue.fullUploadSize(), 1); - EXPECT_EQ(queue.partialUploadSize(), 0); + EXPECT_EQ(queue.FullUploadSize(), 1); + EXPECT_EQ(queue.PartialUploadSize(), 0); // PrioritizedResourceManager clearing layer_tree_host_->contents_texture_manager()->UnregisterTexture(params.texture); @@ -138,9 +138,9 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) testLayer->SetTexturePriorities(calculator); ResourceUpdateQueue queue2; testLayer->Update(&queue2, &occlusionTracker, NULL); - EXPECT_EQ(queue2.fullUploadSize(), 1); - EXPECT_EQ(queue2.partialUploadSize(), 0); - params = queue2.takeFirstFullUpload(); + EXPECT_EQ(queue2.FullUploadSize(), 1); + EXPECT_EQ(queue2.PartialUploadSize(), 0); + params = queue2.TakeFirstFullUpload(); EXPECT_TRUE(params.texture != NULL); EXPECT_EQ(params.texture->resource_manager(), layer_tree_host_->contents_texture_manager()); } diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index a60d455..aed0353 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -318,8 +318,8 @@ public: scrollbarLayer->SetTexturePriorities(calculator); m_layerTreeHost->contents_texture_manager()->PrioritizeTextures(); scrollbarLayer->Update(&queue, &occlusionTracker, NULL); - EXPECT_EQ(0, queue.fullUploadSize()); - EXPECT_EQ(expectedResources, queue.partialUploadSize()); + EXPECT_EQ(0, queue.FullUploadSize()); + EXPECT_EQ(expectedResources, queue.PartialUploadSize()); testing::Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); } diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index baba88a..f9a4739 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -911,11 +911,11 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) std::numeric_limits<size_t>::max()); { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1)); - EXPECT_EQ(6, m_queue->fullUploadSize()); - EXPECT_EQ(0, m_queue->partialUploadSize()); + EXPECT_EQ(6, m_queue->FullUploadSize()); + EXPECT_EQ(0, m_queue->PartialUploadSize()); updateTextures(); EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } @@ -926,11 +926,11 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1)); - EXPECT_EQ(3, m_queue->fullUploadSize()); - EXPECT_EQ(3, m_queue->partialUploadSize()); + EXPECT_EQ(3, m_queue->FullUploadSize()); + EXPECT_EQ(3, m_queue->PartialUploadSize()); updateTextures(); EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } @@ -941,11 +941,11 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1)); layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); - EXPECT_EQ(2, m_queue->fullUploadSize()); - EXPECT_EQ(4, m_queue->partialUploadSize()); + EXPECT_EQ(2, m_queue->FullUploadSize()); + EXPECT_EQ(4, m_queue->PartialUploadSize()); updateTextures(); EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } @@ -964,11 +964,11 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1)); layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); - EXPECT_EQ(6, m_queue->fullUploadSize()); - EXPECT_EQ(0, m_queue->partialUploadSize()); + EXPECT_EQ(6, m_queue->FullUploadSize()); + EXPECT_EQ(0, m_queue->PartialUploadSize()); updateTextures(); EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } @@ -979,11 +979,11 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1)); layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); - EXPECT_EQ(0, m_queue->fullUploadSize()); - EXPECT_EQ(4, m_queue->partialUploadSize()); + EXPECT_EQ(0, m_queue->FullUploadSize()); + EXPECT_EQ(4, m_queue->PartialUploadSize()); updateTextures(); EXPECT_EQ(4, layer->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } @@ -1471,7 +1471,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) EXPECT_EQ(6, root->fakeLayerUpdater()->updateCount()); EXPECT_EQ(3, child->fakeLayerUpdater()->updateCount()); EXPECT_EQ(3, child2->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); root->fakeLayerUpdater()->clearUpdateCount(); child->fakeLayerUpdater()->clearUpdateCount(); @@ -1505,7 +1505,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) EXPECT_EQ(6, root->fakeLayerUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerUpdater()->updateCount()); EXPECT_EQ(0, child2->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); root->fakeLayerUpdater()->clearUpdateCount(); child->fakeLayerUpdater()->clearUpdateCount(); @@ -1540,7 +1540,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) EXPECT_EQ(0, root->fakeLayerUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerUpdater()->updateCount()); EXPECT_EQ(0, child2->fakeLayerUpdater()->updateCount()); - EXPECT_FALSE(m_queue->hasMoreUpdates()); + EXPECT_FALSE(m_queue->HasMoreUpdates()); root->fakeLayerUpdater()->clearUpdateCount(); child->fakeLayerUpdater()->clearUpdateCount(); diff --git a/cc/resources/bitmap_content_layer_updater.cc b/cc/resources/bitmap_content_layer_updater.cc index 8a65e9e..7d11e34 100644 --- a/cc/resources/bitmap_content_layer_updater.cc +++ b/cc/resources/bitmap_content_layer_updater.cc @@ -84,9 +84,9 @@ void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, source_rect, dest_offset); if (partial_update) - queue->appendPartialUpload(upload); + queue->AppendPartialUpload(upload); else - queue->appendFullUpload(upload); + queue->AppendFullUpload(upload); } void BitmapContentLayerUpdater::SetOpaque(bool opaque) { diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index e2fdc04..139a190 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -41,9 +41,9 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update( ResourceUpdate upload = ResourceUpdate::Create( texture(), &bitmap_, source_rect, source_rect, dest_offset); if (partial_update) - queue->appendPartialUpload(upload); + queue->AppendPartialUpload(upload); else - queue->appendFullUpload(upload); + queue->AppendFullUpload(upload); } scoped_refptr<BitmapSkPictureContentLayerUpdater> diff --git a/cc/resources/image_layer_updater.cc b/cc/resources/image_layer_updater.cc index 5390d90..4422bc4 100644 --- a/cc/resources/image_layer_updater.cc +++ b/cc/resources/image_layer_updater.cc @@ -52,9 +52,9 @@ void ImageLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, ResourceUpdate upload = ResourceUpdate::Create( texture, &bitmap_, image_rect, clipped_source_rect, clipped_dest_offset); if (partial_update) - queue->appendPartialUpload(upload); + queue->AppendPartialUpload(upload); else - queue->appendFullUpload(upload); + queue->AppendFullUpload(upload); } } diff --git a/cc/resources/prioritized_resource_unittest.cc b/cc/resources/prioritized_resource_unittest.cc index 51e7df8..17dd746 100644 --- a/cc/resources/prioritized_resource_unittest.cc +++ b/cc/resources/prioritized_resource_unittest.cc @@ -681,28 +681,27 @@ TEST_F(PrioritizedResourceTest, ClearUploadsToEvictedResources) { for (size_t i = 0; i < max_textures; ++i) { const ResourceUpdate upload = ResourceUpdate::Create( textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d()); - queue.appendFullUpload(upload); + queue.AppendFullUpload(upload); } // Make sure that we have backings for all of the textures. for (size_t i = 0; i < max_textures; ++i) EXPECT_TRUE(textures[i]->have_backing_texture()); - queue.clearUploadsToEvictedResources(); - EXPECT_EQ(4, queue.fullUploadSize()); + queue.ClearUploadsToEvictedResources(); + EXPECT_EQ(4, queue.FullUploadSize()); resource_manager->ReduceMemoryOnImplThread( TexturesMemorySize(1), PriorityCalculator::AllowEverythingCutoff(), ResourceProvider()); - queue.clearUploadsToEvictedResources(); - EXPECT_EQ(1, queue.fullUploadSize()); + queue.ClearUploadsToEvictedResources(); + EXPECT_EQ(1, queue.FullUploadSize()); resource_manager->ReduceMemoryOnImplThread( 0, PriorityCalculator::AllowEverythingCutoff(), ResourceProvider()); - queue.clearUploadsToEvictedResources(); - EXPECT_EQ(0, queue.fullUploadSize()); - + queue.ClearUploadsToEvictedResources(); + EXPECT_EQ(0, queue.FullUploadSize()); } TEST_F(PrioritizedResourceTest, UsageStatistics) { diff --git a/cc/resources/resource_update_controller.cc b/cc/resources/resource_update_controller.cc index b568f5c..1dc36b5 100644 --- a/cc/resources/resource_update_controller.cc +++ b/cc/resources/resource_update_controller.cc @@ -107,7 +107,7 @@ void ResourceUpdateController::PerformMoreUpdates( } void ResourceUpdateController::DiscardUploadsToEvictedResources() { - queue_->clearUploadsToEvictedResources(); + queue_->ClearUploadsToEvictedResources(); } void ResourceUpdateController::UpdateTexture(ResourceUpdate update) { @@ -183,18 +183,18 @@ void ResourceUpdateController::UpdateTexture(ResourceUpdate update) { } void ResourceUpdateController::Finalize() { - while (queue_->fullUploadSize()) - UpdateTexture(queue_->takeFirstFullUpload()); + while (queue_->FullUploadSize()) + UpdateTexture(queue_->TakeFirstFullUpload()); - while (queue_->partialUploadSize()) - UpdateTexture(queue_->takeFirstPartialUpload()); + while (queue_->PartialUploadSize()) + UpdateTexture(queue_->TakeFirstPartialUpload()); resource_provider_->FlushUploads(); - if (queue_->copySize()) { + if (queue_->CopySize()) { TextureCopier* copier = resource_provider_->texture_copier(); - while (queue_->copySize()) - copier->CopyTexture(queue_->takeFirstCopy()); + while (queue_->CopySize()) + copier->CopyTexture(queue_->TakeFirstCopy()); // If we've performed any texture copies, we need to insert a flush // here into the compositor context before letting the main thread @@ -234,7 +234,7 @@ base::TimeDelta ResourceUpdateController::PendingUpdateTime() const { bool ResourceUpdateController::UpdateMoreTexturesIfEnoughTimeRemaining() { while (resource_provider_->NumBlockingUploads() < MaxBlockingUpdates()) { - if (!queue_->fullUploadSize()) + if (!queue_->FullUploadSize()) return false; if (!time_limit_.is_null()) { @@ -261,13 +261,13 @@ bool ResourceUpdateController::UpdateMoreTexturesIfEnoughTimeRemaining() { void ResourceUpdateController::UpdateMoreTexturesNow() { size_t uploads = std::min( - queue_->fullUploadSize(), UpdateMoreTexturesSize()); + queue_->FullUploadSize(), UpdateMoreTexturesSize()); if (!uploads) return; - while (queue_->fullUploadSize() && uploads--) - UpdateTexture(queue_->takeFirstFullUpload()); + while (queue_->FullUploadSize() && uploads--) + UpdateTexture(queue_->TakeFirstFullUpload()); resource_provider_->FlushUploads(); } diff --git a/cc/resources/resource_update_controller_unittest.cc b/cc/resources/resource_update_controller_unittest.cc index be87115..bd8f46f 100644 --- a/cc/resources/resource_update_controller_unittest.cc +++ b/cc/resources/resource_update_controller_unittest.cc @@ -146,7 +146,7 @@ protected: const ResourceUpdate upload = ResourceUpdate::Create( textures_[textureIndex].get(), &m_bitmap, rect, rect, gfx::Vector2d()); for (int i = 0; i < count; i++) - m_queue->appendFullUpload(upload); + m_queue->AppendFullUpload(upload); } void appendFullUploadsToUpdateQueue(int count) @@ -163,7 +163,7 @@ protected: const ResourceUpdate upload = ResourceUpdate::Create( textures_[textureIndex].get(), &m_bitmap, rect, rect, gfx::Vector2d()); for (int i = 0; i < count; i++) - m_queue->appendPartialUpload(upload); + m_queue->AppendPartialUpload(upload); } void appendPartialUploadsToUpdateQueue(int count) diff --git a/cc/resources/resource_update_queue.cc b/cc/resources/resource_update_queue.cc index e94f218..18a0fdb 100644 --- a/cc/resources/resource_update_queue.cc +++ b/cc/resources/resource_update_queue.cc @@ -8,71 +8,60 @@ namespace cc { -ResourceUpdateQueue::ResourceUpdateQueue() -{ -} +ResourceUpdateQueue::ResourceUpdateQueue() {} -ResourceUpdateQueue::~ResourceUpdateQueue() -{ -} +ResourceUpdateQueue::~ResourceUpdateQueue() {} -void ResourceUpdateQueue::appendFullUpload(const ResourceUpdate& upload) -{ - m_fullEntries.push_back(upload); +void ResourceUpdateQueue::AppendFullUpload(const ResourceUpdate& upload) { + full_entries_.push_back(upload); } -void ResourceUpdateQueue::appendPartialUpload(const ResourceUpdate& upload) -{ - m_partialEntries.push_back(upload); +void ResourceUpdateQueue::AppendPartialUpload(const ResourceUpdate& upload) { + partial_entries_.push_back(upload); } -void ResourceUpdateQueue::appendCopy(TextureCopier::Parameters copy) -{ - m_copyEntries.push_back(copy); +void ResourceUpdateQueue::AppendCopy(TextureCopier::Parameters copy) { + copy_entries_.push_back(copy); } -void ResourceUpdateQueue::clearUploadsToEvictedResources() -{ - clearUploadsToEvictedResources(m_fullEntries); - clearUploadsToEvictedResources(m_partialEntries); +void ResourceUpdateQueue::ClearUploadsToEvictedResources() { + ClearUploadsToEvictedResources(&full_entries_); + ClearUploadsToEvictedResources(&partial_entries_); } -void ResourceUpdateQueue::clearUploadsToEvictedResources(std::deque<ResourceUpdate>& entryQueue) -{ - std::deque<ResourceUpdate> temp; - entryQueue.swap(temp); - while (temp.size()) { - ResourceUpdate upload = temp.front(); - temp.pop_front(); - if (!upload.texture->BackingResourceWasEvicted()) - entryQueue.push_back(upload); - } +void ResourceUpdateQueue::ClearUploadsToEvictedResources( + std::deque<ResourceUpdate>* entry_queue) { + std::deque<ResourceUpdate> temp; + entry_queue->swap(temp); + while (temp.size()) { + ResourceUpdate upload = temp.front(); + temp.pop_front(); + if (!upload.texture->BackingResourceWasEvicted()) + entry_queue->push_back(upload); + } } -ResourceUpdate ResourceUpdateQueue::takeFirstFullUpload() -{ - ResourceUpdate first = m_fullEntries.front(); - m_fullEntries.pop_front(); - return first; +ResourceUpdate ResourceUpdateQueue::TakeFirstFullUpload() { + ResourceUpdate first = full_entries_.front(); + full_entries_.pop_front(); + return first; } -ResourceUpdate ResourceUpdateQueue::takeFirstPartialUpload() -{ - ResourceUpdate first = m_partialEntries.front(); - m_partialEntries.pop_front(); - return first; +ResourceUpdate ResourceUpdateQueue::TakeFirstPartialUpload() { + ResourceUpdate first = partial_entries_.front(); + partial_entries_.pop_front(); + return first; } -TextureCopier::Parameters ResourceUpdateQueue::takeFirstCopy() -{ - TextureCopier::Parameters first = m_copyEntries.front(); - m_copyEntries.pop_front(); - return first; +TextureCopier::Parameters ResourceUpdateQueue::TakeFirstCopy() { + TextureCopier::Parameters first = copy_entries_.front(); + copy_entries_.pop_front(); + return first; } -bool ResourceUpdateQueue::hasMoreUpdates() const -{ - return m_fullEntries.size() || m_partialEntries.size() || m_copyEntries.size(); +bool ResourceUpdateQueue::HasMoreUpdates() const { + return !full_entries_.empty() || !partial_entries_.empty() || + !copy_entries_.empty(); } } // namespace cc diff --git a/cc/resources/resource_update_queue.h b/cc/resources/resource_update_queue.h index c8bb69b..45a983a 100644 --- a/cc/resources/resource_update_queue.h +++ b/cc/resources/resource_update_queue.h @@ -14,33 +14,33 @@ namespace cc { class CC_EXPORT ResourceUpdateQueue { -public: - ResourceUpdateQueue(); - virtual ~ResourceUpdateQueue(); + public: + ResourceUpdateQueue(); + virtual ~ResourceUpdateQueue(); - void appendFullUpload(const ResourceUpdate&); - void appendPartialUpload(const ResourceUpdate&); - void appendCopy(TextureCopier::Parameters); + void AppendFullUpload(const ResourceUpdate& upload); + void AppendPartialUpload(const ResourceUpdate& upload); + void AppendCopy(TextureCopier::Parameters copy); - void clearUploadsToEvictedResources(); + void ClearUploadsToEvictedResources(); - ResourceUpdate takeFirstFullUpload(); - ResourceUpdate takeFirstPartialUpload(); - TextureCopier::Parameters takeFirstCopy(); + ResourceUpdate TakeFirstFullUpload(); + ResourceUpdate TakeFirstPartialUpload(); + TextureCopier::Parameters TakeFirstCopy(); - size_t fullUploadSize() const { return m_fullEntries.size(); } - size_t partialUploadSize() const { return m_partialEntries.size(); } - size_t copySize() const { return m_copyEntries.size(); } + size_t FullUploadSize() const { return full_entries_.size(); } + size_t PartialUploadSize() const { return partial_entries_.size(); } + size_t CopySize() const { return copy_entries_.size(); } - bool hasMoreUpdates() const; + bool HasMoreUpdates() const; -private: - void clearUploadsToEvictedResources(std::deque<ResourceUpdate>& entryQueue); - std::deque<ResourceUpdate> m_fullEntries; - std::deque<ResourceUpdate> m_partialEntries; - std::deque<TextureCopier::Parameters> m_copyEntries; + private: + void ClearUploadsToEvictedResources(std::deque<ResourceUpdate>* entry_queue); + std::deque<ResourceUpdate> full_entries_; + std::deque<ResourceUpdate> partial_entries_; + std::deque<TextureCopier::Parameters> copy_entries_; - DISALLOW_COPY_AND_ASSIGN(ResourceUpdateQueue); + DISALLOW_COPY_AND_ASSIGN(ResourceUpdateQueue); }; } diff --git a/cc/resources/skpicture_content_layer_updater.cc b/cc/resources/skpicture_content_layer_updater.cc index 1af05f9..0ca6ea8 100644 --- a/cc/resources/skpicture_content_layer_updater.cc +++ b/cc/resources/skpicture_content_layer_updater.cc @@ -76,9 +76,9 @@ void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue, ResourceUpdate upload = ResourceUpdate::CreateFromPicture( texture, &picture_, content_rect(), source_rect, dest_offset); if (partial_update) - queue->appendPartialUpload(upload); + queue->AppendPartialUpload(upload); else - queue->appendFullUpload(upload); + queue->AppendFullUpload(upload); } void SkPictureContentLayerUpdater::SetOpaque(bool opaque) { diff --git a/cc/test/fake_scrollbar_layer.cc b/cc/test/fake_scrollbar_layer.cc index ea1ce9f..43fcf84 100644 --- a/cc/test/fake_scrollbar_layer.cc +++ b/cc/test/fake_scrollbar_layer.cc @@ -33,12 +33,12 @@ FakeScrollbarLayer::~FakeScrollbarLayer() {} void FakeScrollbarLayer::Update(ResourceUpdateQueue* queue, const OcclusionTracker* occlusion, RenderingStats* stats) { - size_t full = queue->fullUploadSize(); - size_t partial = queue->partialUploadSize(); + size_t full = queue->FullUploadSize(); + size_t partial = queue->PartialUploadSize(); ScrollbarLayer::Update(queue, occlusion, stats); update_count_++; - last_update_full_upload_size_ = queue->fullUploadSize() - full; - last_update_partial_upload_size_ = queue->partialUploadSize() - partial; + last_update_full_upload_size_ = queue->FullUploadSize() - full; + last_update_partial_upload_size_ = queue->PartialUploadSize() - partial; } } // namespace cc diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 67ca38c..01c8f83 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc @@ -33,9 +33,9 @@ void FakeLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, gfx::Rect so ResourceUpdate upload = ResourceUpdate::Create( texture(), &m_bitmap, rect, rect, gfx::Vector2d()); if (partialUpdate) - queue->appendPartialUpload(upload); + queue->AppendPartialUpload(upload); else - queue->appendFullUpload(upload); + queue->AppendFullUpload(upload); m_layer->update(); } diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index ced0b61..67a45750 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -1443,7 +1443,7 @@ void EvictionTestLayer::Update(ResourceUpdateQueue* queue, const OcclusionTracke gfx::Rect fullRect(0, 0, 10, 10); ResourceUpdate upload = ResourceUpdate::Create( m_texture.get(), &m_bitmap, fullRect, fullRect, gfx::Vector2d()); - queue->appendFullUpload(upload); + queue->AppendFullUpload(upload); } scoped_ptr<LayerImpl> EvictionTestLayer::CreateLayerImpl(LayerTreeImpl* treeImpl) diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index b2a7756..45835e8 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -788,7 +788,7 @@ void ThreadProxy::BeginFrameCompleteOnImplThread( LinkedEvictedBackingsExist()) { // Clear any uploads we were making to textures linked to evicted // resources - queue->clearUploadsToEvictedResources(); + queue->ClearUploadsToEvictedResources(); // Some textures in the layer tree are invalid. Kick off another commit // to fill them again. SetNeedsCommitOnImplThread(); |