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

Unified Diff: third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper.h

Issue 2637463002: Add an idle task to periodically sweep canceled delayed tasks (Closed)
Patch Set: Fix issue with tracked_objects::Location spotted by asan Created 3 years, 11 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
Index: third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper.h
diff --git a/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper.h b/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper.h
new file mode 100644
index 0000000000000000000000000000000000000000..7482b14706acb949e3c44cb438d6faea9b41512a
--- /dev/null
+++ b/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper.h
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_CANCELED_DELAYED_TASK_SWEEPER_H_
+#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_CANCELED_DELAYED_TASK_SWEEPER_H_
+
+#include "base/macros.h"
+#include "platform/scheduler/child/scheduler_helper.h"
+#include "public/platform/scheduler/child/single_thread_idle_task_runner.h"
+
+namespace blink {
+namespace scheduler {
+
+// This class periodically sweeps away canceled delayed tasks, which helps
+// reduce memory consumption.
+class BLINK_PLATFORM_EXPORT IdleCanceledDelayedTaskSweeper {
+ public:
+ IdleCanceledDelayedTaskSweeper(
+ const char* tracing_category,
+ SchedulerHelper* scheduler_helper,
+ scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner);
+
+ private:
+ void PostIdleTask();
+ void SweepIdleTask(base::TimeTicks deadline);
+
+ const char* tracing_category_; // NOT OWNED
+ SchedulerHelper* scheduler_helper_; // NOT OWNED
+ scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;
+ base::WeakPtrFactory<IdleCanceledDelayedTaskSweeper> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(IdleCanceledDelayedTaskSweeper);
+};
+
+} // namespace scheduler
+} // namespace blink
+
+#endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_CANCELED_DELAYED_TASK_SWEEPER_H_

Powered by Google App Engine
This is Rietveld 408576698