| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 } | 1566 } |
| 1567 | 1567 |
| 1568 void RendererSchedulerImpl::OnIdlePeriodEnded() { | 1568 void RendererSchedulerImpl::OnIdlePeriodEnded() { |
| 1569 base::AutoLock lock(any_thread_lock_); | 1569 base::AutoLock lock(any_thread_lock_); |
| 1570 GetAnyThread().last_idle_period_end_time = | 1570 GetAnyThread().last_idle_period_end_time = |
| 1571 helper_.scheduler_tqm_delegate()->NowTicks(); | 1571 helper_.scheduler_tqm_delegate()->NowTicks(); |
| 1572 GetAnyThread().in_idle_period = false; | 1572 GetAnyThread().in_idle_period = false; |
| 1573 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); | 1573 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); |
| 1574 } | 1574 } |
| 1575 | 1575 |
| 1576 void RendererSchedulerImpl::AddPendingNavigation( | 1576 void RendererSchedulerImpl::AddPendingNavigation(NavigatingFrameType type) { |
| 1577 WebScheduler::NavigatingFrameType type) { | |
| 1578 helper_.CheckOnValidThread(); | 1577 helper_.CheckOnValidThread(); |
| 1579 if (type == blink::WebScheduler::NavigatingFrameType::kMainFrame) { | 1578 if (type == NavigatingFrameType::kMainFrame) { |
| 1580 GetMainThreadOnly().navigation_task_expected_count++; | 1579 GetMainThreadOnly().navigation_task_expected_count++; |
| 1581 UpdatePolicy(); | 1580 UpdatePolicy(); |
| 1582 } | 1581 } |
| 1583 } | 1582 } |
| 1584 | 1583 |
| 1585 void RendererSchedulerImpl::RemovePendingNavigation( | 1584 void RendererSchedulerImpl::RemovePendingNavigation(NavigatingFrameType type) { |
| 1586 WebScheduler::NavigatingFrameType type) { | |
| 1587 helper_.CheckOnValidThread(); | 1585 helper_.CheckOnValidThread(); |
| 1588 DCHECK_GT(GetMainThreadOnly().navigation_task_expected_count, 0); | 1586 DCHECK_GT(GetMainThreadOnly().navigation_task_expected_count, 0); |
| 1589 if (type == blink::WebScheduler::NavigatingFrameType::kMainFrame && | 1587 if (type == NavigatingFrameType::kMainFrame && |
| 1590 GetMainThreadOnly().navigation_task_expected_count > 0) { | 1588 GetMainThreadOnly().navigation_task_expected_count > 0) { |
| 1591 GetMainThreadOnly().navigation_task_expected_count--; | 1589 GetMainThreadOnly().navigation_task_expected_count--; |
| 1592 UpdatePolicy(); | 1590 UpdatePolicy(); |
| 1593 } | 1591 } |
| 1594 } | 1592 } |
| 1595 | 1593 |
| 1596 void RendererSchedulerImpl::OnNavigationStarted() { | 1594 void RendererSchedulerImpl::OnNavigationStarted() { |
| 1597 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 1595 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 1598 "RendererSchedulerImpl::OnNavigationStarted"); | 1596 "RendererSchedulerImpl::OnNavigationStarted"); |
| 1599 base::AutoLock lock(any_thread_lock_); | 1597 base::AutoLock lock(any_thread_lock_); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 case TimeDomainType::VIRTUAL: | 1951 case TimeDomainType::VIRTUAL: |
| 1954 return "virtual"; | 1952 return "virtual"; |
| 1955 default: | 1953 default: |
| 1956 NOTREACHED(); | 1954 NOTREACHED(); |
| 1957 return nullptr; | 1955 return nullptr; |
| 1958 } | 1956 } |
| 1959 } | 1957 } |
| 1960 | 1958 |
| 1961 } // namespace scheduler | 1959 } // namespace scheduler |
| 1962 } // namespace blink | 1960 } // namespace blink |
| OLD | NEW |