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

Side by Side Diff: base/metrics/field_trial.cc

Issue 2666653002: Record field-trial information in stability file for crash analysis. (Closed)
Patch Set: use GetActiveFieldTrialGroups instead of caching them locally Created 3 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
11 #include "base/build_time.h" 11 #include "base/build_time.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/activity_tracker.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/metrics/field_trial_param_associator.h" 15 #include "base/metrics/field_trial_param_associator.h"
15 #include "base/process/memory.h" 16 #include "base/process/memory.h"
16 #include "base/rand_util.h" 17 #include "base/rand_util.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
21 22
22 // On POSIX, the fd is shared using the mapping in GlobalDescriptors. 23 // On POSIX, the fd is shared using the mapping in GlobalDescriptors.
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 return; 976 return;
976 field_trial->group_reported_ = true; 977 field_trial->group_reported_ = true;
977 978
978 if (!field_trial->enable_field_trial_) 979 if (!field_trial->enable_field_trial_)
979 return; 980 return;
980 981
981 if (kUseSharedMemoryForFieldTrials) 982 if (kUseSharedMemoryForFieldTrials)
982 ActivateFieldTrialEntryWhileLocked(field_trial); 983 ActivateFieldTrialEntryWhileLocked(field_trial);
983 } 984 }
984 985
986 // Recording for stability debugging has to be done inline as a task posted
987 // to an observer may not get executed before a crash.
988 base::debug::GlobalActivityTracker* tracker =
989 base::debug::GlobalActivityTracker::Get();
990 if (tracker) {
991 tracker->RecordFieldTrial(field_trial->trial_name(),
992 field_trial->group_name_internal());
993 }
Alexei Svitkine (slow) 2017/02/07 21:23:52 Nit: I prefer this extra logic to be inside Global
bcwhite 2017/02/07 22:09:02 It could but all the existing tracker interface op
994
985 global_->observer_list_->Notify( 995 global_->observer_list_->Notify(
986 FROM_HERE, &FieldTrialList::Observer::OnFieldTrialGroupFinalized, 996 FROM_HERE, &FieldTrialList::Observer::OnFieldTrialGroupFinalized,
987 field_trial->trial_name(), field_trial->group_name_internal()); 997 field_trial->trial_name(), field_trial->group_name_internal());
988 } 998 }
989 999
990 // static 1000 // static
991 size_t FieldTrialList::GetFieldTrialCount() { 1001 size_t FieldTrialList::GetFieldTrialCount() {
992 if (!global_) 1002 if (!global_)
993 return 0; 1003 return 0;
994 AutoLock auto_lock(global_->lock_); 1004 AutoLock auto_lock(global_->lock_);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 return; 1357 return;
1348 } 1358 }
1349 AutoLock auto_lock(global_->lock_); 1359 AutoLock auto_lock(global_->lock_);
1350 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); 1360 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name();
1351 trial->AddRef(); 1361 trial->AddRef();
1352 trial->SetTrialRegistered(); 1362 trial->SetTrialRegistered();
1353 global_->registered_[trial->trial_name()] = trial; 1363 global_->registered_[trial->trial_name()] = trial;
1354 } 1364 }
1355 1365
1356 } // namespace base 1366 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698