| OLD | NEW |
| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
| 7 #include "base/test/perftimer.h" | 7 #include "base/test/perf_time_logger.h" |
| 8 #include "ppapi/c/ppp_messaging.h" | 8 #include "ppapi/c/ppp_messaging.h" |
| 9 #include "ppapi/proxy/ppapi_proxy_test.h" | 9 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 10 #include "ppapi/proxy/serialized_var.h" | 10 #include "ppapi/proxy/serialized_var.h" |
| 11 #include "ppapi/shared_impl/ppapi_globals.h" | 11 #include "ppapi/shared_impl/ppapi_globals.h" |
| 12 #include "ppapi/shared_impl/var.h" | 12 #include "ppapi/shared_impl/var.h" |
| 13 #include "ppapi/shared_impl/var_tracker.h" | 13 #include "ppapi/shared_impl/var_tracker.h" |
| 14 | 14 |
| 15 namespace ppapi { | 15 namespace ppapi { |
| 16 namespace proxy { | 16 namespace proxy { |
| 17 namespace { | 17 namespace { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (command_line->HasSwitch("string_count")) { | 66 if (command_line->HasSwitch("string_count")) { |
| 67 base::StringToInt(command_line->GetSwitchValueASCII("string_count"), | 67 base::StringToInt(command_line->GetSwitchValueASCII("string_count"), |
| 68 &string_count); | 68 &string_count); |
| 69 } | 69 } |
| 70 if (command_line->HasSwitch("max_string_size")) { | 70 if (command_line->HasSwitch("max_string_size")) { |
| 71 base::StringToInt(command_line->GetSwitchValueASCII("max_string_size"), | 71 base::StringToInt(command_line->GetSwitchValueASCII("max_string_size"), |
| 72 &max_string_size); | 72 &max_string_size); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 srand(seed); | 75 srand(seed); |
| 76 PerfTimeLogger logger("PppMessagingPerfTest.StringPerformance"); | 76 base::PerfTimeLogger logger("PppMessagingPerfTest.StringPerformance"); |
| 77 for (int i = 0; i < string_count; ++i) { | 77 for (int i = 0; i < string_count; ++i) { |
| 78 const std::string test_string(rand() % max_string_size, 'a'); | 78 const std::string test_string(rand() % max_string_size, 'a'); |
| 79 PP_Var host_string = StringVar::StringToPPVar(test_string); | 79 PP_Var host_string = StringVar::StringToPPVar(test_string); |
| 80 ppp_messaging->HandleMessage(kTestInstance, host_string); | 80 ppp_messaging->HandleMessage(kTestInstance, host_string); |
| 81 handle_message_called.Wait(); | 81 handle_message_called.Wait(); |
| 82 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(host_string); | 82 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(host_string); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace proxy | 86 } // namespace proxy |
| 87 } // namespace ppapi | 87 } // namespace ppapi |
| 88 | 88 |
| OLD | NEW |