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

Side by Side Diff: components/metrics/public/cpp/call_stack_profile_struct_traits_unittest.cc

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, 1 month 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 unified diff | Download patch
« no previous file with comments | « components/metrics/public/cpp/call_stack_profile.typemap ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <utility> 5 #include <utility>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "components/metrics/public/interfaces/call_stack_profile_collector_test .mojom.h" 10 #include "components/metrics/public/interfaces/call_stack_profile_collector_test .mojom.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 void BounceFrame(const base::StackSamplingProfiler::Frame& in, 42 void BounceFrame(const base::StackSamplingProfiler::Frame& in,
43 const BounceFrameCallback& callback) override { 43 const BounceFrameCallback& callback) override {
44 callback.Run(in); 44 callback.Run(in);
45 } 45 }
46 46
47 void BounceModule(const base::StackSamplingProfiler::Module& in, 47 void BounceModule(const base::StackSamplingProfiler::Module& in,
48 const BounceModuleCallback& callback) override { 48 const BounceModuleCallback& callback) override {
49 callback.Run(in); 49 callback.Run(in);
50 } 50 }
51 51
52 void BounceProfile(const base::StackSamplingProfiler::CallStackProfile& in, 52 void BounceProfile(base::StackSamplingProfiler::CallStackProfile in,
53 const BounceProfileCallback& callback) override { 53 const BounceProfileCallback& callback) override {
54 callback.Run(in); 54 callback.Run(std::move(in));
55 } 55 }
56 56
57 void BounceTrigger(CallStackProfileParams::Trigger in, 57 void BounceTrigger(CallStackProfileParams::Trigger in,
58 const BounceTriggerCallback& callback) override { 58 const BounceTriggerCallback& callback) override {
59 callback.Run(in); 59 callback.Run(in);
60 } 60 }
61 61
62 void BounceProcess(CallStackProfileParams::Process in, 62 void BounceProcess(CallStackProfileParams::Process in,
63 const BounceProcessCallback& callback) override { 63 const BounceProcessCallback& callback) override {
64 callback.Run(in); 64 callback.Run(in);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 base::TimeDelta::FromSeconds(2)), 256 base::TimeDelta::FromSeconds(2)),
257 false 257 false
258 }, 258 },
259 }; 259 };
260 260
261 for (const SerializeCase& input : serialize_cases) { 261 for (const SerializeCase& input : serialize_cases) {
262 SCOPED_TRACE(&input - &serialize_cases[0]); 262 SCOPED_TRACE(&input - &serialize_cases[0]);
263 263
264 Profile output; 264 Profile output;
265 EXPECT_EQ(input.expect_success, 265 EXPECT_EQ(input.expect_success,
266 proxy_->BounceProfile(input.profile, &output)); 266 proxy_->BounceProfile(input.profile.CopyForTesting(), &output));
267 267
268 if (!input.expect_success) 268 if (!input.expect_success)
269 continue; 269 continue;
270 270
271 EXPECT_EQ(input.profile.modules, output.modules); 271 EXPECT_EQ(input.profile.modules, output.modules);
272 EXPECT_EQ(input.profile.samples, output.samples); 272 EXPECT_EQ(input.profile.samples, output.samples);
273 EXPECT_EQ(input.profile.profile_duration, output.profile_duration); 273 EXPECT_EQ(input.profile.profile_duration, output.profile_duration);
274 EXPECT_EQ(input.profile.sampling_period, output.sampling_period); 274 EXPECT_EQ(input.profile.sampling_period, output.sampling_period);
275 } 275 }
276 } 276 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 CallStackProfileParams::PRESERVE_ORDER), 393 CallStackProfileParams::PRESERVE_ORDER),
394 &out)); 394 &out));
395 395
396 EXPECT_EQ(CallStackProfileParams::BROWSER_PROCESS, out.process); 396 EXPECT_EQ(CallStackProfileParams::BROWSER_PROCESS, out.process);
397 EXPECT_EQ(CallStackProfileParams::UI_THREAD, out.thread); 397 EXPECT_EQ(CallStackProfileParams::UI_THREAD, out.thread);
398 EXPECT_EQ(CallStackProfileParams::PROCESS_STARTUP, out.trigger); 398 EXPECT_EQ(CallStackProfileParams::PROCESS_STARTUP, out.trigger);
399 EXPECT_EQ(CallStackProfileParams::PRESERVE_ORDER, out.ordering_spec); 399 EXPECT_EQ(CallStackProfileParams::PRESERVE_ORDER, out.ordering_spec);
400 } 400 }
401 401
402 } // namespace metrics 402 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/public/cpp/call_stack_profile.typemap ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698