summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-08 21:13:00 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-08 21:14:04 +0000
commit433c2212293eacb15969337e01d51b8c062d8c5b (patch)
treecd12e6fe3d12f9853bff97d222f7d0fba190e464 /ppapi
parenta8162665f9b05c9debb11be793e10dabd37e14ec (diff)
downloadchromium_src-433c2212293eacb15969337e01d51b8c062d8c5b.zip
chromium_src-433c2212293eacb15969337e01d51b8c062d8c5b.tar.gz
chromium_src-433c2212293eacb15969337e01d51b8c062d8c5b.tar.bz2
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
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/ppp_messaging_proxy_perftest.cc15
1 files changed, 10 insertions, 5 deletions
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<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);
}