ash: Add missing include to test from r236852.
[chromium-blink-merge.git] / cc / resources / resource_update_queue.cc
blob31727cd808c9d6cc370756cf63b20909fd2ffccc
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"
9 namespace cc {
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);
32 while (temp.size()) {
33 ResourceUpdate upload = temp.front();
34 temp.pop_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();
43 return first;
46 ResourceUpdate ResourceUpdateQueue::TakeFirstPartialUpload() {
47 ResourceUpdate first = partial_entries_.front();
48 partial_entries_.pop_front();
49 return first;
52 bool ResourceUpdateQueue::HasMoreUpdates() const {
53 return !full_entries_.empty() || !partial_entries_.empty();
56 } // namespace cc