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. 4 5 #include "cc/resources/rasterizer.h" 6 7 #include <algorithm> 8 9 namespace cc { 10 RasterizerTask()11RasterizerTask::RasterizerTask() : did_schedule_(false), did_complete_(false) {} 12 ~RasterizerTask()13RasterizerTask::~RasterizerTask() { 14 // Debugging CHECKs to help track down a use-after-free. 15 CHECK(!did_schedule_); 16 CHECK(!did_run_ || did_complete_); 17 } 18 AsImageDecodeTask()19ImageDecodeTask* RasterizerTask::AsImageDecodeTask() { return NULL; } 20 AsRasterTask()21RasterTask* RasterizerTask::AsRasterTask() { return NULL; } 22 WillSchedule()23void RasterizerTask::WillSchedule() { DCHECK(!did_schedule_); } 24 DidSchedule()25void RasterizerTask::DidSchedule() { 26 did_schedule_ = true; 27 did_complete_ = false; 28 } 29 HasBeenScheduled() const30bool RasterizerTask::HasBeenScheduled() const { return did_schedule_; } 31 WillComplete()32void RasterizerTask::WillComplete() { DCHECK(!did_complete_); } 33 DidComplete()34void RasterizerTask::DidComplete() { 35 DCHECK(did_schedule_); 36 DCHECK(!did_complete_); 37 did_schedule_ = false; 38 did_complete_ = true; 39 } 40 HasCompleted() const41bool RasterizerTask::HasCompleted() const { return did_complete_; } 42 ImageDecodeTask()43ImageDecodeTask::ImageDecodeTask() {} 44 ~ImageDecodeTask()45ImageDecodeTask::~ImageDecodeTask() {} 46 AsImageDecodeTask()47ImageDecodeTask* ImageDecodeTask::AsImageDecodeTask() { return this; } 48 RasterTask(const Resource * resource,ImageDecodeTask::Vector * dependencies)49RasterTask::RasterTask(const Resource* resource, 50 ImageDecodeTask::Vector* dependencies) 51 : resource_(resource) { 52 dependencies_.swap(*dependencies); 53 } 54 ~RasterTask()55RasterTask::~RasterTask() {} 56 AsRasterTask()57RasterTask* RasterTask::AsRasterTask() { return this; } 58 Item(RasterTask * task,const TaskSetCollection & task_sets)59RasterTaskQueue::Item::Item(RasterTask* task, 60 const TaskSetCollection& task_sets) 61 : task(task), task_sets(task_sets) { 62 DCHECK(task_sets.any()); 63 } 64 ~Item()65RasterTaskQueue::Item::~Item() {} 66 RasterTaskQueue()67RasterTaskQueue::RasterTaskQueue() { 68 } 69 ~RasterTaskQueue()70RasterTaskQueue::~RasterTaskQueue() {} 71 Swap(RasterTaskQueue * other)72void RasterTaskQueue::Swap(RasterTaskQueue* other) { 73 items.swap(other->items); 74 } 75 Reset()76void RasterTaskQueue::Reset() { 77 items.clear(); 78 } 79 80 } // namespace cc 81