| OLD | NEW |
| 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/feature_list.h" | 13 #include "base/feature_list.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/histogram_macros.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 namespace base { | 23 namespace base { |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // command-line flag. The child process will do the reverse conversions to | 718 // command-line flag. The child process will do the reverse conversions to |
| 718 // retrieve the handle. See http://stackoverflow.com/a/153077 | 719 // retrieve the handle. See http://stackoverflow.com/a/153077 |
| 719 auto uintptr_handle = | 720 auto uintptr_handle = |
| 720 reinterpret_cast<uintptr_t>(global_->readonly_allocator_handle_); | 721 reinterpret_cast<uintptr_t>(global_->readonly_allocator_handle_); |
| 721 size_t field_trial_length = | 722 size_t field_trial_length = |
| 722 global_->field_trial_allocator_->shared_memory()->mapped_size(); | 723 global_->field_trial_allocator_->shared_memory()->mapped_size(); |
| 723 std::string field_trial_handle = std::to_string(uintptr_handle) + "," + | 724 std::string field_trial_handle = std::to_string(uintptr_handle) + "," + |
| 724 std::to_string(field_trial_length); | 725 std::to_string(field_trial_length); |
| 725 | 726 |
| 726 cmd_line->AppendSwitchASCII(field_trial_handle_switch, field_trial_handle); | 727 cmd_line->AppendSwitchASCII(field_trial_handle_switch, field_trial_handle); |
| 728 UMA_HISTOGRAM_COUNTS_10000("UMA.Metrics.FieldTrialAllocator.Size", |
| 729 field_trial_length); |
| 727 return; | 730 return; |
| 728 } | 731 } |
| 729 #endif | 732 #endif |
| 730 | 733 |
| 731 AddForceFieldTrialsFlag(cmd_line); | 734 AddForceFieldTrialsFlag(cmd_line); |
| 732 } | 735 } |
| 733 | 736 |
| 734 // static | 737 // static |
| 735 FieldTrial* FieldTrialList::CreateFieldTrial( | 738 FieldTrial* FieldTrialList::CreateFieldTrial( |
| 736 const std::string& name, | 739 const std::string& name, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 return; | 907 return; |
| 905 } | 908 } |
| 906 AutoLock auto_lock(global_->lock_); | 909 AutoLock auto_lock(global_->lock_); |
| 907 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); | 910 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); |
| 908 trial->AddRef(); | 911 trial->AddRef(); |
| 909 trial->SetTrialRegistered(); | 912 trial->SetTrialRegistered(); |
| 910 global_->registered_[trial->trial_name()] = trial; | 913 global_->registered_[trial->trial_name()] = trial; |
| 911 } | 914 } |
| 912 | 915 |
| 913 } // namespace base | 916 } // namespace base |
| OLD | NEW |