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 + 1; // SHA1(FieldTrialEntry) v1 | 45 const uint32_t kFieldTrialType = 0xABA17E13 + 1; // SHA1(FieldTrialEntry) v1 |
46 #if !defined(OS_NACL) | 46 #if !defined(OS_NACL) |
47 const size_t kFieldTrialAllocationSize = 4 << 10; // 4 KiB = one page | 47 const size_t kFieldTrialAllocationSize = 4 << 10; // 4 KiB = one page |
48 #endif | 48 #endif |
49 | 49 |
50 // We create one FieldTrialEntry per field trial in shared memory, via | 50 // We create one FieldTrialEntry per field trial in shared memory, via |
51 // AddToAllocatorWhileLocked. The FieldTrialEntry is followed by a base::Pickle | 51 // AddToAllocatorWhileLocked. The FieldTrialEntry is followed by a base::Pickle |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 return; | 972 return; |
973 } | 973 } |
974 AutoLock auto_lock(global_->lock_); | 974 AutoLock auto_lock(global_->lock_); |
975 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); | 975 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); |
976 trial->AddRef(); | 976 trial->AddRef(); |
977 trial->SetTrialRegistered(); | 977 trial->SetTrialRegistered(); |
978 global_->registered_[trial->trial_name()] = trial; | 978 global_->registered_[trial->trial_name()] = trial; |
979 } | 979 } |
980 | 980 |
981 } // namespace base | 981 } // namespace base |
OLD | NEW |