Chromium Code Reviews| Index: base/profiler/stack_sampling_profiler.h |
| diff --git a/base/profiler/stack_sampling_profiler.h b/base/profiler/stack_sampling_profiler.h |
| index bf5a4f337219f76b782189fde2c5aa2f9646c640..d779b300ab1de679e1d5107b08a1e1fcc65bcbd8 100644 |
| --- a/base/profiler/stack_sampling_profiler.h |
| +++ b/base/profiler/stack_sampling_profiler.h |
| @@ -113,9 +113,13 @@ class BASE_EXPORT StackSamplingProfiler { |
| // CallStackProfile represents a set of samples. |
| struct BASE_EXPORT CallStackProfile { |
| CallStackProfile(); |
| - CallStackProfile(const CallStackProfile& other); |
| + CallStackProfile(CallStackProfile&& other); |
| ~CallStackProfile(); |
| + CallStackProfile& operator=(CallStackProfile&& other); |
| + |
| + CallStackProfile CopyForTesting() const; |
| + |
| std::vector<Module> modules; |
| std::vector<Sample> samples; |
| @@ -124,6 +128,12 @@ class BASE_EXPORT StackSamplingProfiler { |
| // Time between samples. |
| TimeDelta sampling_period; |
| + |
| + private: |
| + // Copying is possible but expensive so disallow it except for internal use |
| + // (i.e. CopyForTesting); use std::move instead. |
| + CallStackProfile(const CallStackProfile& other); |
| + DISALLOW_ASSIGN(CallStackProfile); |
|
Alexei Svitkine (slow)
2016/10/24 15:26:21
Nit: Add an empty line above this.
bcwhite
2016/10/24 21:30:30
Done.
|
| }; |
| using CallStackProfiles = std::vector<CallStackProfile>; |
| @@ -151,7 +161,8 @@ class BASE_EXPORT StackSamplingProfiler { |
| TimeDelta sampling_interval; |
| }; |
| - // The callback type used to collect completed profiles. |
| + // The callback type used to collect completed profiles. The passed |profiles| |
| + // are move-only. |
| // |
| // IMPORTANT NOTE: the callback is invoked on a thread the profiler |
| // constructs, rather than on the thread used to construct the profiler and |
| @@ -159,7 +170,7 @@ class BASE_EXPORT StackSamplingProfiler { |
| // threads with message loops that create StackSamplingProfilers, posting a |
| // task to the message loop with a copy of the profiles is the recommended |
| // thread-safe callback implementation. |
| - using CompletedCallback = Callback<void(const CallStackProfiles&)>; |
| + using CompletedCallback = Callback<void(CallStackProfiles)>; |
| // Creates a profiler that sends completed profiles to |callback|. The second |
| // constructor is for test purposes. |