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

Side by Side Diff: test/cctest/test-sockets.cc

Issue 6711068: Use v8::internal threading support in samples/shell.cc. (Closed)
Patch Set: Created 9 years, 9 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 | « test/cctest/test-debug.cc ('k') | test/cctest/test-thread-termination.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 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
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 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698