OLD | NEW |
---|---|
(Empty) | |
1 // 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.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ | |
6 #define PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ | |
7 | |
8 #include <map> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "ppapi/proxy/ppapi_proxy_export.h" | |
14 | |
15 namespace IPC { | |
16 class Message; | |
17 } | |
18 | |
19 namespace ppapi { | |
20 namespace proxy { | |
21 | |
22 class SerializedHandle; | |
23 | |
24 class PPAPI_PROXY_EXPORT NaClMessageScanner { | |
25 public: | |
26 NaClMessageScanner(); | |
27 | |
28 // Scans the message for parameters that require special processing. Copies | |
29 // all SerializedHandles in the message into |handles|. | |
30 // | |
31 // 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
| |
32 // |new_msg_ptr|. | |
33 // See more explanation in the body of the method. | |
34 // | |
35 // See chrome/nacl/nacl_ipc_adapter.cc for where this is used to convert | |
36 // native handles to NaClDescs. | |
37 bool ScanMessage(const IPC::Message& msg, | |
38 std::vector<SerializedHandle>* handles, | |
39 scoped_ptr<IPC::Message>* new_msg_ptr); | |
40 | |
41 // This method informs NaClMessageScanner that a sync message is being sent | |
42 // so that it can associate reply messages with their type. | |
43 // | |
44 // Users of NaClMessageScanner must call this when they send a synchronous | |
45 // message, otherwise NaClMessageScanner won't scan replies. | |
46 void RegisterSyncMessageForReply(const IPC::Message& msg); | |
47 | |
48 private: | |
49 // When we send a synchronous message (from untrusted to trusted), we store | |
50 // its type here, so that later we can associate the reply with its type | |
51 // for scanning. | |
52 typedef std::map<int, uint32> PendingSyncMsgMap; | |
53 PendingSyncMsgMap pending_sync_msgs_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(NaClMessageScanner); | |
56 }; | |
57 | |
58 } // namespace proxy | |
59 } // namespace ppapi | |
60 | |
61 #endif // PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_ | |
OLD | NEW |