Index: ppapi/proxy/ppp_messaging_proxy_perftest.cc |
diff --git a/ppapi/proxy/ppp_messaging_proxy_perftest.cc b/ppapi/proxy/ppp_messaging_proxy_perftest.cc |
index 666609a51b36dff738a1e0c1b4ab3e2c52cdf7a9..c52651459497825ff5da4154b41735175e719192 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<const PPP_Messaging*>( |
- 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); |
} |