| Index: base/threading/simple_thread.h
|
| diff --git a/base/threading/simple_thread.h b/base/threading/simple_thread.h
|
| index 3deeb1018cb573c3f5e48d2b17b7c16a428aa476..e45ba06ce98b2c4e9701347ac8fc7435fada0b81 100644
|
| --- a/base/threading/simple_thread.h
|
| +++ b/base/threading/simple_thread.h
|
| @@ -112,6 +112,9 @@ class BASE_EXPORT SimpleThread : public PlatformThread::Delegate {
|
| // Overridden from PlatformThread::Delegate:
|
| void ThreadMain() override;
|
|
|
| + bool SetThreadPriority(ThreadPriority priority);
|
| + ThreadPriority GetThreadPriority() { return priority_; }
|
| +
|
| private:
|
| const std::string name_prefix_;
|
| std::string name_;
|
| @@ -120,6 +123,36 @@ class BASE_EXPORT SimpleThread : public PlatformThread::Delegate {
|
| WaitableEvent event_; // Signaled if Start() was ever called.
|
| PlatformThreadId tid_; // The backing thread's id.
|
| bool joined_; // True if Join has been called.
|
| + ThreadPriority priority_;
|
| +};
|
| +
|
| +class BASE_EXPORT TestSimpleThread : public SimpleThread {
|
| + public:
|
| + struct BASE_EXPORT PrioritySet {
|
| + explicit PrioritySet(const ThreadPriority d,
|
| + const ThreadPriority l,
|
| + const ThreadPriority h)
|
| + : default_prio(d), low_prio(l), high_prio(h) {}
|
| + const ThreadPriority default_prio;
|
| + const ThreadPriority low_prio;
|
| + const ThreadPriority high_prio;
|
| + };
|
| +
|
| + TestSimpleThread(const PrioritySet& priorities,
|
| + const std::string& name_prefix,
|
| + const Options& options);
|
| + bool Speedup();
|
| + bool Slowdown();
|
| + bool Restore();
|
| + bool IsDynamic() { return dynamic_prio_; }
|
| + ThreadPriority GetDefaultPriority() { return priorities_.default_prio; }
|
| + std::string GetPrioritySetForDebugging();
|
| +
|
| + private:
|
| + const PrioritySet priorities_;
|
| + bool dynamic_prio_;
|
| + bool changed_;
|
| + std::string priorities_str_;
|
| };
|
|
|
| class BASE_EXPORT DelegateSimpleThread : public SimpleThread {
|
|
|