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

Unified Diff: content/renderer/scheduler/webthread_impl_for_scheduler.cc

Issue 923973002: Refactor WebThreadImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « content/renderer/scheduler/webthread_impl_for_scheduler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/scheduler/webthread_impl_for_scheduler.cc
diff --git a/content/renderer/scheduler/webthread_impl_for_scheduler.cc b/content/renderer/scheduler/webthread_impl_for_scheduler.cc
index c84548d9570691c64dc9df529440df0e98f96679..b328142846ada43cee212c0b59c25fb2845acbd9 100644
--- a/content/renderer/scheduler/webthread_impl_for_scheduler.cc
+++ b/content/renderer/scheduler/webthread_impl_for_scheduler.cc
@@ -16,58 +16,20 @@ WebThreadImplForScheduler::WebThreadImplForScheduler(
thread_id_(base::PlatformThread::CurrentId()) {
}
-void WebThreadImplForScheduler::postTask(Task* task) {
- postDelayedTask(task, 0);
-}
-
-void WebThreadImplForScheduler::postTask(
- const blink::WebTraceLocation& location,
- Task* task) {
- postDelayedTask(location, task, 0);
-}
-
-void WebThreadImplForScheduler::postDelayedTask(Task* task,
- long long delay_ms) {
- task_runner_->PostDelayedTask(
- FROM_HERE,
- base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))),
- base::TimeDelta::FromMilliseconds(delay_ms));
-}
-
-void WebThreadImplForScheduler::postDelayedTask(
- const blink::WebTraceLocation& web_location,
- Task* task,
- long long delay_ms) {
- tracked_objects::Location location(web_location.functionName(),
- web_location.fileName(), -1, nullptr);
- task_runner_->PostDelayedTask(
- location,
- base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))),
- base::TimeDelta::FromMilliseconds(delay_ms));
-}
-
-void WebThreadImplForScheduler::enterRunLoop() {
- CHECK(isCurrentThread());
- // We don't support nesting.
- CHECK(!base::MessageLoop::current()->is_running());
- base::MessageLoop::current()->Run();
-}
-
-void WebThreadImplForScheduler::exitRunLoop() {
- CHECK(isCurrentThread());
- CHECK(base::MessageLoop::current()->is_running());
- base::MessageLoop::current()->Quit();
-}
-
-bool WebThreadImplForScheduler::isCurrentThread() const {
- return task_runner_->BelongsToCurrentThread();
+WebThreadImplForScheduler::~WebThreadImplForScheduler() {
}
blink::PlatformThreadId WebThreadImplForScheduler::threadId() const {
return thread_id_;
}
-WebThreadImplForScheduler::~WebThreadImplForScheduler() {
+base::MessageLoop* WebThreadImplForScheduler::MessageLoop() const {
+ DCHECK(isCurrentThread());
+ return base::MessageLoop::current();
+}
+
+base::SingleThreadTaskRunner* WebThreadImplForScheduler::TaskRunner() const {
+ return task_runner_.get();
}
void WebThreadImplForScheduler::AddTaskObserverInternal(
« no previous file with comments | « content/renderer/scheduler/webthread_impl_for_scheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698