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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 1427963002: [tracing] Move memory-infra dumps to dedicated thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@memory-infra-names
Patch Set: remove extra reset() Created 5 years, 1 month 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') | no next file with comments »
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 8b90ca42f52f23a938a2df81bac6a3aee29c9dcb..aca882816280684d543c9231fdfcbc0bd4b193f6 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -20,6 +20,7 @@
namespace base {
class SingleThreadTaskRunner;
+class Thread;
namespace trace_event {
@@ -159,7 +160,8 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
MemoryDumpRequestArgs req_args,
MemoryDumpProviderInfoSet::iterator next_dump_provider,
const scoped_refptr<MemoryDumpSessionState>& session_state,
- MemoryDumpCallback callback);
+ MemoryDumpCallback callback,
+ const scoped_refptr<SingleThreadTaskRunner>& dump_thread_task_runner);
~ProcessMemoryDumpAsyncState();
// The ProcessMemoryDump container, where each dump provider will dump its
@@ -179,7 +181,14 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// The thread on which FinalizeDumpAndAddToTrace() (and hence |callback|)
// should be invoked. This is the thread on which the initial
// CreateProcessDump() request was called.
- const scoped_refptr<SingleThreadTaskRunner> task_runner;
+ const scoped_refptr<SingleThreadTaskRunner> callback_task_runner;
+
+ // The thread on which unbound dump providers should be invoked.
+ // This is essentially |dump_thread_|.task_runner() but needs to be kept
+ // as a separate variable as it needs to be accessed by arbitrary dumpers'
+ // threads outside of the lock_ to avoid races when disabling tracing.
+ // It is immutable for all the duration of a tracing session.
+ const scoped_refptr<SingleThreadTaskRunner> dump_thread_task_runner;
private:
DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDumpAsyncState);
@@ -233,6 +242,9 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// For time-triggered periodic dumps.
RepeatingTimer periodic_dump_timer_;
+ // Thread used for MemoryDumpProviders which don't specify a thread affinity.
+ scoped_ptr<Thread> dump_thread_;
+
// The unique id of the child process. This is created only for tracing and is
// expected to be valid only when tracing is enabled.
uint64_t tracing_process_id_;
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698