OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_NACL_NACL_IPC_ADAPTER_H_ | 5 #ifndef CHROME_NACL_NACL_IPC_ADAPTER_H_ |
6 #define CHROME_NACL_NACL_IPC_ADAPTER_H_ | 6 #define CHROME_NACL_NACL_IPC_ADAPTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... |
28 // This object also provides the necessary logic for rewriting IPC messages. | 28 // This object also provides the necessary logic for rewriting IPC messages. |
29 // NaCl code is platform-independent and runs in a Posix-like enviroment, but | 29 // NaCl code is platform-independent and runs in a Posix-like enviroment, but |
30 // some formatting in the message and the way handles are transferred varies | 30 // some formatting in the message and the way handles are transferred varies |
31 // by platform. This class bridges that gap to provide what looks like a | 31 // by platform. This class bridges that gap to provide what looks like a |
32 // normal platform-specific IPC implementation to Chrome, and a Posix-like | 32 // normal platform-specific IPC implementation to Chrome, and a Posix-like |
33 // version on every platform to NaCl. | 33 // version on every platform to NaCl. |
34 // | 34 // |
35 // This object must be threadsafe since the nacl environment determines which | 35 // This object must be threadsafe since the nacl environment determines which |
36 // thread every function is called on. | 36 // thread every function is called on. |
37 class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, | 37 class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, |
38 public IPC::Channel::Listener { | 38 public IPC::Listener { |
39 public: | 39 public: |
40 // Chrome's IPC message format varies by platform, NaCl's does not. In | 40 // Chrome's IPC message format varies by platform, NaCl's does not. In |
41 // particular, the header has some extra fields on Posix platforms. Since | 41 // particular, the header has some extra fields on Posix platforms. Since |
42 // NaCl is a Posix environment, it gets that version of the header. This | 42 // NaCl is a Posix environment, it gets that version of the header. This |
43 // header is duplicated here so we have a cross-platform definition of the | 43 // header is duplicated here so we have a cross-platform definition of the |
44 // header we're exposing to NaCl. | 44 // header we're exposing to NaCl. |
45 #pragma pack(push, 4) | 45 #pragma pack(push, 4) |
46 struct NaClMessageHeader : public Pickle::Header { | 46 struct NaClMessageHeader : public Pickle::Header { |
47 int32 routing; | 47 int32 routing; |
48 uint32 type; | 48 uint32 type; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // To be accessed inside of lock_ only. | 143 // To be accessed inside of lock_ only. |
144 LockedData locked_data_; | 144 LockedData locked_data_; |
145 | 145 |
146 // To be accessed on the I/O thread (via task runner) only. | 146 // To be accessed on the I/O thread (via task runner) only. |
147 IOThreadData io_thread_data_; | 147 IOThreadData io_thread_data_; |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); | 149 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); |
150 }; | 150 }; |
151 | 151 |
152 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ | 152 #endif // CHROME_NACL_NACL_IPC_ADAPTER_H_ |
OLD | NEW |