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

Unified Diff: base/trace_event/memory_dump_scheduler.h

Issue 2778313002: [memory-infra] Move periodic timer to dump thread
Patch Set: nits. Created 3 years, 9 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 | « base/trace_event/memory_dump_manager_unittest.cc ('k') | base/trace_event/memory_dump_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_scheduler.h
diff --git a/base/trace_event/memory_dump_scheduler.h b/base/trace_event/memory_dump_scheduler.h
index ab8441bc20031242e5ac5df07f37eac12f66dc23..18721011f099ca42fd82ecf50d73f8e98f1306f2 100644
--- a/base/trace_event/memory_dump_scheduler.h
+++ b/base/trace_event/memory_dump_scheduler.h
@@ -78,6 +78,8 @@ class BASE_EXPORT MemoryDumpScheduler {
uint32_t light_dump_period_ms;
uint32_t heavy_dump_period_ms;
+ bool is_enabled_for_testing;
+
DISALLOW_COPY_AND_ASSIGN(PeriodicTriggerState);
};
@@ -117,8 +119,11 @@ class BASE_EXPORT MemoryDumpScheduler {
MemoryDumpScheduler();
~MemoryDumpScheduler();
+ // Helper to enable timer on polling thread.
+ void EnablePeriodicTimerOnPollingThread();
+
// Helper to set polling disabled.
- void DisablePollingOnPollingThread();
+ void DisableTriggersOnPollingThread();
// Periodically called by the timer.
void RequestPeriodicGlobalDump();
@@ -138,14 +143,14 @@ class BASE_EXPORT MemoryDumpScheduler {
// True if periodic dumping is enabled.
bool IsPeriodicTimerRunningForTesting();
+ // Timer.Start is not called if disabled, for tests without message loop.
+ void DisablePeriodicTimerForTesting(bool disable);
+
MemoryDumpManager* mdm_;
// Accessed on the thread of the client before enabling and only accessed on
- // the thread that called "EnablePeriodicTriggersIfNeeded()" after enabling.
+ // the polling thread after enabling:
std::unique_ptr<PeriodicTriggerState> periodic_state_;
-
- // Accessed on the thread of the client before enabling and only accessed on
- // the polling thread after enabling.
std::unique_ptr<PollingTriggerState> polling_state_;
// Accessed on the thread of the client only.
@@ -154,6 +159,9 @@ class BASE_EXPORT MemoryDumpScheduler {
// True when the scheduler is setup. Accessed on the thread of client only.
bool is_setup_;
+ // Disables the Timer.Start for periodic triggers.
+ static bool periodic_timer_disabled_for_testing_;
+
DISALLOW_COPY_AND_ASSIGN(MemoryDumpScheduler);
};
« no previous file with comments | « base/trace_event/memory_dump_manager_unittest.cc ('k') | base/trace_event/memory_dump_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698