Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 11094060: Exclude host-side code from the NaCl IRT proxy build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.cc ('k') | ppapi/proxy/ppb_url_loader_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ppapi/proxy/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/pp_time.h" 9 #include "ppapi/c/pp_time.h"
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 &CreateInstanceProxy, 90 &CreateInstanceProxy,
91 }; 91 };
92 return &info; 92 return &info;
93 } 93 }
94 94
95 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { 95 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
96 // Prevent the dispatcher from going away during a call to ExecuteScript. 96 // Prevent the dispatcher from going away during a call to ExecuteScript.
97 // This must happen OUTSIDE of ExecuteScript since the SerializedVars use 97 // This must happen OUTSIDE of ExecuteScript since the SerializedVars use
98 // the dispatcher upon return of the function (converting the 98 // the dispatcher upon return of the function (converting the
99 // SerializedVarReturnValue/OutParam to a SerializedVar in the destructor). 99 // SerializedVarReturnValue/OutParam to a SerializedVar in the destructor).
100 #if !defined(OS_NACL)
100 ScopedModuleReference death_grip(dispatcher()); 101 ScopedModuleReference death_grip(dispatcher());
102 #endif
101 103
102 bool handled = true; 104 bool handled = true;
103 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) 105 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg)
106 #if !defined(OS_NACL)
104 // Plugin -> Host messages. 107 // Plugin -> Host messages.
105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, 108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject,
106 OnHostMsgGetWindowObject) 109 OnHostMsgGetWindowObject)
107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, 110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject,
108 OnHostMsgGetOwnerElementObject) 111 OnHostMsgGetOwnerElementObject)
109 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics,
110 OnHostMsgBindGraphics) 113 OnHostMsgBindGraphics)
111 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, 114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame,
112 OnHostMsgIsFullFrame) 115 OnHostMsgIsFullFrame)
113 IPC_MESSAGE_HANDLER( 116 IPC_MESSAGE_HANDLER(
(...skipping 25 matching lines...) Expand all
139 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor, 142 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor,
140 OnHostMsgSetCursor) 143 OnHostMsgSetCursor)
141 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType, 144 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType,
142 OnHostMsgSetTextInputType) 145 OnHostMsgSetTextInputType)
143 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition, 146 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition,
144 OnHostMsgUpdateCaretPosition) 147 OnHostMsgUpdateCaretPosition)
145 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText, 148 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText,
146 OnHostMsgCancelCompositionText) 149 OnHostMsgCancelCompositionText)
147 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText, 150 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText,
148 OnHostMsgUpdateSurroundingText) 151 OnHostMsgUpdateSurroundingText)
152 #endif // !defined(OS_NACL)
153 // This message is needed to implement PPB_Testing_Dev.
149 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, 154 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL,
150 OnHostMsgGetDocumentURL) 155 OnHostMsgGetDocumentURL)
151
152 #if !defined(OS_NACL) 156 #if !defined(OS_NACL)
153 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, 157 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument,
154 OnHostMsgResolveRelativeToDocument) 158 OnHostMsgResolveRelativeToDocument)
155 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, 159 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest,
156 OnHostMsgDocumentCanRequest) 160 OnHostMsgDocumentCanRequest)
157 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, 161 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument,
158 OnHostMsgDocumentCanAccessDocument) 162 OnHostMsgDocumentCanAccessDocument)
159 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, 163 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL,
160 OnHostMsgGetPluginInstanceURL) 164 OnHostMsgGetPluginInstanceURL)
161 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, 165 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey,
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 } 781 }
778 782
779 void PPB_Instance_Proxy::UpdateSurroundingText(PP_Instance instance, 783 void PPB_Instance_Proxy::UpdateSurroundingText(PP_Instance instance,
780 const char* text, 784 const char* text,
781 uint32_t caret, 785 uint32_t caret,
782 uint32_t anchor) { 786 uint32_t anchor) {
783 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UpdateSurroundingText( 787 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UpdateSurroundingText(
784 API_ID_PPB_INSTANCE, instance, text, caret, anchor)); 788 API_ID_PPB_INSTANCE, instance, text, caret, anchor));
785 } 789 }
786 790
791 #if !defined(OS_NACL)
787 void PPB_Instance_Proxy::OnHostMsgGetWindowObject( 792 void PPB_Instance_Proxy::OnHostMsgGetWindowObject(
788 PP_Instance instance, 793 PP_Instance instance,
789 SerializedVarReturnValue result) { 794 SerializedVarReturnValue result) {
790 EnterInstanceNoLock enter(instance); 795 EnterInstanceNoLock enter(instance);
791 if (enter.succeeded()) 796 if (enter.succeeded())
792 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance)); 797 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance));
793 } 798 }
794 799
795 void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject( 800 void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject(
796 PP_Instance instance, 801 PP_Instance instance,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 EnterInstanceNoLock enter(instance, cb.pp_completion_callback()); 925 EnterInstanceNoLock enter(instance, cb.pp_completion_callback());
921 if (enter.succeeded()) 926 if (enter.succeeded())
922 enter.SetResult(enter.functions()->LockMouse(instance, enter.callback())); 927 enter.SetResult(enter.functions()->LockMouse(instance, enter.callback()));
923 } 928 }
924 929
925 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) { 930 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) {
926 EnterInstanceNoLock enter(instance); 931 EnterInstanceNoLock enter(instance);
927 if (enter.succeeded()) 932 if (enter.succeeded())
928 enter.functions()->UnlockMouse(instance); 933 enter.functions()->UnlockMouse(instance);
929 } 934 }
935 #endif // !defined(OS_NACL)
930 936
931 void PPB_Instance_Proxy::OnHostMsgGetDocumentURL( 937 void PPB_Instance_Proxy::OnHostMsgGetDocumentURL(
932 PP_Instance instance, 938 PP_Instance instance,
933 PP_URLComponents_Dev* components, 939 PP_URLComponents_Dev* components,
934 SerializedVarReturnValue result) { 940 SerializedVarReturnValue result) {
935 EnterInstanceNoLock enter(instance); 941 EnterInstanceNoLock enter(instance);
936 if (enter.succeeded()) { 942 if (enter.succeeded()) {
937 PP_Var document_url = enter.functions()->GetDocumentURL(instance, 943 PP_Var document_url = enter.functions()->GetDocumentURL(instance,
938 components); 944 components);
939 result.Return(dispatcher(), document_url); 945 result.Return(dispatcher(), document_url);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 PP_Resource audio_frames, 1110 PP_Resource audio_frames,
1105 const std::string& serialized_block_info) { 1111 const std::string& serialized_block_info) {
1106 PP_DecryptedBlockInfo block_info; 1112 PP_DecryptedBlockInfo block_info;
1107 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) 1113 if (!DeserializeBlockInfo(serialized_block_info, &block_info))
1108 return; 1114 return;
1109 1115
1110 EnterInstanceNoLock enter(instance); 1116 EnterInstanceNoLock enter(instance);
1111 if (enter.succeeded()) 1117 if (enter.succeeded())
1112 enter.functions()->DeliverSamples(instance, audio_frames, &block_info); 1118 enter.functions()->DeliverSamples(instance, audio_frames, &block_info);
1113 } 1119 }
1114 #endif // !defined(OS_NACL)
1115 1120
1116 void PPB_Instance_Proxy::OnHostMsgSetCursor( 1121 void PPB_Instance_Proxy::OnHostMsgSetCursor(
1117 PP_Instance instance, 1122 PP_Instance instance,
1118 int32_t type, 1123 int32_t type,
1119 const ppapi::HostResource& custom_image, 1124 const ppapi::HostResource& custom_image,
1120 const PP_Point& hot_spot) { 1125 const PP_Point& hot_spot) {
1121 EnterInstanceNoLock enter(instance); 1126 EnterInstanceNoLock enter(instance);
1122 if (enter.succeeded()) { 1127 if (enter.succeeded()) {
1123 enter.functions()->SetCursor( 1128 enter.functions()->SetCursor(
1124 instance, static_cast<PP_MouseCursor_Type>(type), 1129 instance, static_cast<PP_MouseCursor_Type>(type),
(...skipping 27 matching lines...) Expand all
1152 PP_Instance instance, 1157 PP_Instance instance,
1153 const std::string& text, 1158 const std::string& text,
1154 uint32_t caret, 1159 uint32_t caret,
1155 uint32_t anchor) { 1160 uint32_t anchor) {
1156 EnterInstanceNoLock enter(instance); 1161 EnterInstanceNoLock enter(instance);
1157 if (enter.succeeded()) { 1162 if (enter.succeeded()) {
1158 enter.functions()->UpdateSurroundingText(instance, text.c_str(), caret, 1163 enter.functions()->UpdateSurroundingText(instance, text.c_str(), caret,
1159 anchor); 1164 anchor);
1160 } 1165 }
1161 } 1166 }
1167 #endif // !defined(OS_NACL)
1162 1168
1163 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance, 1169 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance,
1164 int32_t result) { 1170 int32_t result) {
1165 // Save the mouse callback on the instance data. 1171 // Save the mouse callback on the instance data.
1166 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1172 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1167 GetInstanceData(instance); 1173 GetInstanceData(instance);
1168 if (!data) 1174 if (!data)
1169 return; // Instance was probably deleted. 1175 return; // Instance was probably deleted.
1170 if (!TrackedCallback::IsPending(data->mouse_lock_callback)) { 1176 if (!TrackedCallback::IsPending(data->mouse_lock_callback)) {
1171 NOTREACHED(); 1177 NOTREACHED();
1172 return; 1178 return;
1173 } 1179 }
1174 data->mouse_lock_callback->Run(result); 1180 data->mouse_lock_callback->Run(result);
1175 } 1181 }
1176 1182
1183 #if !defined(OS_NACL)
1177 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, 1184 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result,
1178 PP_Instance instance) { 1185 PP_Instance instance) {
1179 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( 1186 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete(
1180 API_ID_PPB_INSTANCE, instance, result)); 1187 API_ID_PPB_INSTANCE, instance, result));
1181 } 1188 }
1189 #endif // !defined(OS_NACL)
1182 1190
1183 void PPB_Instance_Proxy::CancelAnyPendingRequestSurroundingText( 1191 void PPB_Instance_Proxy::CancelAnyPendingRequestSurroundingText(
1184 PP_Instance instance) { 1192 PP_Instance instance) {
1185 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1193 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1186 GetInstanceData(instance); 1194 GetInstanceData(instance);
1187 if (!data) 1195 if (!data)
1188 return; // Instance was probably deleted. 1196 return; // Instance was probably deleted.
1189 data->should_do_request_surrounding_text = false; 1197 data->should_do_request_surrounding_text = false;
1190 } 1198 }
1191 1199
1192 } // namespace proxy 1200 } // namespace proxy
1193 } // namespace ppapi 1201 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.cc ('k') | ppapi/proxy/ppb_url_loader_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698