Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: cc/resources/rasterizer.h

Issue 786583002: cc: Renaming Rasterizer and RasterWorkerPool interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Update include files alphabetic orders. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/resources/rasterizer.h
diff --git a/cc/resources/rasterizer.h b/cc/resources/rasterizer.h
deleted file mode 100644
index db84c2223eba9566a2b7e5218b3bef8762cceafe..0000000000000000000000000000000000000000
--- a/cc/resources/rasterizer.h
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_RESOURCES_RASTERIZER_H_
-#define CC_RESOURCES_RASTERIZER_H_
-
-#include <bitset>
-#include <vector>
-
-#include "base/callback.h"
-#include "cc/resources/resource_format.h"
-#include "cc/resources/task_graph_runner.h"
-
-namespace cc {
-class ImageDecodeTask;
-class RasterTask;
-class Resource;
-class RasterBuffer;
-
-class CC_EXPORT RasterizerTaskClient {
- public:
- virtual scoped_ptr<RasterBuffer> AcquireBufferForRaster(
- const Resource* resource) = 0;
- virtual void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) = 0;
-
- protected:
- virtual ~RasterizerTaskClient() {}
-};
-
-class CC_EXPORT RasterizerTask : public Task {
- public:
- typedef std::vector<scoped_refptr<RasterizerTask>> Vector;
-
- virtual void ScheduleOnOriginThread(RasterizerTaskClient* client) = 0;
- virtual void CompleteOnOriginThread(RasterizerTaskClient* client) = 0;
- virtual void RunReplyOnOriginThread() = 0;
-
- // Type-checking downcast routines.
- virtual ImageDecodeTask* AsImageDecodeTask();
- virtual RasterTask* AsRasterTask();
-
- void WillSchedule();
- void DidSchedule();
- bool HasBeenScheduled() const;
-
- void WillComplete();
- void DidComplete();
- bool HasCompleted() const;
-
- protected:
- RasterizerTask();
- ~RasterizerTask() override;
-
- bool did_schedule_;
- bool did_complete_;
-};
-
-class CC_EXPORT ImageDecodeTask : public RasterizerTask {
- public:
- typedef std::vector<scoped_refptr<ImageDecodeTask>> Vector;
-
- // Overridden from RasterizerTask:
- ImageDecodeTask* AsImageDecodeTask() override;
-
- protected:
- ImageDecodeTask();
- ~ImageDecodeTask() override;
-};
-
-class CC_EXPORT RasterTask : public RasterizerTask {
- public:
- typedef std::vector<scoped_refptr<RasterTask>> Vector;
-
- // Overridden from RasterizerTask:
- RasterTask* AsRasterTask() override;
-
- const Resource* resource() const { return resource_; }
- const ImageDecodeTask::Vector& dependencies() const { return dependencies_; }
-
- protected:
- RasterTask(const Resource* resource, ImageDecodeTask::Vector* dependencies);
- ~RasterTask() override;
-
- private:
- const Resource* resource_;
- ImageDecodeTask::Vector dependencies_;
-};
-
-// kNumberOfTaskSets must be greater or equal to the number of values in
-// TileManager::NamedTaskSet.
-// TODO(reveman): Use template specialization to make it easy for client code to
-// check at compile time that the number of supported task sets is correct.
-static const size_t kNumberOfTaskSets = 3;
-typedef size_t TaskSet;
-typedef std::bitset<kNumberOfTaskSets> TaskSetCollection;
-
-class CC_EXPORT RasterizerClient {
- public:
- virtual void DidFinishRunningTasks(TaskSet task_set) = 0;
- virtual TaskSetCollection TasksThatShouldBeForcedToComplete() const = 0;
-
- protected:
- virtual ~RasterizerClient() {}
-};
-
-struct CC_EXPORT RasterTaskQueue {
- struct CC_EXPORT Item {
- class TaskComparator {
- public:
- explicit TaskComparator(const RasterTask* task) : task_(task) {}
-
- bool operator()(const Item& item) const { return item.task == task_; }
-
- private:
- const RasterTask* task_;
- };
-
- typedef std::vector<Item> Vector;
-
- Item(RasterTask* task, const TaskSetCollection& task_sets);
- ~Item();
-
- RasterTask* task;
- TaskSetCollection task_sets;
- };
-
- RasterTaskQueue();
- ~RasterTaskQueue();
-
- void Swap(RasterTaskQueue* other);
- void Reset();
-
- Item::Vector items;
-};
-
-// This interface can be used to schedule and run raster tasks. The client will
-// be notified asynchronously when the set of tasks marked as "required for
-// activation" have finished running and when all scheduled tasks have finished
-// running. The client can call CheckForCompletedTasks() at any time to dispatch
-// pending completion callbacks for all tasks that have finished running.
-class CC_EXPORT Rasterizer {
- public:
- // Set the client instance to be notified when finished running tasks.
- virtual void SetClient(RasterizerClient* client) = 0;
-
- // Tells the worker pool to shutdown after canceling all previously scheduled
- // tasks. Reply callbacks are still guaranteed to run when
- // CheckForCompletedTasks() is called.
- virtual void Shutdown() = 0;
-
- // Schedule running of raster tasks in |queue| and all dependencies.
- // Previously scheduled tasks that are not in |queue| will be canceled unless
- // already running. Once scheduled, reply callbacks are guaranteed to run for
- // all tasks even if they later get canceled by another call to
- // ScheduleTasks().
- virtual void ScheduleTasks(RasterTaskQueue* queue) = 0;
-
- // Check for completed tasks and dispatch reply callbacks.
- virtual void CheckForCompletedTasks() = 0;
-
- protected:
- virtual ~Rasterizer() {}
-};
-
-} // namespace cc
-
-#endif // CC_RESOURCES_RASTERIZER_H_

Powered by Google App Engine
This is Rietveld 408576698