Chromium Code Reviews| Index: ppapi/proxy/nacl_message_scanner.h |
| diff --git a/ppapi/proxy/handle_converter.h b/ppapi/proxy/nacl_message_scanner.h |
| similarity index 37% |
| rename from ppapi/proxy/handle_converter.h |
| rename to ppapi/proxy/nacl_message_scanner.h |
| index 456ee8db71c83ceb4d7b9c97f1388e4e8f2f25ae..439c953b4c78e542b15c00b81c96b43347c2ab06 100644 |
| --- a/ppapi/proxy/handle_converter.h |
| +++ b/ppapi/proxy/nacl_message_scanner.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef PPAPI_PROXY_HANDLE_CONVERTER_H_ |
| -#define PPAPI_PROXY_HANDLE_CONVERTER_H_ |
| +#ifndef PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ |
| +#define PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ |
| #include <map> |
| #include <vector> |
| @@ -21,42 +21,41 @@ namespace proxy { |
| class SerializedHandle; |
| -class PPAPI_PROXY_EXPORT HandleConverter { |
| +class PPAPI_PROXY_EXPORT NaClMessageScanner { |
| public: |
| - HandleConverter(); |
| + NaClMessageScanner(); |
| - // Convert the native handles in |msg| to NaCl style. |
| - // In some cases (e.g., Windows), we need to re-write the contents of the |
| - // message; in those cases, |new_msg_ptr| will be set to the new message. |
| - // If |msg| is already in a good form for NaCl, |new_msg_ptr| is left NULL. |
| - // See the explanation in the body of the method. |
| + // Scans the message for parameters that require special processing. Copies |
| + // all SerializedHandles in the message into |handles|. |
| // |
| - // In either case, all the handles in |msg| are extracted into |handles| so |
| - // that they can be converted to NaClDesc handles. |
| - // See chrome/nacl/nacl_ipc_adapter.cc for where this gets used. |
| - bool ConvertNativeHandlesToPosix(const IPC::Message& msg, |
| - std::vector<SerializedHandle>* handles, |
| - scoped_ptr<IPC::Message>* new_msg_ptr); |
| - |
| - // This method informs HandleConverter that a sync message is being sent so |
| - // that it can associate reply messages with their type. |
| + // Translates the message if necessary (e.g. on Windows) and returns it in |
| + // |new_msg_ptr|. |
|
dmichael (off chromium)
2013/10/31 18:21:33
Shouldn't we point out that new_msg_ptr is left NU
bbudge
2013/11/01 00:34:45
Done.
|
| + // See more explanation in the body of the method. |
| // |
| - // Users of HandleConverter must call this when they send a synchronous |
| - // message, otherwise HandleConverter won't be able to convert handles in |
| - // replies. |
| + // See chrome/nacl/nacl_ipc_adapter.cc for where this is used to convert |
| + // native handles to NaClDescs. |
| + bool ScanMessage(const IPC::Message& msg, |
| + std::vector<SerializedHandle>* handles, |
| + scoped_ptr<IPC::Message>* new_msg_ptr); |
| + |
| + // This method informs NaClMessageScanner that a sync message is being sent |
| + // so that it can associate reply messages with their type. |
| + // |
| + // Users of NaClMessageScanner must call this when they send a synchronous |
| + // message, otherwise NaClMessageScanner won't scan replies. |
| void RegisterSyncMessageForReply(const IPC::Message& msg); |
| private: |
| // When we send a synchronous message (from untrusted to trusted), we store |
| // its type here, so that later we can associate the reply with its type |
| - // and potentially translate handles in the message. |
| + // for scanning. |
| typedef std::map<int, uint32> PendingSyncMsgMap; |
| PendingSyncMsgMap pending_sync_msgs_; |
| - DISALLOW_COPY_AND_ASSIGN(HandleConverter); |
| + DISALLOW_COPY_AND_ASSIGN(NaClMessageScanner); |
| }; |
| } // namespace proxy |
| } // namespace ppapi |
| -#endif // PPAPI_PROXY_HANDLE_CONVERTER_H_ |
| +#endif // PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ |