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

Unified Diff: third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc

Issue 2810883002: [scheduler] Remove webthread_impl_for_worker_scheduler from public API. (Closed)
Patch Set: Add TODO to remove WebThreadBase from public API Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc b/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc
index f5eb1ea69d7c47841a8fc401f1519edf2356e7cc..d8f19ee3c3c04adfa00d760a1e6212068f278e68 100644
--- a/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc
+++ b/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc
@@ -12,8 +12,10 @@
#include "base/memory/ptr_util.h"
#include "base/pending_task.h"
#include "base/threading/platform_thread.h"
-#include "public/platform/scheduler/child/single_thread_idle_task_runner.h"
+#include "platform/scheduler/child/webthread_impl_for_worker_scheduler.h"
#include "public/platform/WebTraceLocation.h"
+#include "public/platform/scheduler/child/compositor_worker_scheduler.h"
+#include "public/platform/scheduler/child/single_thread_idle_task_runner.h"
namespace blink {
namespace scheduler {
@@ -100,5 +102,38 @@ bool WebThreadBase::IsCurrentThread() const {
return GetTaskRunner()->BelongsToCurrentThread();
}
+namespace {
+
+class WebThreadForCompositor : public WebThreadImplForWorkerScheduler {
+ public:
+ explicit WebThreadForCompositor(base::Thread::Options options)
+ : WebThreadImplForWorkerScheduler("Compositor", options) {
+ Init();
+ }
+ ~WebThreadForCompositor() override {}
+
+ private:
+ // WebThreadImplForWorkerScheduler:
+ std::unique_ptr<blink::scheduler::WorkerScheduler> CreateWorkerScheduler()
+ override {
+ return base::MakeUnique<CompositorWorkerScheduler>(GetThread());
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor);
+};
+
+} // namespace
+
+std::unique_ptr<WebThreadBase> WebThreadBase::CreateWorkerThread(
+ const char* name,
+ base::Thread::Options options) {
+ return base::MakeUnique<WebThreadImplForWorkerScheduler>(name, options);
+}
+
+std::unique_ptr<WebThreadBase> WebThreadBase::CreateCompositorThread(
+ base::Thread::Options options) {
+ return base::MakeUnique<WebThreadForCompositor>(options);
+}
+
} // namespace scheduler
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698