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

Unified Diff: ppapi/proxy/nacl_message_scanner.h

Issue 53123002: Rename HandleConverter to NaClMessageScanner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
Index: ppapi/proxy/nacl_message_scanner.h
diff --git a/ppapi/proxy/nacl_message_scanner.h b/ppapi/proxy/nacl_message_scanner.h
new file mode 100644
index 0000000000000000000000000000000000000000..439c953b4c78e542b15c00b81c96b43347c2ab06
--- /dev/null
+++ b/ppapi/proxy/nacl_message_scanner.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
Mark Seaborn 2013/10/30 20:05:31 Can you use "git cl upload --similarity=..." to ge
bbudge 2013/10/30 21:02:49 Ah, thanks, I'll give that a try next upload.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_
+#define PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_
+
+#include <map>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace proxy {
+
+class SerializedHandle;
+
+class PPAPI_PROXY_EXPORT NaClMessageScanner {
+ public:
+ NaClMessageScanner();
+
+ // Scans the message for parameters that require special processing. Copies
+ // all SerializedHandles in the message into |handles|.
+ //
+ // Translates the message if necessary (e.g. on Windows) and returns it in
Mark Seaborn 2013/10/30 20:05:31 If it converts the message too, then maybe the nam
bbudge 2013/10/30 21:02:49 Renaming this has been tricky, because the class d
+ // |new_msg_ptr|.
+ // See more explanation in the body of the method.
+ //
+ // 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
+ // for scanning.
+ typedef std::map<int, uint32> PendingSyncMsgMap;
+ PendingSyncMsgMap pending_sync_msgs_;
+
+ DISALLOW_COPY_AND_ASSIGN(NaClMessageScanner);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_

Powered by Google App Engine
This is Rietveld 408576698