| 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 "chrome/browser/chrome_browser_field_trials.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 LOCAL_MEMORY_SUCCESS, | 61 LOCAL_MEMORY_SUCCESS, |
| 62 LOCAL_MEMORY_FAILED, | 62 LOCAL_MEMORY_FAILED, |
| 63 MAPPED_FILE_SUCCESS, | 63 MAPPED_FILE_SUCCESS, |
| 64 MAPPED_FILE_FAILED, | 64 MAPPED_FILE_FAILED, |
| 65 CREATE_ALLOCATOR_RESULTS | 65 CREATE_ALLOCATOR_RESULTS |
| 66 }; | 66 }; |
| 67 int result; | 67 int result; |
| 68 | 68 |
| 69 // Create persistent/shared memory and allow histograms to be stored in | 69 // Create persistent/shared memory and allow histograms to be stored in |
| 70 // it. Memory that is not actualy used won't be physically mapped by the | 70 // it. Memory that is not actualy used won't be physically mapped by the |
| 71 // system. BrowserMetrics usage, as reported in UMA, peaked around 1.9MiB | 71 // system. BrowserMetrics usage, as reported in UMA, peaked around 3.0MiB |
| 72 // as of 2016-02-20. | 72 // as of 2016-12-20. |
| 73 const size_t kAllocSize = 3 << 20; // 3 MiB | 73 const size_t kAllocSize = 5 << 20; // 5 MiB |
| 74 const uint32_t kAllocId = 0x935DDD43; // SHA1(BrowserMetrics) | 74 const uint32_t kAllocId = 0x935DDD43; // SHA1(BrowserMetrics) |
| 75 std::string storage = variations::GetVariationParamValueByFeature( | 75 std::string storage = variations::GetVariationParamValueByFeature( |
| 76 base::kPersistentHistogramsFeature, "storage"); | 76 base::kPersistentHistogramsFeature, "storage"); |
| 77 if (storage == "MappedFile") { | 77 if (storage == "MappedFile") { |
| 78 // Create global allocator with the "active" file. | 78 // Create global allocator with the "active" file. |
| 79 base::GlobalHistogramAllocator::CreateWithFile( | 79 base::GlobalHistogramAllocator::CreateWithFile( |
| 80 active_file, kAllocSize, kAllocId, | 80 active_file, kAllocSize, kAllocId, |
| 81 ChromeMetricsServiceClient::kBrowserMetricsName); | 81 ChromeMetricsServiceClient::kBrowserMetricsName); |
| 82 result = MAPPED_FILE_SUCCESS; | 82 result = MAPPED_FILE_SUCCESS; |
| 83 } else if (storage == "LocalMemory") { | 83 } else if (storage == "LocalMemory") { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 bool has_seed, | 146 bool has_seed, |
| 147 base::FeatureList* feature_list) { | 147 base::FeatureList* feature_list) { |
| 148 CreateFallbackSamplingTrialIfNeeded(has_seed, feature_list); | 148 CreateFallbackSamplingTrialIfNeeded(has_seed, feature_list); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { | 151 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { |
| 152 // Persistent histograms must be enabled as soon as possible. | 152 // Persistent histograms must be enabled as soon as possible. |
| 153 InstantiatePersistentHistograms(); | 153 InstantiatePersistentHistograms(); |
| 154 tracing::SetupBackgroundTracingFieldTrial(); | 154 tracing::SetupBackgroundTracingFieldTrial(); |
| 155 } | 155 } |
| OLD | NEW |