Chromium Code Reviews| Index: content/browser/tracing/tracing_controller_impl.cc |
| diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc |
| index 8380c45c44cd2924301ebd3b7e34f803daf23480..48ed1ad6115998f0ba80d84cc95dabb4fdc2d6e4 100644 |
| --- a/content/browser/tracing/tracing_controller_impl.cc |
| +++ b/content/browser/tracing/tracing_controller_impl.cc |
| @@ -920,16 +920,21 @@ void TracingControllerImpl::RequestGlobalMemoryDump( |
| base::Unretained(this), args, callback)); |
| return; |
| } |
| - // Abort if another dump is already in progress. |
| + |
| + // Enqueue request if another dump is already in progress. |
| if (pending_memory_dump_guid_) { |
|
Primiano Tucci (use gerrit)
2016/06/16 08:37:23
I think here I'd just if (!queued_memory_dump_requ
petrcermak
2016/06/16 12:08:29
Done.
|
| - VLOG(1) << base::trace_event::MemoryDumpManager::kLogPrefix |
| - << " (" << args.dump_guid << ") aborted because another dump (" |
| - << pending_memory_dump_guid_ << ") is in progress"; |
| - if (!callback.is_null()) |
| - callback.Run(args.dump_guid, false /* success */); |
| + enqueued_memory_dump_requests_.emplace(args, callback); |
|
ssid
2016/06/15 17:20:51
For the case of only periodic dumps, if a heavy du
Primiano Tucci (use gerrit)
2016/06/16 08:37:23
So, I agree with ssid that this can cause some sto
petrcermak
2016/06/16 12:08:31
I think that the following would be the best appro
ssid
2016/06/16 23:12:03
If there is a sequence of events like this when a
petrcermak
2016/06/17 08:36:44
I'm fine with that, BUT that would require re-arch
ssid
2016/06/17 18:43:45
Ah I see, then I am fine with this, if that is goi
|
| return; |
| } |
| + PerformGlobalMemoryDump(args, callback); |
| +} |
| + |
| +void TracingControllerImpl::PerformGlobalMemoryDump( |
| + const base::trace_event::MemoryDumpRequestArgs& args, |
|
Primiano Tucci (use gerrit)
2016/06/16 08:37:23
Does this require any arg? Aren't this the front()
petrcermak
2016/06/16 12:08:29
They were not, but I changed it, so done.
|
| + const base::trace_event::MemoryDumpCallback& callback) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + |
| // Count myself (local trace) in pending_memory_dump_ack_count_, acked by |
| // OnBrowserProcessMemoryDumpDone(). |
| pending_memory_dump_ack_count_ = trace_message_filters_.size() + 1; |
| @@ -952,6 +957,13 @@ void TracingControllerImpl::RequestGlobalMemoryDump( |
| tmf->SendProcessMemoryDumpRequest(args); |
| } |
| +TracingControllerImpl::GlobalMemoryDumpRequest::GlobalMemoryDumpRequest( |
| + const base::trace_event::MemoryDumpRequestArgs& args, |
| + const base::trace_event::MemoryDumpCallback& callback) |
| + : args(args), callback(callback) {} |
| + |
| +TracingControllerImpl::GlobalMemoryDumpRequest::~GlobalMemoryDumpRequest() {} |
| + |
| uint64_t TracingControllerImpl::GetTracingProcessId() const { |
| return ChildProcessHost::kBrowserTracingProcessId; |
| } |
| @@ -1033,6 +1045,14 @@ void TracingControllerImpl::FinalizeGlobalMemoryDumpIfAllProcessesReplied() { |
| pending_memory_dump_callback_.Reset(); |
| } |
| pending_memory_dump_guid_ = 0; |
| + |
| + // Immediately perform another dump if it's been enqueued. |
| + if (!enqueued_memory_dump_requests_.empty()) { |
|
petrcermak
2016/06/15 16:19:11
Maybe it would be better to post a task instead?
Primiano Tucci (use gerrit)
2016/06/16 08:37:23
Yeah that will avoid thinking about weird re-entra
petrcermak
2016/06/16 12:08:31
Done.
|
| + const auto args = enqueued_memory_dump_requests_.front().args; |
| + const auto callback = enqueued_memory_dump_requests_.front().callback; |
| + enqueued_memory_dump_requests_.pop(); |
| + PerformGlobalMemoryDump(args, callback); |
| + } |
| } |
| } // namespace content |