OLD | NEW |
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #ifndef SRC_SHARED_CONNECTION_H_ | 5 #ifndef SRC_SHARED_CONNECTION_H_ |
6 #define SRC_SHARED_CONNECTION_H_ | 6 #define SRC_SHARED_CONNECTION_H_ |
7 | 7 |
8 #include "src/shared/globals.h" | 8 #include "src/shared/globals.h" |
9 #include "src/shared/platform.h" | 9 #include "src/shared/platform.h" |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 kMapLookup, | 150 kMapLookup, |
151 kObjectId, | 151 kObjectId, |
152 | 152 |
153 kInteger, | 153 kInteger, |
154 kBoolean, | 154 kBoolean, |
155 kNull, | 155 kNull, |
156 kDouble, | 156 kDouble, |
157 kString, | 157 kString, |
158 kInstance, | 158 kInstance, |
159 kClass, | 159 kClass, |
160 kInstanceStructure | 160 kArray, |
| 161 kInstanceStructure, |
| 162 kArrayStructure, |
161 }; | 163 }; |
162 | 164 |
163 Connection(); | 165 Connection(); |
164 virtual ~Connection(); | 166 virtual ~Connection(); |
165 | 167 |
166 int ReadInt() { return incoming_.ReadInt(); } | 168 int ReadInt() { return incoming_.ReadInt(); } |
167 int64 ReadInt64() { return incoming_.ReadInt64(); } | 169 int64 ReadInt64() { return incoming_.ReadInt64(); } |
168 double ReadDouble() { return incoming_.ReadDouble(); } | 170 double ReadDouble() { return incoming_.ReadDouble(); } |
169 bool ReadBoolean() { return incoming_.ReadBoolean(); } | 171 bool ReadBoolean() { return incoming_.ReadBoolean(); } |
170 uint8* ReadBytes(int* length) { return incoming_.ReadBytes(length); } | 172 uint8* ReadBytes(int* length) { return incoming_.ReadBytes(length); } |
171 | 173 |
172 virtual void Send(Opcode opcode, const WriteBuffer& buffer) = 0; | 174 virtual void Send(Opcode opcode, const WriteBuffer& buffer) = 0; |
173 virtual Opcode Receive() = 0; | 175 virtual Opcode Receive() = 0; |
174 | 176 |
175 protected: | 177 protected: |
176 ReadBuffer incoming_; | 178 ReadBuffer incoming_; |
177 Mutex* send_mutex_; | 179 Mutex* send_mutex_; |
178 }; | 180 }; |
179 | 181 |
180 } // namespace dartino | 182 } // namespace dartino |
181 | 183 |
182 #endif // SRC_SHARED_CONNECTION_H_ | 184 #endif // SRC_SHARED_CONNECTION_H_ |
OLD | NEW |