diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-20 19:55:39 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-20 19:55:39 +0000 |
commit | 13a8f498151ac4e1e771cb3d70d56f38848be04a (patch) | |
tree | a751efce3637a6705caf9dd526574855e0fc09c8 /ppapi/proxy | |
parent | 40e67ab32b12fbcbbbca4cd0764c9796918e82ae (diff) | |
download | chromium_src-13a8f498151ac4e1e771cb3d70d56f38848be04a.zip chromium_src-13a8f498151ac4e1e771cb3d70d56f38848be04a.tar.gz chromium_src-13a8f498151ac4e1e771cb3d70d56f38848be04a.tar.bz2 |
Reland http://codereview.chromium.org/7452002/ again
Update chromoting input events. (Clang caught this. Thanks, Clang!)
Note I'm leaving in temporary backwards-compatibility.
BUG=None
TEST=ppapi tests
TBR=brettw,sergeyu
Review URL: http://codereview.chromium.org/7466008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/dispatcher.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.cc | 24 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.h | 9 | ||||
-rw-r--r-- | ppapi/proxy/ppp_instance_proxy.cc | 34 | ||||
-rw-r--r-- | ppapi/proxy/ppp_instance_proxy.h | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppp_instance_proxy_test.cc | 35 |
7 files changed, 14 insertions, 102 deletions
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index 69e16ac..5de70c0 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -165,7 +165,7 @@ InterfaceList::InterfaceList() { AddPPP(PPP_Graphics3D_Proxy::GetInfo()); AddPPP(PPP_InputEvent_Proxy::GetInfo()); AddPPP(PPP_Instance_Private_Proxy::GetInfo()); - AddPPP(PPP_Instance_Proxy::GetInfo0_5()); + AddPPP(PPP_Instance_Proxy::GetInfo1_0()); } void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 41853ae..f4739e8 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -293,10 +293,6 @@ IPC_MESSAGE_ROUTED4(PpapiMsg_PPPInstance_DidChangeView, IPC_MESSAGE_ROUTED2(PpapiMsg_PPPInstance_DidChangeFocus, PP_Instance /* instance */, PP_Bool /* has_focus */) -IPC_SYNC_MESSAGE_ROUTED2_1(PpapiMsg_PPPInstance_HandleInputEvent, - PP_Instance /* instance */, - PP_InputEvent /* event */, - PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiMsg_PPPInstance_HandleDocumentLoad, PP_Instance /* instance */, pp::proxy::HostResource /* url_loader */, diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index 87c253b..29e51bb 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -171,30 +171,6 @@ void ParamTraits<PP_Flash_NetAddress>::Log(const param_type& p, l->append(" bytes)>"); } -// PP_InputEvent --------------------------------------------------------------- - -// static -void ParamTraits<PP_InputEvent>::Write(Message* m, const param_type& p) { - // PP_InputEvent is just POD so we can just memcpy it. - m->WriteData(reinterpret_cast<const char*>(&p), sizeof(PP_InputEvent)); -} - -// static -bool ParamTraits<PP_InputEvent>::Read(const Message* m, - void** iter, - param_type* r) { - const char* data; - int data_size; - if (!m->ReadData(iter, &data, &data_size)) - return false; - memcpy(r, data, sizeof(PP_InputEvent)); - return true; -} - -// static -void ParamTraits<PP_InputEvent>::Log(const param_type& p, std::string* l) { -} - // PP_ObjectProperty ----------------------------------------------------------- // static diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index 0db47cd..736120f 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -11,7 +11,6 @@ #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" #include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_input_event.h" #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_var.h" @@ -62,14 +61,6 @@ struct ParamTraits<PP_Flash_NetAddress> { }; template<> -struct ParamTraits<PP_InputEvent> { - typedef PP_InputEvent param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template<> struct ParamTraits<PP_ObjectProperty> { typedef PP_ObjectProperty param_type; static void Write(Message* m, const param_type& p); diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index 99dcaab..cc2f9db 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -65,21 +65,6 @@ void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { instance, has_focus)); } -PP_Bool HandleInputEvent(PP_Instance instance, - const PP_InputEvent* event) { - PP_Bool result = PP_FALSE; - IPC::Message* msg = new PpapiMsg_PPPInstance_HandleInputEvent( - INTERFACE_ID_PPP_INSTANCE, instance, *event, &result); - // Make this message not unblock, to avoid re-entrancy problems when the - // plugin does a synchronous call to the renderer. This will force any - // synchronous calls from the plugin to complete before processing this - // message. We avoid deadlock by never un-setting the unblock flag on messages - // from the plugin to the renderer. - msg->set_unblock(false); - HostDispatcher::GetForInstance(instance)->Send(msg); - return result; -} - PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) { PP_Bool result = PP_FALSE; @@ -112,12 +97,11 @@ PP_Bool HandleDocumentLoad(PP_Instance instance, return result; } -static const PPP_Instance_0_5 instance_interface_0_5 = { +static const PPP_Instance_1_0 instance_interface_1_0 = { &DidCreate, &DidDestroy, &DidChangeView, &DidChangeFocus, - &HandleInputEvent, &HandleDocumentLoad }; @@ -135,13 +119,13 @@ PPP_Instance_Proxy::~PPP_Instance_Proxy() { } // static -const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo0_5() { +const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() { static const Info info = { - &instance_interface_0_5, - PPP_INSTANCE_INTERFACE_0_5, + &instance_interface_1_0, + PPP_INSTANCE_INTERFACE_1_0, INTERFACE_ID_PPP_INSTANCE, false, - &CreateInstanceProxy<PPP_Instance_0_5>, + &CreateInstanceProxy<PPP_Instance_1_0>, }; return &info; } @@ -157,8 +141,6 @@ bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgDidChangeView) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeFocus, OnMsgDidChangeFocus) - IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_HandleInputEvent, - OnMsgHandleInputEvent) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_HandleDocumentLoad, OnMsgHandleDocumentLoad) IPC_MESSAGE_UNHANDLED(handled = false) @@ -224,12 +206,6 @@ void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance, combined_interface_->DidChangeFocus(instance, has_focus); } -void PPP_Instance_Proxy::OnMsgHandleInputEvent(PP_Instance instance, - const PP_InputEvent& event, - PP_Bool* result) { - *result = combined_interface_->HandleInputEvent(instance, &event); -} - void PPP_Instance_Proxy::OnMsgHandleDocumentLoad(PP_Instance instance, const HostResource& url_loader, PP_Bool* result) { diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h index 9448332..b246c5c 100644 --- a/ppapi/proxy/ppp_instance_proxy.h +++ b/ppapi/proxy/ppp_instance_proxy.h @@ -16,7 +16,6 @@ #include "ppapi/proxy/interface_proxy.h" #include "ppapi/shared_impl/ppp_instance_combined.h" -struct PP_InputEvent; struct PP_Rect; namespace pp { @@ -35,8 +34,8 @@ class PPP_Instance_Proxy : public InterfaceProxy { } virtual ~PPP_Instance_Proxy(); - // Return the info for the 0.5 (latest, canonical) version of the interface. - static const Info* GetInfo0_5(); + // Return the info for the 1.0 (latest, canonical) version of the interface. + static const Info* GetInfo1_0(); ::ppapi::PPP_Instance_Combined* ppp_instance_target() const { return combined_interface_.get(); @@ -57,9 +56,6 @@ class PPP_Instance_Proxy : public InterfaceProxy { const PP_Rect& clip, PP_Bool fullscreen); void OnMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus); - void OnMsgHandleInputEvent(PP_Instance instance, - const PP_InputEvent& event, - PP_Bool* result); void OnMsgHandleDocumentLoad(PP_Instance instance, const HostResource& url_loader, PP_Bool* result); diff --git a/ppapi/proxy/ppp_instance_proxy_test.cc b/ppapi/proxy/ppp_instance_proxy_test.cc index 00d776b..c49f1a2 100644 --- a/ppapi/proxy/ppp_instance_proxy_test.cc +++ b/ppapi/proxy/ppp_instance_proxy_test.cc @@ -60,13 +60,6 @@ void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { did_change_focus_called.Signal(); } -PP_InputEvent received_event; -PP_Bool HandleInputEvent(PP_Instance instance, const PP_InputEvent* event) { - received_instance = instance; - memcpy(&received_event, event, sizeof(*event));; - return bool_to_return; -} - PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) { // This one requires use of the PPB_URLLoader proxy and PPB_Core, plus a // resource tracker for the url_loader resource. @@ -92,15 +85,13 @@ void ResetReceived() { memset(&received_position, 0, sizeof(received_position)); memset(&received_clip, 0, sizeof(received_clip)); received_has_focus = PP_FALSE; - memset(&received_event, 0, sizeof(received_event)); } -PPP_Instance_0_5 ppp_instance_0_5 = { +PPP_Instance_1_0 ppp_instance_1_0 = { &DidCreate, &DidDestroy, &DidChangeView, &DidChangeFocus, - &HandleInputEvent, &HandleDocumentLoad }; @@ -120,15 +111,15 @@ class PPP_Instance_ProxyTest : public TwoWayTest { } }; -TEST_F(PPP_Instance_ProxyTest, PPPInstance0_5) { - plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_0_5, &ppp_instance_0_5); +TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) { + plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_1_0, &ppp_instance_1_0); host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE, &ppb_fullscreen_dev); - // Grab the host-side proxy for the 0.5 interface. - const PPP_Instance_0_5* ppp_instance = static_cast<const PPP_Instance_0_5*>( + // Grab the host-side proxy for the 1.0 interface. + const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( host().host_dispatcher()->GetProxiedInterface( - PPP_INSTANCE_INTERFACE_0_5)); + PPP_INSTANCE_INTERFACE_1_0)); // Call each function in turn, make sure we get the expected values and // returns. @@ -183,20 +174,6 @@ TEST_F(PPP_Instance_ProxyTest, PPPInstance0_5) { EXPECT_EQ(received_instance, expected_instance); EXPECT_EQ(received_has_focus, expected_has_focus); - PP_InputEvent expected_event = { PP_INPUTEVENT_TYPE_KEYDOWN, // type - 0, // padding - 1.0, // time_stamp - { { 2, 3 } } }; // u (as PP_InputEvent_Key) - ResetReceived(); - EXPECT_EQ(bool_to_return, - ppp_instance->HandleInputEvent(expected_instance, &expected_event)); - EXPECT_EQ(received_instance, expected_instance); - ASSERT_EQ(received_event.type, expected_event.type); - // Ignore padding; it's okay if it's not serialized. - EXPECT_EQ(received_event.time_stamp, expected_event.time_stamp); - EXPECT_EQ(received_event.u.key.modifier, expected_event.u.key.modifier); - EXPECT_EQ(received_event.u.key.key_code, expected_event.u.key.key_code); - // TODO(dmichael): Need to mock out a resource Tracker to be able to test // HandleResourceLoad. It also requires // PPB_Core.AddRefResource and for PPB_URLLoader to be |