Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / cc / raster / tile_task_runner.cc
blobce568f95ab02058f51baa7bee1d5a8edb1eafdb8
1 // Copyright 2014 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/raster/tile_task_runner.h"
7 #include <algorithm>
9 namespace cc {
11 TileTask::TileTask() : did_schedule_(false), did_complete_(false) {
14 TileTask::~TileTask() {
15 DCHECK(!did_schedule_);
16 DCHECK(!did_run_ || did_complete_);
19 void TileTask::WillSchedule() {
20 DCHECK(!did_schedule_);
23 void TileTask::DidSchedule() {
24 did_schedule_ = true;
25 did_complete_ = false;
28 bool TileTask::HasBeenScheduled() const {
29 return did_schedule_;
32 void TileTask::WillComplete() {
33 DCHECK(!did_complete_);
36 void TileTask::DidComplete() {
37 DCHECK(did_schedule_);
38 DCHECK(!did_complete_);
39 did_schedule_ = false;
40 did_complete_ = true;
43 bool TileTask::HasCompleted() const {
44 return did_complete_;
47 ImageDecodeTask::ImageDecodeTask() {
50 ImageDecodeTask::~ImageDecodeTask() {
53 RasterTask::RasterTask(ImageDecodeTask::Vector* dependencies) {
54 dependencies_.swap(*dependencies);
57 RasterTask::~RasterTask() {
60 TileTaskQueue::Item::Item(RasterTask* task, const TaskSetCollection& task_sets)
61 : task(task), task_sets(task_sets) {
62 DCHECK(task_sets.any());
65 TileTaskQueue::Item::~Item() {
68 TileTaskQueue::TileTaskQueue() {
71 TileTaskQueue::~TileTaskQueue() {
74 void TileTaskQueue::Swap(TileTaskQueue* other) {
75 items.swap(other->items);
78 void TileTaskQueue::Reset() {
79 items.clear();
82 } // namespace cc