OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include "v8.h" | 3 #include "v8.h" |
4 #include "platform.h" | 4 #include "platform.h" |
5 #include "cctest.h" | 5 #include "cctest.h" |
6 | 6 |
7 | 7 |
8 using namespace ::v8::internal; | 8 using namespace ::v8::internal; |
9 | 9 |
10 | 10 |
11 class SocketListenerThread : public Thread { | 11 class SocketListenerThread : public Thread { |
12 public: | 12 public: |
13 explicit SocketListenerThread(Isolate* isolate, int port, int data_size) | 13 explicit SocketListenerThread(Isolate* isolate, int port, int data_size) |
14 : Thread(isolate), port_(port), data_size_(data_size), server_(NULL), | 14 : Thread(isolate, "SocketListenerThread"), |
15 client_(NULL), listening_(OS::CreateSemaphore(0)) { | 15 port_(port), |
| 16 data_size_(data_size), |
| 17 server_(NULL), |
| 18 client_(NULL), |
| 19 listening_(OS::CreateSemaphore(0)) { |
16 data_ = new char[data_size_]; | 20 data_ = new char[data_size_]; |
17 } | 21 } |
18 ~SocketListenerThread() { | 22 ~SocketListenerThread() { |
19 // Close both sockets. | 23 // Close both sockets. |
20 delete client_; | 24 delete client_; |
21 delete server_; | 25 delete server_; |
22 delete listening_; | 26 delete listening_; |
23 delete[] data_; | 27 delete[] data_; |
24 } | 28 } |
25 | 29 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 158 } |
155 | 159 |
156 | 160 |
157 TEST(HToNNToH) { | 161 TEST(HToNNToH) { |
158 uint16_t x = 1234; | 162 uint16_t x = 1234; |
159 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); | 163 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); |
160 | 164 |
161 uint32_t y = 12345678; | 165 uint32_t y = 12345678; |
162 CHECK(y == Socket::NToH(Socket::HToN(y))); | 166 CHECK(y == Socket::NToH(Socket::HToN(y))); |
163 } | 167 } |
OLD | NEW |