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 "chrome/browser/tracing/chrome_tracing_delegate.h" | 5 #include "chrome/browser/tracing/chrome_tracing_delegate.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // If the profile hasn't loaded or been created yet, we allow the scenario | 77 // If the profile hasn't loaded or been created yet, we allow the scenario |
78 // to start up, but not be finalized. | 78 // to start up, but not be finalized. |
79 if (!profile) { | 79 if (!profile) { |
80 if (profile_permission == PROFILE_REQUIRED) | 80 if (profile_permission == PROFILE_REQUIRED) |
81 return false; | 81 return false; |
82 else | 82 else |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
| 86 #if !defined(OS_ANDROID) |
86 // Safeguard, in case background tracing is responsible for a crash on | 87 // Safeguard, in case background tracing is responsible for a crash on |
87 // startup. | 88 // startup. |
88 if (profile->GetLastSessionExitType() == Profile::EXIT_CRASHED) | 89 if (profile->GetLastSessionExitType() == Profile::EXIT_CRASHED) |
89 return false; | 90 return false; |
| 91 #else |
| 92 // In case of Android the exit state is always set as EXIT_CRASHED. So, |
| 93 // preemptive mode cannot be used safely. |
| 94 if (config.tracing_mode() == content::BackgroundTracingConfig::PREEMPTIVE) |
| 95 return false; |
| 96 #endif |
90 | 97 |
91 PrefService* local_state = g_browser_process->local_state(); | 98 PrefService* local_state = g_browser_process->local_state(); |
92 DCHECK(local_state); | 99 DCHECK(local_state); |
93 | 100 |
94 #if !defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) | 101 #if !defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) |
95 if (!local_state->GetBoolean(metrics::prefs::kMetricsReportingEnabled)) | 102 if (!local_state->GetBoolean(metrics::prefs::kMetricsReportingEnabled)) |
96 return false; | 103 return false; |
97 #endif // !OS_CHROMEOS && OFFICIAL_BUILD | 104 #endif // !OS_CHROMEOS && OFFICIAL_BUILD |
98 | 105 |
99 if (config.tracing_mode() == content::BackgroundTracingConfig::PREEMPTIVE) { | 106 if (config.tracing_mode() == content::BackgroundTracingConfig::PREEMPTIVE) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 for (const auto& it : variations) | 173 for (const auto& it : variations) |
167 variations_list->AppendString(it); | 174 variations_list->AppendString(it); |
168 | 175 |
169 metadata_dict->Set("field-trials", std::move(variations_list)); | 176 metadata_dict->Set("field-trials", std::move(variations_list)); |
170 } | 177 } |
171 | 178 |
172 content::MetadataFilterPredicate | 179 content::MetadataFilterPredicate |
173 ChromeTracingDelegate::GetMetadataFilterPredicate() { | 180 ChromeTracingDelegate::GetMetadataFilterPredicate() { |
174 return base::Bind(&IsMetadataWhitelisted); | 181 return base::Bind(&IsMetadataWhitelisted); |
175 } | 182 } |
OLD | NEW |