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

Unified Diff: ppapi/proxy/nacl_message_scanner.cc

Issue 1512733003: PNaCl: Use Chrome IPC to talk to the linker process, instead of SRPC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/nacl_irt/irt_pnacl_translator_link.cc ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/nacl_message_scanner.cc
diff --git a/ppapi/proxy/nacl_message_scanner.cc b/ppapi/proxy/nacl_message_scanner.cc
index c95287efc03c07be3a0af0c655a2c9663af16b0a..5011501cf98a6ffac28e2a11b7f7219e0a7ec20f 100644
--- a/ppapi/proxy/nacl_message_scanner.cc
+++ b/ppapi/proxy/nacl_message_scanner.cc
@@ -143,6 +143,15 @@ void ScanParam(const IPC::Message& param, ScanningResults* results) {
IPC::WriteParam(results->new_msg.get(), param);
}
+template <class T>
+void ScanParam(const std::vector<T>& vec, ScanningResults* results) {
+ if (results->new_msg)
+ IPC::WriteParam(results->new_msg.get(), static_cast<int>(vec.size()));
+ for (const T& element : vec) {
+ ScanParam(element, results);
+ }
+}
+
// Overload to match all other types. If we need to rewrite the message, write
// the parameter.
template <class T>
@@ -192,6 +201,21 @@ class MessageScannerImpl {
return true;
}
+ bool ScanSyncMessage(ScanningResults* results) {
+ typename base::TupleTypes<typename MessageType::Schema::SendParam>
+ ::ValueTuple params;
+ if (!MessageType::ReadSendParam(msg_, &params))
+ return false;
+ // If we need to rewrite the message, write the message id first.
+ if (results->new_msg) {
+ results->new_msg->set_sync();
+ int id = IPC::SyncMessage::GetMessageId(*msg_);
+ results->new_msg->WriteInt(id);
+ }
+ ScanTuple(params, results);
+ return true;
+ }
+
bool ScanReply(ScanningResults* results) {
typename base::TupleTypes<typename MessageType::Schema::ReplyParam>
::ValueTuple params;
@@ -206,8 +230,6 @@ class MessageScannerImpl {
ScanTuple(params, results);
return true;
}
- // TODO(dmichael): Add ScanSyncMessage for outgoing sync messages, if we ever
- // need to scan those.
private:
const MessageType* msg_;
@@ -226,6 +248,17 @@ class MessageScannerImpl {
return false; \
break; \
}
+#define CASE_FOR_SYNC_MESSAGE(MESSAGE_TYPE) \
+ case MESSAGE_TYPE::ID: { \
+ MessageScannerImpl<MESSAGE_TYPE> scanner(&msg); \
+ if (rewrite_msg) \
+ results.new_msg.reset( \
+ new IPC::Message(msg.routing_id(), msg.type(), \
+ IPC::Message::PRIORITY_NORMAL)); \
+ if (!scanner.ScanSyncMessage(&results)) \
+ return false; \
+ break; \
+ }
#define CASE_FOR_REPLY(MESSAGE_TYPE) \
case MESSAGE_TYPE::ID: { \
MessageScannerImpl<MESSAGE_TYPE> scanner(&msg); \
@@ -331,6 +364,7 @@ bool NaClMessageScanner::ScanMessage(
CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated)
CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage)
CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply)
+ CASE_FOR_SYNC_MESSAGE(PpapiMsg_PnaclTranslatorLink)
CASE_FOR_REPLY(PpapiHostMsg_OpenResource)
CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_Create)
CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer)
« no previous file with comments | « ppapi/nacl_irt/irt_pnacl_translator_link.cc ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698