Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: components/metrics/child_call_stack_profile_collector.h

Issue 2438073002: Use movable types for CallStackProfile(s) to remove copying of data. (Closed)
Patch Set: added some comments about std::move Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/metrics/child_call_stack_profile_collector.h
diff --git a/components/metrics/child_call_stack_profile_collector.h b/components/metrics/child_call_stack_profile_collector.h
index adc356d110f55322bd0dbbea304c5fb5d1dbd0f6..63eef6839d8fdb867fa1629bf002ba8cbe14e9d9 100644
--- a/components/metrics/child_call_stack_profile_collector.h
+++ b/components/metrics/child_call_stack_profile_collector.h
@@ -65,28 +65,34 @@ class ChildCallStackProfileCollector {
friend class ChildCallStackProfileCollectorTest;
// Bundles together a set of collected profiles and the collection state for
- // storage, pending availability of the parent mojo interface.
+ // storage, pending availability of the parent mojo interface. |profiles|
+ // is not const& because it must be passed with std::move.
struct ProfilesState {
ProfilesState();
- ProfilesState(const ProfilesState&);
+ ProfilesState(ProfilesState&&);
ProfilesState(
const CallStackProfileParams& params,
base::TimeTicks start_timestamp,
- const base::StackSamplingProfiler::CallStackProfiles& profiles);
+ base::StackSamplingProfiler::CallStackProfiles profiles);
~ProfilesState();
+ ProfilesState& operator=(ProfilesState&&);
+
CallStackProfileParams params;
base::TimeTicks start_timestamp;
// The sampled profiles.
base::StackSamplingProfiler::CallStackProfiles profiles;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ProfilesState);
};
using CallStackProfile = base::StackSamplingProfiler::CallStackProfile;
void Collect(const CallStackProfileParams& params,
base::TimeTicks start_timestamp,
- const std::vector<CallStackProfile>& profiles);
+ std::vector<CallStackProfile> profiles);
// This object may be accessed on any thread, including the profiler
// thread. The expected use case for the object is to be created and have

Powered by Google App Engine
This is Rietveld 408576698