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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 1430073002: [tracing] Allow asynchronous unregistration of unbound dump providers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | base/trace_event/memory_dump_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.h
diff --git a/base/trace_event/memory_dump_manager.h b/base/trace_event/memory_dump_manager.h
index a5037cfcef21aa1afa42f3196ce550ddec6a9034..97427212a9c1cb11db349ed55af630e95d409175 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -8,6 +8,7 @@
#include <map>
#include <memory>
#include <set>
+#include <vector>
#include "base/atomicops.h"
#include "base/containers/hash_tables.h"
@@ -80,6 +81,15 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
const MemoryDumpProvider::Options& options);
void UnregisterDumpProvider(MemoryDumpProvider* mdp);
+ // Unregisters an unbound (no task_runner affinity) dump provider and takes
+ // care about its deletion asynchronously.
+ // Can be used only for for dump providers with no task-runner affinity.
+ // This method takes ownership of the dump provider and guarantees that:
+ // - The |mdp| will be deleted at some point in the near future.
+ // - Its deletion will not happen concurrently with the OnMemoryDump() call.
Ruud van Asseldonk 2015/12/14 16:25:49 /s/concurrently/in parallel/?
+ // Note that OnMemoryDump() calls can still happen after this method returns.
+ void UnregisterAndDeleteDumpProviderAsync(scoped_ptr<MemoryDumpProvider> mdp);
Ruud van Asseldonk 2015/12/14 16:25:48 This feels like an awkward API. It looks like what
+
// Requests a memory dump. The dump might happen or not depending on the
// filters and categories specified when enabling tracing.
// The optional |callback| is executed asynchronously, on an arbitrary thread,
@@ -226,9 +236,6 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
static void SetInstanceForTesting(MemoryDumpManager* instance);
static void FinalizeDumpAndAddToTrace(
scoped_ptr<ProcessMemoryDumpAsyncState> pmd_async_state);
- static void AbortDumpLocked(MemoryDumpCallback callback,
- scoped_refptr<SingleThreadTaskRunner> task_runner,
- uint64_t dump_guid);
// Internal, used only by MemoryDumpManagerDelegate.
// Creates a memory dump for the current process and appends it to the trace.
@@ -240,7 +247,10 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// Continues the ProcessMemoryDump started by CreateProcessDump(), hopping
// across threads as needed as specified by MDPs in RegisterDumpProvider().
void ContinueAsyncProcessDump(
- scoped_ptr<ProcessMemoryDumpAsyncState> pmd_async_state);
+ ProcessMemoryDumpAsyncState* owned_pmd_async_state);
+
+ void UnregisterDumpProviderInternal(MemoryDumpProvider* mdp,
+ bool delete_async);
Ruud van Asseldonk 2015/12/14 16:25:48 This is ambiguous; does |delete_async = false| mea
// An ordererd set of registered MemoryDumpProviderInfo(s), sorted by thread
// affinity (MDPs belonging to the same thread are adjacent).
@@ -254,6 +264,12 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// When true, this instance is in charge of coordinating periodic dumps.
bool is_coordinator_;
+ // Contains one entry per each dump that has been started (via
Ruud van Asseldonk 2015/12/14 16:25:49 Nit: "per" or "for each", not "per each".
+ // CreateProcessDump()) and is not completed yet.
+ // Only the const members of the stores ProcessMemoryDumpAsyncState are safe
Ruud van Asseldonk 2015/12/14 16:25:49 /s/stores/stored/?
+ // to read and only while holding the |lock_|.
Ruud van Asseldonk 2015/12/14 16:25:49 That is a violation of the general |const| contrac
+ std::vector<const ProcessMemoryDumpAsyncState*> outstanding_dumps_;
+
// Protects from concurrent accesses to the |dump_providers_*| and |delegate_|
// to guard against disabling logging while dumping on another thread.
Lock lock_;
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | base/trace_event/memory_dump_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698