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

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: Shorten constant name 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) << base::trace_event::MemoryDumpManager::kLogPrefix
80 << " failed because child trace message filter hasn't been"
81 << " initialized";
79 return AbortDumpRequest(args, callback); 82 return AbortDumpRequest(args, callback);
83 }
80 84
81 // Make sure we access |ctmf_| only on the thread where it lives to avoid 85 // Make sure we access |ctmf_| only on the thread where it lives to avoid
82 // races on shutdown. 86 // races on shutdown.
83 if (!ctmf_task_runner->BelongsToCurrentThread()) { 87 if (!ctmf_task_runner->BelongsToCurrentThread()) {
84 const bool did_post_task = ctmf_task_runner->PostTask( 88 const bool did_post_task = ctmf_task_runner->PostTask(
85 FROM_HERE, 89 FROM_HERE,
86 base::Bind(&ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump, 90 base::Bind(&ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump,
87 base::Unretained(this), args, callback)); 91 base::Unretained(this), args, callback));
88 if (!did_post_task) 92 if (!did_post_task)
89 return AbortDumpRequest(args, callback); 93 return AbortDumpRequest(args, callback);
90 return; 94 return;
91 } 95 }
92 96
93 // The ChildTraceMessageFilter could have been destroyed while hopping on the 97 // The ChildTraceMessageFilter could have been destroyed while hopping on the
94 // right thread. If this is the case, bail out. 98 // right thread. If this is the case, bail out.
95 if (!ctmf_) 99 if (!ctmf_) {
100 VLOG(1) << base::trace_event::MemoryDumpManager::kLogPrefix
101 << " failed because child trace message filter was"
102 << " destroyed while switching threads";
96 return AbortDumpRequest(args, callback); 103 return AbortDumpRequest(args, callback);
104 }
97 105
98 // Send the request up to the browser process' MessageDumpmanager. 106 // Send the request up to the browser process' MessageDumpmanager.
99 ctmf_->SendGlobalMemoryDumpRequest(args, callback); 107 ctmf_->SendGlobalMemoryDumpRequest(args, callback);
100 } 108 }
101 109
102 uint64_t ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const { 110 uint64_t ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const {
103 return tracing_process_id_; 111 return tracing_process_id_;
104 } 112 }
105 113
106 } // namespace tracing 114 } // namespace tracing
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | content/browser/tracing/tracing_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698