OLD | NEW |
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 "platform/scheduler/child/idle_helper.h" | 5 #include "platform/scheduler/child/idle_helper.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "base/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
10 #include "platform/scheduler/base/real_time_domain.h" | 10 #include "platform/scheduler/base/real_time_domain.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 281 |
282 base::TimeTicks IdleHelper::CurrentIdleTaskDeadline() const { | 282 base::TimeTicks IdleHelper::CurrentIdleTaskDeadline() const { |
283 helper_->CheckOnValidThread(); | 283 helper_->CheckOnValidThread(); |
284 return state_.idle_period_deadline(); | 284 return state_.idle_period_deadline(); |
285 } | 285 } |
286 | 286 |
287 void IdleHelper::OnIdleTaskPosted() { | 287 void IdleHelper::OnIdleTaskPosted() { |
288 TRACE_EVENT0(disabled_by_default_tracing_category_, "OnIdleTaskPosted"); | 288 TRACE_EVENT0(disabled_by_default_tracing_category_, "OnIdleTaskPosted"); |
289 if (is_shutdown_) | 289 if (is_shutdown_) |
290 return; | 290 return; |
291 if (idle_task_runner_->RunsTasksOnCurrentThread()) { | 291 if (idle_task_runner_->RunsTasksInCurrentSequence()) { |
292 OnIdleTaskPostedOnMainThread(); | 292 OnIdleTaskPostedOnMainThread(); |
293 } else { | 293 } else { |
294 helper_->ControlTaskRunner()->PostTask( | 294 helper_->ControlTaskRunner()->PostTask( |
295 FROM_HERE, on_idle_task_posted_closure_.GetCallback()); | 295 FROM_HERE, on_idle_task_posted_closure_.GetCallback()); |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 void IdleHelper::OnIdleTaskPostedOnMainThread() { | 299 void IdleHelper::OnIdleTaskPostedOnMainThread() { |
300 TRACE_EVENT0(disabled_by_default_tracing_category_, | 300 TRACE_EVENT0(disabled_by_default_tracing_category_, |
301 "OnIdleTaskPostedOnMainThread"); | 301 "OnIdleTaskPostedOnMainThread"); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 case IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED: | 503 case IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED: |
504 return "in_long_idle_period_paused"; | 504 return "in_long_idle_period_paused"; |
505 default: | 505 default: |
506 NOTREACHED(); | 506 NOTREACHED(); |
507 return nullptr; | 507 return nullptr; |
508 } | 508 } |
509 } | 509 } |
510 | 510 |
511 } // namespace scheduler | 511 } // namespace scheduler |
512 } // namespace blink | 512 } // namespace blink |
OLD | NEW |