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
3 // found in the LICENSE file.
5 #include "cc/resources/resource_update_queue.h"
7 #include "cc/resources/prioritized_resource.h"
11 ResourceUpdateQueue::ResourceUpdateQueue() {}
13 ResourceUpdateQueue::~ResourceUpdateQueue() {}
15 void ResourceUpdateQueue::AppendFullUpload(const ResourceUpdate
& upload
) {
16 full_entries_
.push_back(upload
);
19 void ResourceUpdateQueue::AppendPartialUpload(const ResourceUpdate
& upload
) {
20 partial_entries_
.push_back(upload
);
23 void ResourceUpdateQueue::ClearUploadsToEvictedResources() {
24 ClearUploadsToEvictedResources(&full_entries_
);
25 ClearUploadsToEvictedResources(&partial_entries_
);
28 void ResourceUpdateQueue::ClearUploadsToEvictedResources(
29 std::deque
<ResourceUpdate
>* entry_queue
) {
30 std::deque
<ResourceUpdate
> temp
;
31 entry_queue
->swap(temp
);
33 ResourceUpdate upload
= temp
.front();
35 if (!upload
.texture
->BackingResourceWasEvicted())
36 entry_queue
->push_back(upload
);
40 ResourceUpdate
ResourceUpdateQueue::TakeFirstFullUpload() {
41 ResourceUpdate first
= full_entries_
.front();
42 full_entries_
.pop_front();
46 ResourceUpdate
ResourceUpdateQueue::TakeFirstPartialUpload() {
47 ResourceUpdate first
= partial_entries_
.front();
48 partial_entries_
.pop_front();
52 bool ResourceUpdateQueue::HasMoreUpdates() const {
53 return !full_entries_
.empty() || !partial_entries_
.empty();