Chromium Code Reviews| Index: base/pending_task.h |
| diff --git a/base/pending_task.h b/base/pending_task.h |
| index 5761653397e0e5d011522f56e786fa1cbbbcc373..81ea2e953f38576e55ea255266e24980969205f8 100644 |
| --- a/base/pending_task.h |
| +++ b/base/pending_task.h |
| @@ -5,12 +5,15 @@ |
| #ifndef BASE_PENDING_TASK_H_ |
| #define BASE_PENDING_TASK_H_ |
| +#include <memory> |
| #include <queue> |
| #include "base/base_export.h" |
| #include "base/callback.h" |
| #include "base/location.h" |
| +#include "base/macros.h" |
| #include "base/time/time.h" |
| +#include "base/trace_event/trace_event_impl.h" |
| #include "base/tracking_info.h" |
| namespace base { |
| @@ -18,6 +21,21 @@ namespace base { |
| // Contains data about a pending task. Stored in TaskQueue and DelayedTaskQueue |
| // for use by classes that queue and execute tasks. |
| struct BASE_EXPORT PendingTask : public TrackingInfo { |
| + // A thread-safe copy of a PendingTask's info required by tracing. |
| + class TracingInfo : public trace_event::ConvertableToTraceFormat { |
|
caseq
2016/09/29 22:46:37
Why does it have to be nested class of PendingTask
gab
2016/10/03 15:18:58
Good point, I'll move it when we achieve overall c
|
| + public: |
| + TracingInfo(const tracked_objects::Location& posted_from); |
| + ~TracingInfo() override; |
| + |
| + // Overridden from trace_event::ConvertableToTraceFormat: |
| + void AppendAsTraceFormat(std::string* out) const override; |
| + |
| + private: |
| + const tracked_objects::Location posted_from_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TracingInfo); |
| + }; |
| + |
| PendingTask(const tracked_objects::Location& posted_from, |
| Closure task); |
| PendingTask(const tracked_objects::Location& posted_from, |
| @@ -32,6 +50,8 @@ struct BASE_EXPORT PendingTask : public TrackingInfo { |
| // Used to support sorting. |
| bool operator<(const PendingTask& other) const; |
| + std::unique_ptr<trace_event::ConvertableToTraceFormat> GetTracingInfo() const; |
|
caseq
2016/09/29 22:46:37
ditto.
gab
2016/10/03 15:18:58
Acknowledged.
|
| + |
| // The task to run. |
| Closure task; |