OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/tracing/tracing_controller_impl.h" | 4 #include "content/browser/tracing/tracing_controller_impl.h" |
5 | 5 |
6 #include <algorithm> | 6 #include <algorithm> |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/cpu.h" | 12 #include "base/cpu.h" |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/guid.h" | 14 #include "base/guid.h" |
15 #include "base/json/string_escape.h" | 15 #include "base/json/string_escape.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" |
17 #include "base/memory/ref_counted_memory.h" | 18 #include "base/memory/ref_counted_memory.h" |
18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
20 #include "base/threading/sequenced_worker_pool.h" | 21 #include "base/threading/sequenced_worker_pool.h" |
21 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
23 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| 25 #include "base/values.h" |
24 #include "build/build_config.h" | 26 #include "build/build_config.h" |
25 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 27 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
26 #include "content/browser/tracing/file_tracing_provider_impl.h" | 28 #include "content/browser/tracing/file_tracing_provider_impl.h" |
27 #include "content/browser/tracing/trace_message_filter.h" | 29 #include "content/browser/tracing/trace_message_filter.h" |
28 #include "content/browser/tracing/tracing_ui.h" | 30 #include "content/browser/tracing/tracing_ui.h" |
29 #include "content/common/child_process_messages.h" | 31 #include "content/common/child_process_messages.h" |
30 #include "content/public/browser/browser_message_filter.h" | 32 #include "content/public/browser/browser_message_filter.h" |
31 #include "content/public/browser/content_browser_client.h" | 33 #include "content/public/browser/content_browser_client.h" |
32 #include "content/public/browser/gpu_data_manager.h" | 34 #include "content/public/browser/gpu_data_manager.h" |
33 #include "content/public/browser/tracing_delegate.h" | 35 #include "content/public/browser/tracing_delegate.h" |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 const MetadataFilterPredicate& filter) { | 814 const MetadataFilterPredicate& filter) { |
813 if (filter.is_null()) { | 815 if (filter.is_null()) { |
814 sink->AddMetadata(std::move(metadata)); | 816 sink->AddMetadata(std::move(metadata)); |
815 return; | 817 return; |
816 } | 818 } |
817 std::unique_ptr<base::DictionaryValue> filtered_metadata( | 819 std::unique_ptr<base::DictionaryValue> filtered_metadata( |
818 new base::DictionaryValue); | 820 new base::DictionaryValue); |
819 for (base::DictionaryValue::Iterator it(*metadata); !it.IsAtEnd(); | 821 for (base::DictionaryValue::Iterator it(*metadata); !it.IsAtEnd(); |
820 it.Advance()) { | 822 it.Advance()) { |
821 if (filter.Run(it.key())) | 823 if (filter.Run(it.key())) |
822 filtered_metadata->Set(it.key(), it.value().DeepCopy()); | 824 filtered_metadata->Set(it.key(), |
| 825 base::MakeUnique<base::Value>(it.value())); |
823 else | 826 else |
824 filtered_metadata->SetString(it.key(), "__stripped__"); | 827 filtered_metadata->SetString(it.key(), "__stripped__"); |
825 } | 828 } |
826 sink->AddMetadata(std::move(filtered_metadata)); | 829 sink->AddMetadata(std::move(filtered_metadata)); |
827 } | 830 } |
828 | 831 |
829 std::unique_ptr<base::DictionaryValue> | 832 std::unique_ptr<base::DictionaryValue> |
830 TracingControllerImpl::GenerateTracingMetadataDict() const { | 833 TracingControllerImpl::GenerateTracingMetadataDict() const { |
831 // It's important that this function creates a new metadata dict and returns | 834 // It's important that this function creates a new metadata dict and returns |
832 // it rather than directly populating the metadata_ member, as the data may | 835 // it rather than directly populating the metadata_ member, as the data may |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 void TracingControllerImpl::RemoveTraceMessageFilterObserver( | 936 void TracingControllerImpl::RemoveTraceMessageFilterObserver( |
934 TraceMessageFilterObserver* observer) { | 937 TraceMessageFilterObserver* observer) { |
935 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 938 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
936 trace_message_filter_observers_.RemoveObserver(observer); | 939 trace_message_filter_observers_.RemoveObserver(observer); |
937 | 940 |
938 for (auto& filter : trace_message_filters_) | 941 for (auto& filter : trace_message_filters_) |
939 observer->OnTraceMessageFilterRemoved(filter.get()); | 942 observer->OnTraceMessageFilterRemoved(filter.get()); |
940 } | 943 } |
941 | 944 |
942 } // namespace content | 945 } // namespace content |
OLD | NEW |