#ifndef CC_RASTER_TILE_TASK_H_
#define CC_RASTER_TILE_TASK_H_
#include <vector>
#include "cc/raster/task.h"
namespace cc {
class CC_EXPORT TileTask : public Task {
public:
typedef std::vector<scoped_refptr<TileTask>> Vector;
const TileTask::Vector& dependencies() const { return dependencies_; }
void SetExternalDependent(scoped_refptr<TileTask> dependent);
scoped_refptr<TileTask>& external_dependent() { return external_dependent_; }
void ExternalDependencyCompleted();
bool supports_concurrent_execution() const {
return supports_concurrent_execution_ == SupportsConcurrentExecution::kYes;
}
bool supports_background_thread_priority() const {
return supports_background_thread_priority_ ==
SupportsBackgroundThreadPriority::kYes;
}
virtual bool IsRasterTask() const;
virtual void OnTaskCompleted() = 0;
virtual bool TaskContainsLCPCandidateImages() const;
void DidComplete();
bool HasCompleted() const;
protected:
enum class SupportsConcurrentExecution { kYes, kNo };
enum class SupportsBackgroundThreadPriority { kYes, kNo };
TileTask(SupportsConcurrentExecution supports_concurrent_execution,
SupportsBackgroundThreadPriority supports_background_thread_priority,
TileTask::Vector* dependencies = nullptr);
~TileTask() override;
const SupportsConcurrentExecution supports_concurrent_execution_;
const SupportsBackgroundThreadPriority supports_background_thread_priority_;
TileTask::Vector dependencies_;
scoped_refptr<TileTask> external_dependent_;
bool did_complete_ = false;
};
}
#endif