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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h

Issue 2668663002: Purge memory before suspending timer queues when backgrounded. (Closed)
Patch Set: Fixed. Created 3 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 unified diff | Download patch
OLDNEW
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 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER _IMPL_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER _IMPL_H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER _IMPL_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDULER _IMPL_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void OnNavigationStarted() override; 116 void OnNavigationStarted() override;
117 bool IsHighPriorityWorkAnticipated() override; 117 bool IsHighPriorityWorkAnticipated() override;
118 bool ShouldYieldForHighPriorityWork() override; 118 bool ShouldYieldForHighPriorityWork() override;
119 bool CanExceedIdleDeadlineIfRequired() const override; 119 bool CanExceedIdleDeadlineIfRequired() const override;
120 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override; 120 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer) override;
121 void RemoveTaskObserver( 121 void RemoveTaskObserver(
122 base::MessageLoop::TaskObserver* task_observer) override; 122 base::MessageLoop::TaskObserver* task_observer) override;
123 void Shutdown() override; 123 void Shutdown() override;
124 void SuspendTimerQueue() override; 124 void SuspendTimerQueue() override;
125 void ResumeTimerQueue() override; 125 void ResumeTimerQueue() override;
126 void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) override;
127 void SetTopLevelBlameContext( 126 void SetTopLevelBlameContext(
128 base::trace_event::BlameContext* blame_context) override; 127 base::trace_event::BlameContext* blame_context) override;
129 void SetRAILModeObserver(RAILModeObserver* observer) override; 128 void SetRAILModeObserver(RAILModeObserver* observer) override;
130 bool MainThreadSeemsUnresponsive() override; 129 bool MainThreadSeemsUnresponsive() override;
131 130
132 // RenderWidgetSignals::Observer implementation: 131 // RenderWidgetSignals::Observer implementation:
133 void SetAllRenderWidgetsHidden(bool hidden) override; 132 void SetAllRenderWidgetsHidden(bool hidden) override;
134 void SetHasVisibleRenderWidgetWithTouchHandler( 133 void SetHasVisibleRenderWidgetWithTouchHandler(
135 bool has_visible_render_widget_with_touch_handler) override; 134 bool has_visible_render_widget_with_touch_handler) override;
136 135
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event); 292 static bool ShouldPrioritizeInputEvent(const WebInputEvent& web_input_event);
294 293
295 // The amount of time which idle periods can continue being scheduled when the 294 // The amount of time which idle periods can continue being scheduled when the
296 // renderer has been hidden, before going to sleep for good. 295 // renderer has been hidden, before going to sleep for good.
297 static const int kEndIdleWhenHiddenDelayMillis = 10000; 296 static const int kEndIdleWhenHiddenDelayMillis = 10000;
298 297
299 // The amount of time in milliseconds we have to respond to user input as 298 // The amount of time in milliseconds we have to respond to user input as
300 // defined by RAILS. 299 // defined by RAILS.
301 static const int kRailsResponseTimeMillis = 50; 300 static const int kRailsResponseTimeMillis = 50;
302 301
303 // The amount of time to wait before suspending shared timers after the
304 // renderer has been backgrounded. This is used only if background suspension
305 // of shared timers is enabled.
306 static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000;
307
308 // The time we should stay in a priority-escalated mode after a call to 302 // The time we should stay in a priority-escalated mode after a call to
309 // DidAnimateForInputOnCompositorThread(). 303 // DidAnimateForInputOnCompositorThread().
310 static const int kFlingEscalationLimitMillis = 100; 304 static const int kFlingEscalationLimitMillis = 100;
311 305
312 // Schedules an immediate PolicyUpdate, if there isn't one already pending and 306 // Schedules an immediate PolicyUpdate, if there isn't one already pending and
313 // sets |policy_may_need_update_|. Note |any_thread_lock_| must be 307 // sets |policy_may_need_update_|. Note |any_thread_lock_| must be
314 // locked. 308 // locked.
315 void EnsureUrgentPolicyUpdatePostedOnMainThread( 309 void EnsureUrgentPolicyUpdatePostedOnMainThread(
316 const tracked_objects::Location& from_here); 310 const tracked_objects::Location& from_here);
317 311
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 std::set<scoped_refptr<TaskQueue>> unthrottled_task_runners_; 389 std::set<scoped_refptr<TaskQueue>> unthrottled_task_runners_;
396 scoped_refptr<TaskQueue> default_loading_task_runner_; 390 scoped_refptr<TaskQueue> default_loading_task_runner_;
397 scoped_refptr<TaskQueue> default_timer_task_runner_; 391 scoped_refptr<TaskQueue> default_timer_task_runner_;
398 392
399 // Note |virtual_time_domain_| is lazily created. 393 // Note |virtual_time_domain_| is lazily created.
400 std::unique_ptr<AutoAdvancingVirtualTimeDomain> virtual_time_domain_; 394 std::unique_ptr<AutoAdvancingVirtualTimeDomain> virtual_time_domain_;
401 395
402 base::Closure update_policy_closure_; 396 base::Closure update_policy_closure_;
403 DeadlineTaskRunner delayed_update_policy_runner_; 397 DeadlineTaskRunner delayed_update_policy_runner_;
404 CancelableClosureHolder end_renderer_hidden_idle_period_closure_; 398 CancelableClosureHolder end_renderer_hidden_idle_period_closure_;
405 CancelableClosureHolder suspend_timers_when_backgrounded_closure_;
406 399
407 using SeqLockQueueingTimeEstimator = 400 using SeqLockQueueingTimeEstimator =
408 device::SharedMemorySeqLockBuffer<QueueingTimeEstimator>; 401 device::SharedMemorySeqLockBuffer<QueueingTimeEstimator>;
409 402
410 SeqLockQueueingTimeEstimator seqlock_queueing_time_estimator_; 403 SeqLockQueueingTimeEstimator seqlock_queueing_time_estimator_;
411 404
412 // We have decided to improve thread safety at the cost of some boilerplate 405 // We have decided to improve thread safety at the cost of some boilerplate
413 // (the accessors) for the following data members. 406 // (the accessors) for the following data members.
414 407
415 struct MainThreadOnly { 408 struct MainThreadOnly {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 522
530 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; 523 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_;
531 524
532 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); 525 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl);
533 }; 526 };
534 527
535 } // namespace scheduler 528 } // namespace scheduler
536 } // namespace blink 529 } // namespace blink
537 530
538 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_ 531 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_SCHEDU LER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698