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

Side by Side Diff: components/scheduler/child/web_task_runner_impl.cc

Issue 1727103002: Revert of Per WebViewScheduler virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/scheduler/child/web_task_runner_impl.h" 5 #include "components/scheduler/child/web_task_runner_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "components/scheduler/base/task_queue.h" 9 #include "components/scheduler/base/task_queue.h"
10 #include "components/scheduler/base/time_domain.h"
11 #include "third_party/WebKit/public/platform/WebTraceLocation.h" 10 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
12 11
13 namespace scheduler { 12 namespace scheduler {
14 13
15 WebTaskRunnerImpl::WebTaskRunnerImpl(scoped_refptr<TaskQueue> task_queue) 14 WebTaskRunnerImpl::WebTaskRunnerImpl(scoped_refptr<TaskQueue> task_queue)
16 : task_queue_(task_queue) {} 15 : task_queue_(task_queue) {}
17 16
18 WebTaskRunnerImpl::~WebTaskRunnerImpl() {} 17 WebTaskRunnerImpl::~WebTaskRunnerImpl() {}
19 18
20 void WebTaskRunnerImpl::postTask(const blink::WebTraceLocation& web_location, 19 void WebTaskRunnerImpl::postTask(const blink::WebTraceLocation& web_location,
(...skipping 13 matching lines...) Expand all
34 DCHECK_GE(delayMs, 0.0); 33 DCHECK_GE(delayMs, 0.0);
35 tracked_objects::Location location(web_location.functionName(), 34 tracked_objects::Location location(web_location.functionName(),
36 web_location.fileName(), -1, nullptr); 35 web_location.fileName(), -1, nullptr);
37 task_queue_->PostDelayedTask( 36 task_queue_->PostDelayedTask(
38 location, 37 location,
39 base::Bind(&WebTaskRunnerImpl::runTask, 38 base::Bind(&WebTaskRunnerImpl::runTask,
40 base::Passed(scoped_ptr<blink::WebTaskRunner::Task>(task))), 39 base::Passed(scoped_ptr<blink::WebTaskRunner::Task>(task))),
41 base::TimeDelta::FromMillisecondsD(delayMs)); 40 base::TimeDelta::FromMillisecondsD(delayMs));
42 } 41 }
43 42
44 double WebTaskRunnerImpl::virtualTimeSeconds() const {
45 return (task_queue_->GetTimeDomain()->Now() - base::TimeTicks::UnixEpoch())
46 .InSecondsF();
47 }
48
49 double WebTaskRunnerImpl::monotonicallyIncreasingVirtualTimeSeconds() const {
50 return task_queue_->GetTimeDomain()->Now().ToInternalValue() /
51 static_cast<double>(base::Time::kMicrosecondsPerSecond);
52 }
53
54 blink::WebTaskRunner* WebTaskRunnerImpl::clone() { 43 blink::WebTaskRunner* WebTaskRunnerImpl::clone() {
55 return new WebTaskRunnerImpl(task_queue_); 44 return new WebTaskRunnerImpl(task_queue_);
56 } 45 }
57 46
58 void WebTaskRunnerImpl::runTask(scoped_ptr<blink::WebTaskRunner::Task> task) 47 void WebTaskRunnerImpl::runTask(scoped_ptr<blink::WebTaskRunner::Task> task)
59 { 48 {
60 task->run(); 49 task->run();
61 } 50 }
62 51
63 } // namespace scheduler 52 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/child/web_task_runner_impl.h ('k') | components/scheduler/renderer/renderer_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698