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

Side by Side Diff: components/tracing/child/child_memory_dump_manager_delegate_impl.cc

Issue 2049143002: [memory-infra] Log reasons for memory dump failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/tracing/child/child_memory_dump_manager_delegate_impl.h" 5 #include "components/tracing/child/child_memory_dump_manager_delegate_impl.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "components/tracing/child/child_trace_message_filter.h" 9 #include "components/tracing/child/child_trace_message_filter.h"
10 #include "components/tracing/common/process_metrics_memory_dump_provider.h" 10 #include "components/tracing/common/process_metrics_memory_dump_provider.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // RequestGlobalMemoryDump can be called on any thread, cannot access 68 // RequestGlobalMemoryDump can be called on any thread, cannot access
69 // ctmf_task_runner_ as it could be racy. 69 // ctmf_task_runner_ as it could be racy.
70 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner; 70 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner;
71 { 71 {
72 base::AutoLock lock(lock_); 72 base::AutoLock lock(lock_);
73 ctmf_task_runner = ctmf_task_runner_; 73 ctmf_task_runner = ctmf_task_runner_;
74 } 74 }
75 75
76 // Bail out if we receive a dump request from the manager before the 76 // Bail out if we receive a dump request from the manager before the
77 // ChildTraceMessageFilter has been initialized. 77 // ChildTraceMessageFilter has been initialized.
78 if (!ctmf_task_runner) 78 if (!ctmf_task_runner) {
79 VLOG(1) << "Process memory dump failed because child trace message filter "
Primiano Tucci (use gerrit) 2016/06/08 18:00:45 and use the same kConstant here
petrcermak 2016/06/09 09:46:09 Done.
80 << "hasn't been initialized";
79 return AbortDumpRequest(args, callback); 81 return AbortDumpRequest(args, callback);
82 }
80 83
81 // Make sure we access |ctmf_| only on the thread where it lives to avoid 84 // Make sure we access |ctmf_| only on the thread where it lives to avoid
82 // races on shutdown. 85 // races on shutdown.
83 if (!ctmf_task_runner->BelongsToCurrentThread()) { 86 if (!ctmf_task_runner->BelongsToCurrentThread()) {
84 const bool did_post_task = ctmf_task_runner->PostTask( 87 const bool did_post_task = ctmf_task_runner->PostTask(
85 FROM_HERE, 88 FROM_HERE,
86 base::Bind(&ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump, 89 base::Bind(&ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump,
87 base::Unretained(this), args, callback)); 90 base::Unretained(this), args, callback));
88 if (!did_post_task) 91 if (!did_post_task)
89 return AbortDumpRequest(args, callback); 92 return AbortDumpRequest(args, callback);
90 return; 93 return;
91 } 94 }
92 95
93 // The ChildTraceMessageFilter could have been destroyed while hopping on the 96 // The ChildTraceMessageFilter could have been destroyed while hopping on the
94 // right thread. If this is the case, bail out. 97 // right thread. If this is the case, bail out.
95 if (!ctmf_) 98 if (!ctmf_) {
99 VLOG(1) << "Process memory dump failed because child trace message filter "
100 << "has been destroyed";
ssid 2016/06/08 18:12:41 destroyed while collecting the dump or something?
petrcermak 2016/06/09 09:46:09 Added "while switching threads"
96 return AbortDumpRequest(args, callback); 101 return AbortDumpRequest(args, callback);
102 }
97 103
98 // Send the request up to the browser process' MessageDumpmanager. 104 // Send the request up to the browser process' MessageDumpmanager.
99 ctmf_->SendGlobalMemoryDumpRequest(args, callback); 105 ctmf_->SendGlobalMemoryDumpRequest(args, callback);
100 } 106 }
101 107
102 uint64_t ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const { 108 uint64_t ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const {
103 return tracing_process_id_; 109 return tracing_process_id_;
104 } 110 }
105 111
106 } // namespace tracing 112 } // namespace tracing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698