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

Unified Diff: trace_event/memory_dump_manager.h

Issue 2043183002: Update to Chromium //base at Chromium commit 01cb97b2e09618bbc3a60c7348f0a844eea20547. (Closed) Base URL: https://github.com/domokit/base.git@master
Patch Set: Created 4 years, 6 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 | « threading/sequenced_worker_pool.cc ('k') | trace_event/memory_dump_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trace_event/memory_dump_manager.h
diff --git a/trace_event/memory_dump_manager.h b/trace_event/memory_dump_manager.h
index 5c75e4e82e882b3e0f49b63f72ffc094496106e8..dfaf3a1fc9e0e16a226a5f833c50d648e4629fde 100644
--- a/trace_event/memory_dump_manager.h
+++ b/trace_event/memory_dump_manager.h
@@ -97,12 +97,19 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
return system_allocator_pool_name_;
};
+ // Tells the initialization phase to skip scheduling periodic memory dumps.
+ void DisablePeriodicDumpsForTesting() {
+ disable_periodic_dumps_for_testing_ = true;
+ }
+
private:
friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance.
friend struct DefaultSingletonTraits<MemoryDumpManager>;
friend class MemoryDumpManagerDelegate;
friend class MemoryDumpManagerTest;
FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers);
+ FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest,
+ UnregisterDumperFromThreadWhileDumping);
// Descriptor struct used to hold information about registered MDPs. It is
// deliberately copyable, in order to allow it to be used as std::set value.
@@ -123,6 +130,11 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// as can be safely changed without impacting the order within the set.
mutable int consecutive_failures;
mutable bool disabled;
+
+ // When a dump provider unregisters, it is flagged as |unregistered| and it
+ // is removed only upon the next memory dump. This is to avoid altering the
+ // |dump_providers_| collection while a dump is in progress.
+ mutable bool unregistered;
};
using MemoryDumpProviderInfoSet = std::set<MemoryDumpProviderInfo>;
@@ -189,10 +201,6 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// affinity (MDPs belonging to the same thread are adjacent).
MemoryDumpProviderInfoSet dump_providers_;
- // Flag used to signal that some provider was removed from |dump_providers_|
- // and therefore the current memory dump (if any) should be aborted.
- bool did_unregister_dump_provider_;
-
// Shared among all the PMDs to keep state scoped to the tracing session.
scoped_refptr<MemoryDumpSessionState> session_state_;
@@ -219,6 +227,11 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// Skips the auto-registration of the core dumpers during Initialize().
bool skip_core_dumpers_auto_registration_for_testing_;
+ // When true, the initialization phase does not start the periodic memory
+ // dumps.
+ // TODO(primiano): This should go into TraceConfig. https://goo.gl/5Hj3o0.
+ bool disable_periodic_dumps_for_testing_;
+
DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager);
};
« no previous file with comments | « threading/sequenced_worker_pool.cc ('k') | trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698