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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 1173263004: [tracing] Send unique tracing process id for cross-process memory dumps identification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing DCHECK while setting id. Created 5 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 | « base/trace_event/memory_dump_manager.h ('k') | components/tracing/child_trace_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 3814c21fd28698babd28008c41ca85283b3e817f..f7963e33ca3ee6ebeb647a8fb08bc270033546a1 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -8,6 +8,7 @@
#include "base/atomic_sequence_num.h"
#include "base/compiler_specific.h"
+#include "base/hash.h"
#include "base/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/memory_dump_session_state.h"
@@ -132,6 +133,10 @@ void InitializeThreadLocalEventBufferIfSupported() {
} // namespace
+// The value -1 is not used as child process id.
+const int MemoryDumpManager::kInvalidTracingProcessId =
+ MemoryDumpManager::ChildProcessIdToTracingProcessId(-1);
dcheng 2015/06/25 20:28:36 FYI, this introduces a static initializer. Sorry I
+
// static
const char* const MemoryDumpManager::kTraceCategoryForTesting = kTraceCategory;
@@ -157,6 +162,7 @@ void MemoryDumpManager::SetInstanceForTesting(MemoryDumpManager* instance) {
MemoryDumpManager::MemoryDumpManager()
: delegate_(nullptr),
memory_tracing_enabled_(0),
+ tracing_process_id_(kInvalidTracingProcessId),
skip_core_dumpers_auto_registration_for_testing_(false) {
g_next_guid.GetNext(); // Make sure that first guid is not zero.
}
@@ -432,6 +438,12 @@ void MemoryDumpManager::OnTraceLogDisabled() {
session_state_ = nullptr;
}
+// static
+int MemoryDumpManager::ChildProcessIdToTracingProcessId(int child_process_id) {
+ return Hash(reinterpret_cast<const char*>(&child_process_id),
+ sizeof(child_process_id));
+}
+
MemoryDumpManager::MemoryDumpProviderInfo::MemoryDumpProviderInfo(
const scoped_refptr<SingleThreadTaskRunner>& task_runner)
: task_runner(task_runner), consecutive_failures(0), disabled(false) {
« no previous file with comments | « base/trace_event/memory_dump_manager.h ('k') | components/tracing/child_trace_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698