| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ | 5 #ifndef CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
| 6 #define CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ | 6 #define CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Starts the experiment if corresponding field trial is enabled | 29 // Starts the experiment if corresponding field trial is enabled |
| 30 static void MaybeStart(scoped_refptr<base::SequencedTaskRunner> task_runner); | 30 static void MaybeStart(scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 MemoryAblationExperiment(); | 33 MemoryAblationExperiment(); |
| 34 | 34 |
| 35 void Start(scoped_refptr<base::SequencedTaskRunner> task_runner, size_t size); | 35 void Start(scoped_refptr<base::SequencedTaskRunner> task_runner, size_t size); |
| 36 | 36 |
| 37 void AllocateMemory(size_t size); | 37 void AllocateMemory(size_t size); |
| 38 void TouchMemory(); | 38 void TouchMemory(size_t offset); |
| 39 void ScheduleTouchMemory(size_t offset); |
| 39 | 40 |
| 40 static MemoryAblationExperiment* GetInstance(); | 41 static MemoryAblationExperiment* GetInstance(); |
| 41 | 42 |
| 43 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 42 size_t memory_size_ = 0; | 44 size_t memory_size_ = 0; |
| 43 std::unique_ptr<uint8_t[]> memory_; | 45 std::unique_ptr<uint8_t[]> memory_; |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 #endif // CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ | 48 #endif // CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
| OLD | NEW |