| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const char kPersistentStringSeparator = '/'; // Currently a slash. | 31 const char kPersistentStringSeparator = '/'; // Currently a slash. |
| 32 | 32 |
| 33 // Define a marker character to be used as a prefix to a trial name on the | 33 // Define a marker character to be used as a prefix to a trial name on the |
| 34 // command line which forces its activation. | 34 // command line which forces its activation. |
| 35 const char kActivationMarker = '*'; | 35 const char kActivationMarker = '*'; |
| 36 | 36 |
| 37 // Use shared memory to communicate field trial (experiment) state. Set to false | 37 // Use shared memory to communicate field trial (experiment) state. Set to false |
| 38 // for now while the implementation is fleshed out (e.g. data format, single | 38 // for now while the implementation is fleshed out (e.g. data format, single |
| 39 // shared memory segment). See https://codereview.chromium.org/2365273004/ and | 39 // shared memory segment). See https://codereview.chromium.org/2365273004/ and |
| 40 // crbug.com/653874 | 40 // crbug.com/653874 |
| 41 const bool kUseSharedMemoryForFieldTrials = false; | 41 const bool kUseSharedMemoryForFieldTrials = true; |
| 42 | 42 |
| 43 // Constants for the field trial allocator. | 43 // Constants for the field trial allocator. |
| 44 const char kAllocatorName[] = "FieldTrialAllocator"; | 44 const char kAllocatorName[] = "FieldTrialAllocator"; |
| 45 const uint32_t kFieldTrialType = 0xABA17E13 + 2; // SHA1(FieldTrialEntry) v2 | 45 const uint32_t kFieldTrialType = 0xABA17E13 + 2; // SHA1(FieldTrialEntry) v2 |
| 46 | 46 |
| 47 // We allocate 64 KiB to hold all the field trial data. This should be enough, | 47 // We allocate 64 KiB to hold all the field trial data. This should be enough, |
| 48 // as currently we use ~8KiB for the field trials, and ~10KiB for experiment | 48 // as currently we use ~8KiB for the field trials, and ~10KiB for experiment |
| 49 // parameters (as of 9/11/2016). This also doesn't allocate all 64 KiB at once | 49 // parameters (as of 9/11/2016). This also doesn't allocate all 64 KiB at once |
| 50 // -- the pages only get mapped to physical memory when they are touched. If the | 50 // -- the pages only get mapped to physical memory when they are touched. If the |
| 51 // size of the allocated field trials does get larger than 64 KiB, then we will | 51 // size of the allocated field trials does get larger than 64 KiB, then we will |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 return; | 1108 return; |
| 1109 } | 1109 } |
| 1110 AutoLock auto_lock(global_->lock_); | 1110 AutoLock auto_lock(global_->lock_); |
| 1111 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); | 1111 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); |
| 1112 trial->AddRef(); | 1112 trial->AddRef(); |
| 1113 trial->SetTrialRegistered(); | 1113 trial->SetTrialRegistered(); |
| 1114 global_->registered_[trial->trial_name()] = trial; | 1114 global_->registered_[trial->trial_name()] = trial; |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 } // namespace base | 1117 } // namespace base |
| OLD | NEW |