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

Side by Side Diff: testing/multiprocess_func_list.cc

Issue 2001093008: Cleanup: Pass std::string as const reference from testing/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « testing/multiprocess_func_list.h ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "multiprocess_func_list.h" 5 #include "multiprocess_func_list.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 // Helper functions to maintain mapping of "test name"->test func. 9 // Helper functions to maintain mapping of "test name"->test func.
10 // The information is accessed via a global map. 10 // The information is accessed via a global map.
(...skipping 22 matching lines...) Expand all
33 } // namespace 33 } // namespace
34 34
35 AppendMultiProcessTest::AppendMultiProcessTest( 35 AppendMultiProcessTest::AppendMultiProcessTest(
36 std::string test_name, 36 std::string test_name,
37 TestMainFunctionPtr main_func_ptr, 37 TestMainFunctionPtr main_func_ptr,
38 SetupFunctionPtr setup_func_ptr) { 38 SetupFunctionPtr setup_func_ptr) {
39 GetMultiprocessFuncMap()[test_name] = 39 GetMultiprocessFuncMap()[test_name] =
40 ProcessFunctions(main_func_ptr, setup_func_ptr); 40 ProcessFunctions(main_func_ptr, setup_func_ptr);
41 } 41 }
42 42
43 int InvokeChildProcessTest(std::string test_name) { 43 int InvokeChildProcessTest(const std::string& test_name) {
44 MultiProcessTestMap& func_lookup_table = GetMultiprocessFuncMap(); 44 MultiProcessTestMap& func_lookup_table = GetMultiprocessFuncMap();
45 MultiProcessTestMap::iterator it = func_lookup_table.find(test_name); 45 MultiProcessTestMap::iterator it = func_lookup_table.find(test_name);
46 if (it != func_lookup_table.end()) { 46 if (it != func_lookup_table.end()) {
47 const ProcessFunctions& process_functions = it->second; 47 const ProcessFunctions& process_functions = it->second;
48 if (process_functions.setup) 48 if (process_functions.setup)
49 (*process_functions.setup)(); 49 (*process_functions.setup)();
50 if (process_functions.main) 50 if (process_functions.main)
51 return (*process_functions.main)(); 51 return (*process_functions.main)();
52 } 52 }
53 53
54 return -1; 54 return -1;
55 } 55 }
56 56
57 } // namespace multi_process_function_list 57 } // namespace multi_process_function_list
OLDNEW
« no previous file with comments | « testing/multiprocess_func_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698