| OLD | NEW |
| 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 "base/trace_event/memory_dump_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/allocator/features.h" | 13 #include "base/allocator/features.h" |
| 14 #include "base/atomic_sequence_num.h" | 14 #include "base/atomic_sequence_num.h" |
| 15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/debug/alias.h" | 18 #include "base/debug/alias.h" |
| 19 #include "base/debug/debugging_flags.h" | 19 #include "base/debug/debugging_flags.h" |
| 20 #include "base/debug/stack_trace.h" | 20 #include "base/debug/stack_trace.h" |
| 21 #include "base/debug/thread_heap_usage_tracker.h" | 21 #include "base/debug/thread_heap_usage_tracker.h" |
| 22 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
| 23 #include "base/optional.h" |
| 23 #include "base/strings/pattern.h" | 24 #include "base/strings/pattern.h" |
| 24 #include "base/strings/string_piece.h" | 25 #include "base/strings/string_piece.h" |
| 25 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
| 26 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
| 27 #include "base/trace_event/heap_profiler.h" | 28 #include "base/trace_event/heap_profiler.h" |
| 28 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 29 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 29 #include "base/trace_event/heap_profiler_event_filter.h" | 30 #include "base/trace_event/heap_profiler_event_filter.h" |
| 30 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" | 31 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" |
| 31 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" | 32 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" |
| 32 #include "base/trace_event/malloc_dump_provider.h" | 33 #include "base/trace_event/malloc_dump_provider.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 "cc::SoftwareImageDecodeCache", | 77 "cc::SoftwareImageDecodeCache", |
| 77 "cc::StagingBufferPool", | 78 "cc::StagingBufferPool", |
| 78 "gpu::BufferManager", | 79 "gpu::BufferManager", |
| 79 "gpu::MappedMemoryManager", | 80 "gpu::MappedMemoryManager", |
| 80 "gpu::RenderbufferManager", | 81 "gpu::RenderbufferManager", |
| 81 "BlacklistTestDumpProvider" // for testing | 82 "BlacklistTestDumpProvider" // for testing |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 // Callback wrapper to hook upon the completion of RequestGlobalDump() and | 85 // Callback wrapper to hook upon the completion of RequestGlobalDump() and |
| 85 // inject trace markers. | 86 // inject trace markers. |
| 86 void OnGlobalDumpDone(MemoryDumpCallback wrapped_callback, | 87 void OnGlobalDumpDone(GlobalMemoryDumpCallback wrapped_callback, |
| 87 uint64_t dump_guid, | 88 uint64_t dump_guid, |
| 88 bool success) { | 89 bool success) { |
| 89 char guid_str[20]; | 90 char guid_str[20]; |
| 90 sprintf(guid_str, "0x%" PRIx64, dump_guid); | 91 sprintf(guid_str, "0x%" PRIx64, dump_guid); |
| 91 TRACE_EVENT_NESTABLE_ASYNC_END2(MemoryDumpManager::kTraceCategory, | 92 TRACE_EVENT_NESTABLE_ASYNC_END2(MemoryDumpManager::kTraceCategory, |
| 92 "GlobalMemoryDump", TRACE_ID_LOCAL(dump_guid), | 93 "GlobalMemoryDump", TRACE_ID_LOCAL(dump_guid), |
| 93 "dump_guid", TRACE_STR_COPY(guid_str), | 94 "dump_guid", TRACE_STR_COPY(guid_str), |
| 94 "success", success); | 95 "success", success); |
| 95 | 96 |
| 96 if (!wrapped_callback.is_null()) { | 97 if (!wrapped_callback.is_null()) { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 // the MDPInfo is flagged as disabled. It will cause InvokeOnMemoryDump() | 433 // the MDPInfo is flagged as disabled. It will cause InvokeOnMemoryDump() |
| 433 // to just skip it, without actually invoking the |mdp|, which might be | 434 // to just skip it, without actually invoking the |mdp|, which might be |
| 434 // destroyed by the caller soon after this method returns. | 435 // destroyed by the caller soon after this method returns. |
| 435 (*mdp_iter)->disabled = true; | 436 (*mdp_iter)->disabled = true; |
| 436 dump_providers_.erase(mdp_iter); | 437 dump_providers_.erase(mdp_iter); |
| 437 } | 438 } |
| 438 | 439 |
| 439 void MemoryDumpManager::RequestGlobalDump( | 440 void MemoryDumpManager::RequestGlobalDump( |
| 440 MemoryDumpType dump_type, | 441 MemoryDumpType dump_type, |
| 441 MemoryDumpLevelOfDetail level_of_detail, | 442 MemoryDumpLevelOfDetail level_of_detail, |
| 442 const MemoryDumpCallback& callback) { | 443 const GlobalMemoryDumpCallback& callback) { |
| 443 // Bail out immediately if tracing is not enabled at all or if the dump mode | 444 // Bail out immediately if tracing is not enabled at all or if the dump mode |
| 444 // is not allowed. | 445 // is not allowed. |
| 445 if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_)) || | 446 if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_)) || |
| 446 !IsDumpModeAllowed(level_of_detail)) { | 447 !IsDumpModeAllowed(level_of_detail)) { |
| 447 VLOG(1) << kLogPrefix << " failed because " << kTraceCategory | 448 VLOG(1) << kLogPrefix << " failed because " << kTraceCategory |
| 448 << " tracing category is not enabled or the requested dump mode is " | 449 << " tracing category is not enabled or the requested dump mode is " |
| 449 "not allowed by trace config."; | 450 "not allowed by trace config."; |
| 450 if (!callback.is_null()) | 451 if (!callback.is_null()) |
| 451 callback.Run(0u /* guid */, false /* success */); | 452 callback.Run(0u /* guid */, false /* success */); |
| 452 return; | 453 return; |
| 453 } | 454 } |
| 454 | 455 |
| 455 const uint64_t guid = | 456 const uint64_t guid = |
| 456 TraceLog::GetInstance()->MangleEventId(g_next_guid.GetNext()); | 457 TraceLog::GetInstance()->MangleEventId(g_next_guid.GetNext()); |
| 457 | 458 |
| 458 // Creates an async event to keep track of the global dump evolution. | 459 // Creates an async event to keep track of the global dump evolution. |
| 459 // The |wrapped_callback| will generate the ASYNC_END event and then invoke | 460 // The |wrapped_callback| will generate the ASYNC_END event and then invoke |
| 460 // the real |callback| provided by the caller. | 461 // the real |callback| provided by the caller. |
| 461 TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( | 462 TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( |
| 462 kTraceCategory, "GlobalMemoryDump", TRACE_ID_LOCAL(guid), "dump_type", | 463 kTraceCategory, "GlobalMemoryDump", TRACE_ID_LOCAL(guid), "dump_type", |
| 463 MemoryDumpTypeToString(dump_type), "level_of_detail", | 464 MemoryDumpTypeToString(dump_type), "level_of_detail", |
| 464 MemoryDumpLevelOfDetailToString(level_of_detail)); | 465 MemoryDumpLevelOfDetailToString(level_of_detail)); |
| 465 MemoryDumpCallback wrapped_callback = Bind(&OnGlobalDumpDone, callback); | 466 GlobalMemoryDumpCallback wrapped_callback = Bind(&OnGlobalDumpDone, callback); |
| 466 | 467 |
| 467 // The delegate will coordinate the IPC broadcast and at some point invoke | 468 // The delegate will coordinate the IPC broadcast and at some point invoke |
| 468 // CreateProcessDump() to get a dump for the current process. | 469 // CreateProcessDump() to get a dump for the current process. |
| 469 MemoryDumpRequestArgs args = {guid, dump_type, level_of_detail}; | 470 MemoryDumpRequestArgs args = {guid, dump_type, level_of_detail}; |
| 470 delegate_->RequestGlobalMemoryDump(args, wrapped_callback); | 471 delegate_->RequestGlobalMemoryDump(args, wrapped_callback); |
| 471 } | 472 } |
| 472 | 473 |
| 473 void MemoryDumpManager::GetDumpProvidersForPolling( | 474 void MemoryDumpManager::GetDumpProvidersForPolling( |
| 474 std::vector<scoped_refptr<MemoryDumpProviderInfo>>* providers) { | 475 std::vector<scoped_refptr<MemoryDumpProviderInfo>>* providers) { |
| 475 DCHECK(providers->empty()); | 476 DCHECK(providers->empty()); |
| 476 AutoLock lock(lock_); | 477 AutoLock lock(lock_); |
| 477 for (const scoped_refptr<MemoryDumpProviderInfo>& mdp : dump_providers_) { | 478 for (const scoped_refptr<MemoryDumpProviderInfo>& mdp : dump_providers_) { |
| 478 if (mdp->options.is_fast_polling_supported) | 479 if (mdp->options.is_fast_polling_supported) |
| 479 providers->push_back(mdp); | 480 providers->push_back(mdp); |
| 480 } | 481 } |
| 481 } | 482 } |
| 482 | 483 |
| 483 void MemoryDumpManager::RequestGlobalDump( | 484 void MemoryDumpManager::RequestGlobalDump( |
| 484 MemoryDumpType dump_type, | 485 MemoryDumpType dump_type, |
| 485 MemoryDumpLevelOfDetail level_of_detail) { | 486 MemoryDumpLevelOfDetail level_of_detail) { |
| 486 RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback()); | 487 RequestGlobalDump(dump_type, level_of_detail, GlobalMemoryDumpCallback()); |
| 487 } | 488 } |
| 488 | 489 |
| 489 bool MemoryDumpManager::IsDumpProviderRegisteredForTesting( | 490 bool MemoryDumpManager::IsDumpProviderRegisteredForTesting( |
| 490 MemoryDumpProvider* provider) { | 491 MemoryDumpProvider* provider) { |
| 491 AutoLock lock(lock_); | 492 AutoLock lock(lock_); |
| 492 | 493 |
| 493 for (const auto& info : dump_providers_) { | 494 for (const auto& info : dump_providers_) { |
| 494 if (info->dump_provider == provider) | 495 if (info->dump_provider == provider) |
| 495 return true; | 496 return true; |
| 496 } | 497 } |
| 497 return false; | 498 return false; |
| 498 } | 499 } |
| 499 | 500 |
| 500 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, | 501 void MemoryDumpManager::CreateProcessDump( |
| 501 const MemoryDumpCallback& callback) { | 502 const MemoryDumpRequestArgs& args, |
| 503 const ProcessMemoryDumpCallback& callback) { |
| 502 char guid_str[20]; | 504 char guid_str[20]; |
| 503 sprintf(guid_str, "0x%" PRIx64, args.dump_guid); | 505 sprintf(guid_str, "0x%" PRIx64, args.dump_guid); |
| 504 TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(kTraceCategory, "ProcessMemoryDump", | 506 TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(kTraceCategory, "ProcessMemoryDump", |
| 505 TRACE_ID_LOCAL(args.dump_guid), "dump_guid", | 507 TRACE_ID_LOCAL(args.dump_guid), "dump_guid", |
| 506 TRACE_STR_COPY(guid_str)); | 508 TRACE_STR_COPY(guid_str)); |
| 507 | 509 |
| 508 // If argument filter is enabled then only background mode dumps should be | 510 // If argument filter is enabled then only background mode dumps should be |
| 509 // allowed. In case the trace config passed for background tracing session | 511 // allowed. In case the trace config passed for background tracing session |
| 510 // missed the allowed modes argument, it crashes here instead of creating | 512 // missed the allowed modes argument, it crashes here instead of creating |
| 511 // unexpected dumps. | 513 // unexpected dumps. |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 callback_task_runner->PostTask( | 735 callback_task_runner->PostTask( |
| 734 FROM_HERE, BindOnce(&MemoryDumpManager::FinalizeDumpAndAddToTrace, | 736 FROM_HERE, BindOnce(&MemoryDumpManager::FinalizeDumpAndAddToTrace, |
| 735 Passed(&pmd_async_state))); | 737 Passed(&pmd_async_state))); |
| 736 return; | 738 return; |
| 737 } | 739 } |
| 738 | 740 |
| 739 TRACE_EVENT0(kTraceCategory, "MemoryDumpManager::FinalizeDumpAndAddToTrace"); | 741 TRACE_EVENT0(kTraceCategory, "MemoryDumpManager::FinalizeDumpAndAddToTrace"); |
| 740 | 742 |
| 741 // The results struct to fill. | 743 // The results struct to fill. |
| 742 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 | 744 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 |
| 743 MemoryDumpCallbackResult result; | 745 base::Optional<MemoryDumpCallbackResult> result_opt; |
| 744 | 746 |
| 745 for (const auto& kv : pmd_async_state->process_dumps) { | 747 for (const auto& kv : pmd_async_state->process_dumps) { |
| 746 ProcessId pid = kv.first; // kNullProcessId for the current process. | 748 ProcessId pid = kv.first; // kNullProcessId for the current process. |
| 747 ProcessMemoryDump* process_memory_dump = kv.second.get(); | 749 ProcessMemoryDump* process_memory_dump = kv.second.get(); |
| 748 std::unique_ptr<TracedValue> traced_value(new TracedValue); | 750 std::unique_ptr<TracedValue> traced_value(new TracedValue); |
| 749 process_memory_dump->AsValueInto(traced_value.get()); | 751 process_memory_dump->AsValueInto(traced_value.get()); |
| 750 traced_value->SetString("level_of_detail", | 752 traced_value->SetString("level_of_detail", |
| 751 MemoryDumpLevelOfDetailToString( | 753 MemoryDumpLevelOfDetailToString( |
| 752 pmd_async_state->req_args.level_of_detail)); | 754 pmd_async_state->req_args.level_of_detail)); |
| 753 const char* const event_name = | 755 const char* const event_name = |
| 754 MemoryDumpTypeToString(pmd_async_state->req_args.dump_type); | 756 MemoryDumpTypeToString(pmd_async_state->req_args.dump_type); |
| 755 | 757 |
| 756 std::unique_ptr<ConvertableToTraceFormat> event_value( | 758 std::unique_ptr<ConvertableToTraceFormat> event_value( |
| 757 std::move(traced_value)); | 759 std::move(traced_value)); |
| 758 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID( | 760 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID( |
| 759 TRACE_EVENT_PHASE_MEMORY_DUMP, | 761 TRACE_EVENT_PHASE_MEMORY_DUMP, |
| 760 TraceLog::GetCategoryGroupEnabled(kTraceCategory), event_name, | 762 TraceLog::GetCategoryGroupEnabled(kTraceCategory), event_name, |
| 761 trace_event_internal::kGlobalScope, dump_guid, pid, | 763 trace_event_internal::kGlobalScope, dump_guid, pid, |
| 762 kTraceEventNumArgs, kTraceEventArgNames, | 764 kTraceEventNumArgs, kTraceEventArgNames, |
| 763 kTraceEventArgTypes, nullptr /* arg_values */, &event_value, | 765 kTraceEventArgTypes, nullptr /* arg_values */, &event_value, |
| 764 TRACE_EVENT_FLAG_HAS_ID); | 766 TRACE_EVENT_FLAG_HAS_ID); |
| 765 | 767 |
| 766 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 | 768 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 |
| 767 // Don't try to fill the struct in detailed mode since it is hard to avoid | 769 // Don't try to fill the struct in detailed mode since it is hard to avoid |
| 768 // double counting. | 770 // double counting. |
| 769 if (pmd_async_state->req_args.level_of_detail == | 771 if (pmd_async_state->req_args.level_of_detail == |
| 770 MemoryDumpLevelOfDetail::DETAILED) | 772 MemoryDumpLevelOfDetail::DETAILED) |
| 771 continue; | 773 continue; |
| 772 | 774 MemoryDumpCallbackResult result; |
| 773 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 | 775 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 |
| 774 if (pid == kNullProcessId) { | 776 if (pid == kNullProcessId) { |
| 775 result.chrome_dump.malloc_total_kb = | 777 result.chrome_dump.malloc_total_kb = |
| 776 GetDumpsSumKb("malloc", process_memory_dump); | 778 GetDumpsSumKb("malloc", process_memory_dump); |
| 777 result.chrome_dump.v8_total_kb = | 779 result.chrome_dump.v8_total_kb = |
| 778 GetDumpsSumKb("v8/*", process_memory_dump); | 780 GetDumpsSumKb("v8/*", process_memory_dump); |
| 779 | 781 |
| 780 // partition_alloc reports sizes for both allocated_objects and | 782 // partition_alloc reports sizes for both allocated_objects and |
| 781 // partitions. The memory allocated_objects uses is a subset of | 783 // partitions. The memory allocated_objects uses is a subset of |
| 782 // the partitions memory so to avoid double counting we only | 784 // the partitions memory so to avoid double counting we only |
| 783 // count partitions memory. | 785 // count partitions memory. |
| 784 result.chrome_dump.partition_alloc_total_kb = | 786 result.chrome_dump.partition_alloc_total_kb = |
| 785 GetDumpsSumKb("partition_alloc/partitions/*", process_memory_dump); | 787 GetDumpsSumKb("partition_alloc/partitions/*", process_memory_dump); |
| 786 result.chrome_dump.blink_gc_total_kb = | 788 result.chrome_dump.blink_gc_total_kb = |
| 787 GetDumpsSumKb("blink_gc", process_memory_dump); | 789 GetDumpsSumKb("blink_gc", process_memory_dump); |
| 788 FillOsDumpFromProcessMemoryDump(process_memory_dump, &result.os_dump); | 790 FillOsDumpFromProcessMemoryDump(process_memory_dump, &result.os_dump); |
| 789 } else { | 791 } else { |
| 790 auto& os_dump = result.extra_processes_dump[pid]; | 792 auto& os_dump = result.extra_processes_dump[pid]; |
| 791 FillOsDumpFromProcessMemoryDump(process_memory_dump, &os_dump); | 793 FillOsDumpFromProcessMemoryDump(process_memory_dump, &os_dump); |
| 792 } | 794 } |
| 795 result_opt = result; |
| 793 } | 796 } |
| 794 | 797 |
| 795 bool tracing_still_enabled; | 798 bool tracing_still_enabled; |
| 796 TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &tracing_still_enabled); | 799 TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &tracing_still_enabled); |
| 797 if (!tracing_still_enabled) { | 800 if (!tracing_still_enabled) { |
| 798 pmd_async_state->dump_successful = false; | 801 pmd_async_state->dump_successful = false; |
| 799 VLOG(1) << kLogPrefix << " failed because tracing was disabled before" | 802 VLOG(1) << kLogPrefix << " failed because tracing was disabled before" |
| 800 << " the dump was completed"; | 803 << " the dump was completed"; |
| 801 } | 804 } |
| 802 | 805 |
| 803 if (!pmd_async_state->callback.is_null()) { | 806 if (!pmd_async_state->callback.is_null()) { |
| 804 pmd_async_state->callback.Run(dump_guid, pmd_async_state->dump_successful); | 807 pmd_async_state->callback.Run(dump_guid, pmd_async_state->dump_successful, |
| 808 result_opt); |
| 805 pmd_async_state->callback.Reset(); | 809 pmd_async_state->callback.Reset(); |
| 806 } | 810 } |
| 807 | 811 |
| 808 TRACE_EVENT_NESTABLE_ASYNC_END0(kTraceCategory, "ProcessMemoryDump", | 812 TRACE_EVENT_NESTABLE_ASYNC_END0(kTraceCategory, "ProcessMemoryDump", |
| 809 TRACE_ID_LOCAL(dump_guid)); | 813 TRACE_ID_LOCAL(dump_guid)); |
| 810 } | 814 } |
| 811 | 815 |
| 812 void MemoryDumpManager::OnTraceLogEnabled() { | 816 void MemoryDumpManager::OnTraceLogEnabled() { |
| 813 bool enabled; | 817 bool enabled; |
| 814 TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &enabled); | 818 TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &enabled); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 AutoLock lock(lock_); | 945 AutoLock lock(lock_); |
| 942 if (!session_state_) | 946 if (!session_state_) |
| 943 return false; | 947 return false; |
| 944 return session_state_->IsDumpModeAllowed(dump_mode); | 948 return session_state_->IsDumpModeAllowed(dump_mode); |
| 945 } | 949 } |
| 946 | 950 |
| 947 MemoryDumpManager::ProcessMemoryDumpAsyncState::ProcessMemoryDumpAsyncState( | 951 MemoryDumpManager::ProcessMemoryDumpAsyncState::ProcessMemoryDumpAsyncState( |
| 948 MemoryDumpRequestArgs req_args, | 952 MemoryDumpRequestArgs req_args, |
| 949 const MemoryDumpProviderInfo::OrderedSet& dump_providers, | 953 const MemoryDumpProviderInfo::OrderedSet& dump_providers, |
| 950 scoped_refptr<MemoryDumpSessionState> session_state, | 954 scoped_refptr<MemoryDumpSessionState> session_state, |
| 951 MemoryDumpCallback callback, | 955 ProcessMemoryDumpCallback callback, |
| 952 scoped_refptr<SingleThreadTaskRunner> dump_thread_task_runner) | 956 scoped_refptr<SingleThreadTaskRunner> dump_thread_task_runner) |
| 953 : req_args(req_args), | 957 : req_args(req_args), |
| 954 session_state(std::move(session_state)), | 958 session_state(std::move(session_state)), |
| 955 callback(callback), | 959 callback(callback), |
| 956 dump_successful(true), | 960 dump_successful(true), |
| 957 callback_task_runner(ThreadTaskRunnerHandle::Get()), | 961 callback_task_runner(ThreadTaskRunnerHandle::Get()), |
| 958 dump_thread_task_runner(std::move(dump_thread_task_runner)) { | 962 dump_thread_task_runner(std::move(dump_thread_task_runner)) { |
| 959 pending_dump_providers.reserve(dump_providers.size()); | 963 pending_dump_providers.reserve(dump_providers.size()); |
| 960 pending_dump_providers.assign(dump_providers.rbegin(), dump_providers.rend()); | 964 pending_dump_providers.assign(dump_providers.rbegin(), dump_providers.rend()); |
| 961 } | 965 } |
| 962 | 966 |
| 963 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { | 967 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { |
| 964 } | 968 } |
| 965 | 969 |
| 966 ProcessMemoryDump* MemoryDumpManager::ProcessMemoryDumpAsyncState:: | 970 ProcessMemoryDump* MemoryDumpManager::ProcessMemoryDumpAsyncState:: |
| 967 GetOrCreateMemoryDumpContainerForProcess(ProcessId pid, | 971 GetOrCreateMemoryDumpContainerForProcess(ProcessId pid, |
| 968 const MemoryDumpArgs& dump_args) { | 972 const MemoryDumpArgs& dump_args) { |
| 969 auto iter = process_dumps.find(pid); | 973 auto iter = process_dumps.find(pid); |
| 970 if (iter == process_dumps.end()) { | 974 if (iter == process_dumps.end()) { |
| 971 std::unique_ptr<ProcessMemoryDump> new_pmd( | 975 std::unique_ptr<ProcessMemoryDump> new_pmd( |
| 972 new ProcessMemoryDump(session_state, dump_args)); | 976 new ProcessMemoryDump(session_state, dump_args)); |
| 973 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 977 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
| 974 } | 978 } |
| 975 return iter->second.get(); | 979 return iter->second.get(); |
| 976 } | 980 } |
| 977 | 981 |
| 978 } // namespace trace_event | 982 } // namespace trace_event |
| 979 } // namespace base | 983 } // namespace base |
| OLD | NEW |