From 433c2212293eacb15969337e01d51b8c062d8c5b Mon Sep 17 00:00:00 2001 From: "dmichael@chromium.org" Date: Fri, 8 Aug 2014 21:13:00 +0000 Subject: PPAPI: Revive ppp_messaging_proxy_perftest This test can measure PPP_Messaging performance and indirectly IPC performance. It regressed due to a couple of minor changes; this gets it running again. BUG= Review URL: https://codereview.chromium.org/453003002 Cr-Commit-Position: refs/heads/master@{#288433} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288433 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/proxy/ppp_messaging_proxy_perftest.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'ppapi') diff --git a/ppapi/proxy/ppp_messaging_proxy_perftest.cc b/ppapi/proxy/ppp_messaging_proxy_perftest.cc index 666609a..c526514 100644 --- a/ppapi/proxy/ppp_messaging_proxy_perftest.cc +++ b/ppapi/proxy/ppp_messaging_proxy_perftest.cc @@ -6,9 +6,11 @@ #include "base/strings/string_number_conversions.h" #include "base/test/perf_time_logger.h" #include "ppapi/c/ppp_messaging.h" +#include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_proxy_test.h" #include "ppapi/proxy/serialized_var.h" #include "ppapi/shared_impl/ppapi_globals.h" +#include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/shared_impl/var.h" #include "ppapi/shared_impl/var_tracker.h" @@ -19,6 +21,7 @@ namespace { base::WaitableEvent handle_message_called(false, false); void HandleMessage(PP_Instance /* instance */, PP_Var message_data) { + ppapi::ProxyAutoLock lock; StringVar* string_var = StringVar::FromPPVar(message_data); DCHECK(string_var); // Retrieve the string to make sure the proxy can't "optimize away" sending @@ -49,10 +52,6 @@ class PppMessagingPerfTest : public TwoWayTest { // Tests the performance of sending strings through the proxy. TEST_F(PppMessagingPerfTest, StringPerformance) { - // Grab the host-side proxy of ppp_messaging. - const PPP_Messaging* ppp_messaging = static_cast( - host().host_dispatcher()->GetProxiedInterface( - PPP_MESSAGING_INTERFACE)); const PP_Instance kTestInstance = pp_instance(); int seed = 123; int string_count = 1000; @@ -77,7 +76,13 @@ TEST_F(PppMessagingPerfTest, StringPerformance) { for (int i = 0; i < string_count; ++i) { const std::string test_string(rand() % max_string_size, 'a'); PP_Var host_string = StringVar::StringToPPVar(test_string); - ppp_messaging->HandleMessage(kTestInstance, host_string); + // We don't have a host-side PPP_Messaging interface; just send the message + // directly like the proxy does. + host().host_dispatcher()->Send(new PpapiMsg_PPPMessaging_HandleMessage( + ppapi::API_ID_PPP_MESSAGING, + kTestInstance, + ppapi::proxy::SerializedVarSendInput(host().host_dispatcher(), + host_string))); handle_message_called.Wait(); PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(host_string); } -- cgit v1.1