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

Side by Side Diff: base/profiler/stack_sampling_profiler_unittest.cc

Issue 2438073002: Use movable types for CallStackProfile(s) to remove copying of data. (Closed)
Patch Set: fix tests and build problems 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <cstdlib> 8 #include <cstdlib>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 ::GetLastError() != ERROR_MOD_NOT_FOUND) { 302 ::GetLastError() != ERROR_MOD_NOT_FOUND) {
303 PlatformThread::Sleep(TimeDelta::FromMilliseconds(1)); 303 PlatformThread::Sleep(TimeDelta::FromMilliseconds(1));
304 } 304 }
305 #else 305 #else
306 NOTIMPLEMENTED(); 306 NOTIMPLEMENTED();
307 #endif 307 #endif
308 } 308 }
309 309
310 // Called on the profiler thread when complete, to collect profiles. 310 // Called on the profiler thread when complete, to collect profiles.
311 void SaveProfiles(CallStackProfiles* profiles, 311 void SaveProfiles(CallStackProfiles* profiles,
312 const CallStackProfiles& pending_profiles) { 312 CallStackProfiles pending_profiles) {
313 *profiles = pending_profiles; 313 *profiles = std::move(pending_profiles);
Mike Wittman 2016/10/21 18:05:29 IWYU: <utility> ... and throughout this CL
bcwhite 2016/10/24 13:17:45 Done.
314 } 314 }
315 315
316 // Called on the profiler thread when complete. Collects profiles produced by 316 // Called on the profiler thread when complete. Collects profiles produced by
317 // the profiler, and signals an event to allow the main thread to know that that 317 // the profiler, and signals an event to allow the main thread to know that that
318 // the profiler is done. 318 // the profiler is done.
319 void SaveProfilesAndSignalEvent(CallStackProfiles* profiles, 319 void SaveProfilesAndSignalEvent(CallStackProfiles* profiles,
320 WaitableEvent* event, 320 WaitableEvent* event,
321 const CallStackProfiles& pending_profiles) { 321 CallStackProfiles pending_profiles) {
322 *profiles = pending_profiles; 322 *profiles = std::move(pending_profiles);
323 event->Signal(); 323 event->Signal();
324 } 324 }
325 325
326 // Executes the function with the target thread running and executing within 326 // Executes the function with the target thread running and executing within
327 // SignalAndWaitUntilSignaled(). Performs all necessary target thread startup 327 // SignalAndWaitUntilSignaled(). Performs all necessary target thread startup
328 // and shutdown work before and afterward. 328 // and shutdown work before and afterward.
329 template <class Function> 329 template <class Function>
330 void WithTargetThread(Function function, 330 void WithTargetThread(Function function,
331 const StackConfiguration& stack_config) { 331 const StackConfiguration& stack_config) {
332 TargetThread target_thread(stack_config); 332 TargetThread target_thread(stack_config);
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED) 976 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED)
977 #define MAYBE_UnloadedLibrary UnloadedLibrary 977 #define MAYBE_UnloadedLibrary UnloadedLibrary
978 #else 978 #else
979 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary 979 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary
980 #endif 980 #endif
981 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) { 981 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) {
982 TestLibraryUnload(true); 982 TestLibraryUnload(true);
983 } 983 }
984 984
985 } // namespace base 985 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698