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

Side by Side Diff: cc/raster/task.h

Issue 1866043006: cc: Remove ScheduleOnOriginThread() and CompleteOnOriginThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_RASTER_TASK_H_ 5 #ifndef CC_RASTER_TASK_H_
6 #define CC_RASTER_TASK_H_ 6 #define CC_RASTER_TASK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "cc/base/cc_export.h" 13 #include "cc/base/cc_export.h"
14 14
15 namespace cc { 15 namespace cc {
16 class Task; 16 class Task;
17 17
18 // States to manage life cycle of a task. Task gets created with NEW state and 18 // States to manage life cycle of a task. Task gets created with NEW state and
19 // concludes either in FINISHED or CANCELLED state. So possible life cycle 19 // if scheduled concludes in COMPLETED state. So possible life cycle paths for
vmpstr 2016/05/18 19:08:33 you say here "if scheduled concludes in completed"
prashant.n 2016/05/19 00:59:52 This above path is for task which is not scheduled
20 // paths for task are - 20 // task are -
21 // NEW -> SCHEDULED -> RUNNING -> FINISHED 21 // NEW
vmpstr 2016/05/18 19:08:33 I don't think you need this one?
prashant.n 2016/05/19 00:59:52 We will omit this.
22 // NEW -> SCHEDULED -> CANCELED 22 // NEW -> CANCELED -> COMPLETED
23 // NEW -> SCHEDULED -> CANCELED-> COMPLETED
24 // NEW -> SCHEDULED -> RUNNING -> FINISHED -> COMPLETED
23 class CC_EXPORT TaskState { 25 class CC_EXPORT TaskState {
24 public: 26 public:
25 bool IsScheduled() const; 27 bool IsScheduled() const;
26 bool IsRunning() const; 28 bool IsRunning() const;
27 bool IsFinished() const; 29 bool IsFinished() const;
28 bool IsCanceled() const; 30 bool IsCanceled() const;
31 bool IsCompleted() const;
29 32
30 // Functions to change the state of task. These functions should be called 33 // Functions to change the state of task. These functions should be called
31 // only from TaskGraphWorkQueue where the life cycle of a task is decided or 34 // only from TaskGraphWorkQueue where the life cycle of a task is decided or
32 // from tests. These functions are not thread-safe. Caller is responsible for 35 // from tests. These functions are not thread-safe. Caller is responsible for
33 // thread safety. 36 // thread safety.
34 void Reset(); // Sets state to NEW. 37 void Reset(); // Sets state to NEW.
35 void DidSchedule(); 38 void DidSchedule();
36 void DidStart(); 39 void DidStart();
37 void DidFinish(); 40 void DidFinish();
38 void DidCancel(); 41 void DidCancel();
39 42
43 // Task owner should call this function to indicate that this task is
44 // completed and no more it should be processed.
vmpstr 2016/05/18 19:08:33 s/no more it should be processed/it doesn't need t
prashant.n 2016/05/19 00:59:52 Ok, I'll modify this.
45 void DidComplete();
46
40 private: 47 private:
41 friend class Task; 48 friend class Task;
42 49
43 // Let only Task class create the TaskState. 50 // Let only Task class create the TaskState.
44 TaskState(); 51 TaskState();
45 ~TaskState(); 52 ~TaskState();
46 53
47 enum class Value : uint16_t { NEW, SCHEDULED, RUNNING, FINISHED, CANCELED }; 54 enum class Value : uint16_t {
55 NEW,
56 SCHEDULED,
57 RUNNING,
58 FINISHED,
59 CANCELED,
60 COMPLETED
vmpstr 2016/05/18 19:08:33 In my mind the difference between "FINISHED" and "
prashant.n 2016/05/19 00:59:52 Yes. Finished and Completed are 2 sides of same co
61 };
48 62
49 Value value_; 63 Value value_;
50 }; 64 };
51 65
52 // A task which can be run by a TaskGraphRunner. To run a Task, it should be 66 // A task which can be run by a TaskGraphRunner. To run a Task, it should be
53 // inserted into a TaskGraph, which can then be scheduled on the 67 // inserted into a TaskGraph, which can then be scheduled on the
54 // TaskGraphRunner. 68 // TaskGraphRunner.
55 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { 69 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> {
56 public: 70 public:
57 typedef std::vector<scoped_refptr<Task>> Vector; 71 typedef std::vector<scoped_refptr<Task>> Vector;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void Swap(TaskGraph* other); 131 void Swap(TaskGraph* other);
118 void Reset(); 132 void Reset();
119 133
120 Node::Vector nodes; 134 Node::Vector nodes;
121 Edge::Vector edges; 135 Edge::Vector edges;
122 }; 136 };
123 137
124 } // namespace cc 138 } // namespace cc
125 139
126 #endif // CC_RASTER_TASK_H_ 140 #endif // CC_RASTER_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698