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

Side by Side Diff: components/nacl/loader/nacl_ipc_adapter.h

Issue 1548113002: Switch to standard integer types in components/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn 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 unified diff | Download patch
« no previous file with comments | « components/nacl/loader/nacl_helper_linux.cc ('k') | components/nacl/loader/nacl_ipc_adapter.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ 5 #ifndef COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_
6 #define COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ 6 #define COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_
7 7
8 #include <stddef.h>
9
8 #include <map> 10 #include <map>
9 #include <queue> 11 #include <queue>
10 #include <string> 12 #include <string>
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/basictypes.h"
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/files/scoped_file.h" 16 #include "base/files/scoped_file.h"
17 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
18 #include "base/pickle.h" 20 #include "base/pickle.h"
19 #include "base/synchronization/condition_variable.h" 21 #include "base/synchronization/condition_variable.h"
20 #include "base/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
21 #include "base/task_runner.h" 23 #include "base/task_runner.h"
24 #include "build/build_config.h"
22 #include "ipc/ipc_listener.h" 25 #include "ipc/ipc_listener.h"
23 #include "ipc/ipc_platform_file.h" 26 #include "ipc/ipc_platform_file.h"
24 #include "ppapi/c/pp_stdint.h" 27 #include "ppapi/c/pp_stdint.h"
25 #include "ppapi/proxy/nacl_message_scanner.h" 28 #include "ppapi/proxy/nacl_message_scanner.h"
26 29
27 struct NaClDesc; 30 struct NaClDesc;
28 struct NaClImcTypedMsgHdr; 31 struct NaClImcTypedMsgHdr;
29 struct PP_Size; 32 struct PP_Size;
30 33
31 namespace IPC { 34 namespace IPC {
(...skipping 23 matching lines...) Expand all
55 class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, 58 class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>,
56 public IPC::Listener { 59 public IPC::Listener {
57 public: 60 public:
58 // Chrome's IPC message format varies by platform, NaCl's does not. In 61 // Chrome's IPC message format varies by platform, NaCl's does not. In
59 // particular, the header has some extra fields on Posix platforms. Since 62 // particular, the header has some extra fields on Posix platforms. Since
60 // NaCl is a Posix environment, it gets that version of the header. This 63 // NaCl is a Posix environment, it gets that version of the header. This
61 // header is duplicated here so we have a cross-platform definition of the 64 // header is duplicated here so we have a cross-platform definition of the
62 // header we're exposing to NaCl. 65 // header we're exposing to NaCl.
63 #pragma pack(push, 4) 66 #pragma pack(push, 4)
64 struct NaClMessageHeader : public base::Pickle::Header { 67 struct NaClMessageHeader : public base::Pickle::Header {
65 int32 routing; 68 int32_t routing;
66 uint32 type; 69 uint32_t type;
67 uint32 flags; 70 uint32_t flags;
68 uint16 num_fds; 71 uint16_t num_fds;
69 uint16 pad; 72 uint16_t pad;
70 }; 73 };
71 #pragma pack(pop) 74 #pragma pack(pop)
72 75
73 typedef base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> 76 typedef base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)>
74 ResolveFileTokenReplyCallback; 77 ResolveFileTokenReplyCallback;
75 78
76 typedef base::Callback<void(uint64_t, // file_token_lo 79 typedef base::Callback<void(uint64_t, // file_token_lo
77 uint64_t, // file_token_hi 80 uint64_t, // file_token_hi
78 ResolveFileTokenReplyCallback)> 81 ResolveFileTokenReplyCallback)>
79 ResolveFileTokenCallback; 82 ResolveFileTokenCallback;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Make a NaClDesc that refers to this NaClIPCAdapter. Note that the returned 135 // Make a NaClDesc that refers to this NaClIPCAdapter. Note that the returned
133 // NaClDesc is reference-counted, and a reference is returned. 136 // NaClDesc is reference-counted, and a reference is returned.
134 NaClDesc* MakeNaClDesc(); 137 NaClDesc* MakeNaClDesc();
135 138
136 #if defined(OS_POSIX) 139 #if defined(OS_POSIX)
137 base::ScopedFD TakeClientFileDescriptor(); 140 base::ScopedFD TakeClientFileDescriptor();
138 #endif 141 #endif
139 142
140 // Listener implementation. 143 // Listener implementation.
141 bool OnMessageReceived(const IPC::Message& message) override; 144 bool OnMessageReceived(const IPC::Message& message) override;
142 void OnChannelConnected(int32 peer_pid) override; 145 void OnChannelConnected(int32_t peer_pid) override;
143 void OnChannelError() override; 146 void OnChannelError() override;
144 147
145 private: 148 private:
146 friend class base::RefCountedThreadSafe<NaClIPCAdapter>; 149 friend class base::RefCountedThreadSafe<NaClIPCAdapter>;
147 150
148 class RewrittenMessage; 151 class RewrittenMessage;
149 152
150 // This is the data that must only be accessed inside the lock. This struct 153 // This is the data that must only be accessed inside the lock. This struct
151 // just separates it so it's easier to see. 154 // just separates it so it's easier to see.
152 struct LockedData { 155 struct LockedData {
(...skipping 22 matching lines...) Expand all
175 // by TaskRunner). This struct just separates it so it's easier to see. 178 // by TaskRunner). This struct just separates it so it's easier to see.
176 struct IOThreadData { 179 struct IOThreadData {
177 IOThreadData(); 180 IOThreadData();
178 ~IOThreadData(); 181 ~IOThreadData();
179 182
180 scoped_ptr<IPC::Channel> channel_; 183 scoped_ptr<IPC::Channel> channel_;
181 184
182 // When we send a synchronous message (from untrusted to trusted), we store 185 // When we send a synchronous message (from untrusted to trusted), we store
183 // its type here, so that later we can associate the reply with its type 186 // its type here, so that later we can associate the reply with its type
184 // for scanning. 187 // for scanning.
185 typedef std::map<int, uint32> PendingSyncMsgMap; 188 typedef std::map<int, uint32_t> PendingSyncMsgMap;
186 PendingSyncMsgMap pending_sync_msgs_; 189 PendingSyncMsgMap pending_sync_msgs_;
187 }; 190 };
188 191
189 ~NaClIPCAdapter() override; 192 ~NaClIPCAdapter() override;
190 193
191 void SaveOpenResourceMessage(const IPC::Message& orig_msg, 194 void SaveOpenResourceMessage(const IPC::Message& orig_msg,
192 IPC::PlatformFileForTransit ipc_fd, 195 IPC::PlatformFileForTransit ipc_fd,
193 base::FilePath file_path); 196 base::FilePath file_path);
194 197
195 bool RewriteMessage(const IPC::Message& msg, uint32_t type); 198 bool RewriteMessage(const IPC::Message& msg, uint32_t type);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // To be accessed on the I/O thread (via task runner) only. 231 // To be accessed on the I/O thread (via task runner) only.
229 IOThreadData io_thread_data_; 232 IOThreadData io_thread_data_;
230 233
231 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); 234 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter);
232 }; 235 };
233 236
234 // Export TranslatePepperFileReadWriteOpenFlags for testing. 237 // Export TranslatePepperFileReadWriteOpenFlags for testing.
235 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags); 238 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags);
236 239
237 #endif // COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ 240 #endif // COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_helper_linux.cc ('k') | components/nacl/loader/nacl_ipc_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698