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

Unified Diff: cc/scheduler/frame_rate_controller.cc

Issue 17362002: cc: Remove FakeThread, use SingleThreadTaskRunner in scheduling classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm-fakethread: rebase Created 7 years, 6 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 | « cc/scheduler/frame_rate_controller.h ('k') | cc/scheduler/frame_rate_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/frame_rate_controller.cc
diff --git a/cc/scheduler/frame_rate_controller.cc b/cc/scheduler/frame_rate_controller.cc
index 90cf0d72071228e911a6a12c267d07566be32075..1977294f8f3de613d928192863e76b04c1042a0c 100644
--- a/cc/scheduler/frame_rate_controller.cc
+++ b/cc/scheduler/frame_rate_controller.cc
@@ -5,8 +5,9 @@
#include "cc/scheduler/frame_rate_controller.h"
#include "base/debug/trace_event.h"
+#include "base/location.h"
#include "base/logging.h"
-#include "cc/base/thread.h"
+#include "base/single_thread_task_runner.h"
#include "cc/scheduler/delay_based_time_source.h"
#include "cc/scheduler/time_source.h"
@@ -41,20 +42,21 @@ FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer)
active_(false),
is_time_source_throttling_(true),
weak_factory_(this),
- thread_(NULL) {
+ task_runner_(NULL) {
time_source_client_adapter_ =
FrameRateControllerTimeSourceAdapter::Create(this);
time_source_->SetClient(time_source_client_adapter_.get());
}
-FrameRateController::FrameRateController(Thread* thread)
+FrameRateController::FrameRateController(
+ base::SingleThreadTaskRunner* task_runner)
: client_(NULL),
num_frames_pending_(0),
max_swaps_pending_(0),
active_(false),
is_time_source_throttling_(false),
weak_factory_(this),
- thread_(thread) {}
+ task_runner_(task_runner) {}
FrameRateController::~FrameRateController() {
if (is_time_source_throttling_)
@@ -95,7 +97,7 @@ void FrameRateController::OnTimerTick() {
// Check if we have too many frames in flight.
bool throttled =
max_swaps_pending_ && num_frames_pending_ >= max_swaps_pending_;
- TRACE_COUNTER_ID1("cc", "ThrottledCompositor", thread_, throttled);
+ TRACE_COUNTER_ID1("cc", "ThrottledCompositor", task_runner_, throttled);
if (client_) {
client_->FrameRateControllerTick(throttled);
@@ -107,8 +109,9 @@ void FrameRateController::OnTimerTick() {
void FrameRateController::PostManualTick() {
if (active_) {
- thread_->PostTask(base::Bind(&FrameRateController::ManualTick,
- weak_factory_.GetWeakPtr()));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&FrameRateController::ManualTick,
+ weak_factory_.GetWeakPtr()));
}
}
« no previous file with comments | « cc/scheduler/frame_rate_controller.h ('k') | cc/scheduler/frame_rate_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698