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

Side by Side Diff: cc/resources/rasterizer.h

Issue 523243002: cc: Generalize raster task notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused ctor Created 6 years, 3 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_RESOURCES_RASTERIZER_H_ 5 #ifndef CC_RESOURCES_RASTERIZER_H_
6 #define CC_RESOURCES_RASTERIZER_H_ 6 #define CC_RESOURCES_RASTERIZER_H_
7 7
8 #include <bitset>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "cc/resources/resource_format.h" 12 #include "cc/resources/resource_format.h"
12 #include "cc/resources/task_graph_runner.h" 13 #include "cc/resources/task_graph_runner.h"
13 14
15 namespace base {
16 namespace debug {
17 class TraceEventSyntheticDelay;
18 }
19 }
reveman 2014/09/16 22:49:05 no need for this anymore
ernstm 2014/09/17 19:57:15 Done.
20
14 namespace cc { 21 namespace cc {
15 class ImageDecodeTask; 22 class ImageDecodeTask;
16 class RasterTask; 23 class RasterTask;
17 class Resource; 24 class Resource;
18 class RasterBuffer; 25 class RasterBuffer;
19 26
20 class CC_EXPORT RasterizerTaskClient { 27 class CC_EXPORT RasterizerTaskClient {
21 public: 28 public:
22 virtual RasterBuffer* AcquireBufferForRaster(RasterTask* task) = 0; 29 virtual RasterBuffer* AcquireBufferForRaster(RasterTask* task) = 0;
23 virtual void ReleaseBufferForRaster(RasterTask* task) = 0; 30 virtual void ReleaseBufferForRaster(RasterTask* task) = 0;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 85
79 protected: 86 protected:
80 RasterTask(const Resource* resource, ImageDecodeTask::Vector* dependencies); 87 RasterTask(const Resource* resource, ImageDecodeTask::Vector* dependencies);
81 virtual ~RasterTask(); 88 virtual ~RasterTask();
82 89
83 private: 90 private:
84 const Resource* resource_; 91 const Resource* resource_;
85 ImageDecodeTask::Vector dependencies_; 92 ImageDecodeTask::Vector dependencies_;
86 }; 93 };
87 94
95 static const size_t kNumberOfTaskSets = 3;
96 typedef size_t TaskSet;
97 typedef std::bitset<kNumberOfTaskSets> TaskSetCollection;
98
88 class CC_EXPORT RasterizerClient { 99 class CC_EXPORT RasterizerClient {
89 public: 100 public:
90 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; 101 virtual void DidFinishRunningTasks(TaskSet task_set) = 0;
91 virtual void DidFinishRunningTasks() = 0; 102 virtual TaskSetCollection TasksThatShouldBeForcedToComplete() const = 0;
92 virtual void DidFinishRunningTasksRequiredForActivation() = 0;
93 103
94 protected: 104 protected:
95 virtual ~RasterizerClient() {} 105 virtual ~RasterizerClient() {}
96 }; 106 };
97 107
98 struct CC_EXPORT RasterTaskQueue { 108 struct CC_EXPORT RasterTaskQueue {
99 struct CC_EXPORT Item { 109 struct CC_EXPORT Item {
100 class TaskComparator { 110 class TaskComparator {
101 public: 111 public:
102 explicit TaskComparator(const RasterTask* task) : task_(task) {} 112 explicit TaskComparator(const RasterTask* task) : task_(task) {}
103 113
104 bool operator()(const Item& item) const { return item.task == task_; } 114 bool operator()(const Item& item) const { return item.task == task_; }
105 115
106 private: 116 private:
107 const RasterTask* task_; 117 const RasterTask* task_;
108 }; 118 };
109 119
110 typedef std::vector<Item> Vector; 120 typedef std::vector<Item> Vector;
111 121
112 Item(RasterTask* task, bool required_for_activation); 122 Item(RasterTask* task, const TaskSetCollection& task_sets);
113 ~Item(); 123 ~Item();
114 124
115 static bool IsRequiredForActivation(const Item& item) {
116 return item.required_for_activation;
117 }
118
119 RasterTask* task; 125 RasterTask* task;
120 bool required_for_activation; 126 TaskSetCollection task_sets;
121 }; 127 };
122 128
123 RasterTaskQueue(); 129 RasterTaskQueue();
124 ~RasterTaskQueue(); 130 ~RasterTaskQueue();
125 131
126 void Swap(RasterTaskQueue* other); 132 void Swap(RasterTaskQueue* other);
127 void Reset(); 133 void Reset();
128 134
129 Item::Vector items; 135 Item::Vector items;
130 }; 136 };
(...skipping 23 matching lines...) Expand all
154 // Check for completed tasks and dispatch reply callbacks. 160 // Check for completed tasks and dispatch reply callbacks.
155 virtual void CheckForCompletedTasks() = 0; 161 virtual void CheckForCompletedTasks() = 0;
156 162
157 protected: 163 protected:
158 virtual ~Rasterizer() {} 164 virtual ~Rasterizer() {}
159 }; 165 };
160 166
161 } // namespace cc 167 } // namespace cc
162 168
163 #endif // CC_RESOURCES_RASTERIZER_H_ 169 #endif // CC_RESOURCES_RASTERIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698