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

Side by Side Diff: src/platform.h

Issue 23484014: Cleanup Socket class and remove it from the platform files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup leftover junk, and rename test-sockets to test-socket. Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/debug-agent.cc ('k') | src/platform-posix.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 double fast_sin(double input); 101 double fast_sin(double input);
102 double fast_cos(double input); 102 double fast_cos(double input);
103 double fast_tan(double input); 103 double fast_tan(double input);
104 double fast_log(double input); 104 double fast_log(double input);
105 double fast_exp(double input); 105 double fast_exp(double input);
106 double fast_sqrt(double input); 106 double fast_sqrt(double input);
107 // The custom exp implementation needs 16KB of lookup data; initialize it 107 // The custom exp implementation needs 16KB of lookup data; initialize it
108 // on demand. 108 // on demand.
109 void lazily_initialize_fast_exp(); 109 void lazily_initialize_fast_exp();
110 110
111 // Forward declarations.
112 class Socket;
113
114 // ---------------------------------------------------------------------------- 111 // ----------------------------------------------------------------------------
115 // Fast TLS support 112 // Fast TLS support
116 113
117 #ifndef V8_NO_FAST_TLS 114 #ifndef V8_NO_FAST_TLS
118 115
119 #if defined(_MSC_VER) && V8_HOST_ARCH_IA32 116 #if defined(_MSC_VER) && V8_HOST_ARCH_IA32
120 117
121 #define V8_FAST_TLS_SUPPORTED 1 118 #define V8_FAST_TLS_SUPPORTED 1
122 119
123 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index)); 120 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 static const int kStackWalkError = -1; 277 static const int kStackWalkError = -1;
281 static const int kStackWalkMaxNameLen = 256; 278 static const int kStackWalkMaxNameLen = 256;
282 static const int kStackWalkMaxTextLen = 256; 279 static const int kStackWalkMaxTextLen = 256;
283 struct StackFrame { 280 struct StackFrame {
284 void* address; 281 void* address;
285 char text[kStackWalkMaxTextLen]; 282 char text[kStackWalkMaxTextLen];
286 }; 283 };
287 284
288 static int StackWalk(Vector<StackFrame> frames); 285 static int StackWalk(Vector<StackFrame> frames);
289 286
290 // Factory method for creating platform dependent Socket.
291 // Please use delete to reclaim the storage for the returned Socket.
292 static Socket* CreateSocket();
293
294 class MemoryMappedFile { 287 class MemoryMappedFile {
295 public: 288 public:
296 static MemoryMappedFile* open(const char* name); 289 static MemoryMappedFile* open(const char* name);
297 static MemoryMappedFile* create(const char* name, int size, void* initial); 290 static MemoryMappedFile* create(const char* name, int size, void* initial);
298 virtual ~MemoryMappedFile() { } 291 virtual ~MemoryMappedFile() { }
299 virtual void* memory() = 0; 292 virtual void* memory() = 0;
300 virtual int size() = 0; 293 virtual int size() = 0;
301 }; 294 };
302 295
303 // Safe formatting print. Ensures that str is always null-terminated. 296 // Safe formatting print. Ensures that str is always null-terminated.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 private: 401 private:
409 static const int msPerSecond = 1000; 402 static const int msPerSecond = 1000;
410 403
411 DISALLOW_IMPLICIT_CONSTRUCTORS(OS); 404 DISALLOW_IMPLICIT_CONSTRUCTORS(OS);
412 }; 405 };
413 406
414 // Represents and controls an area of reserved memory. 407 // Represents and controls an area of reserved memory.
415 // Control of the reserved memory can be assigned to another VirtualMemory 408 // Control of the reserved memory can be assigned to another VirtualMemory
416 // object by assignment or copy-contructing. This removes the reserved memory 409 // object by assignment or copy-contructing. This removes the reserved memory
417 // from the original object. 410 // from the original object.
418 class VirtualMemory { 411 class VirtualMemory {
tfarina 2013/09/03 19:36:34 is the goal to move all these classes into their s
419 public: 412 public:
420 // Empty VirtualMemory object, controlling no reserved memory. 413 // Empty VirtualMemory object, controlling no reserved memory.
421 VirtualMemory(); 414 VirtualMemory();
422 415
423 // Reserves virtual memory with size. 416 // Reserves virtual memory with size.
424 explicit VirtualMemory(size_t size); 417 explicit VirtualMemory(size_t size);
425 418
426 // Reserves virtual memory containing an area of the given size that 419 // Reserves virtual memory containing an area of the given size that
427 // is aligned per alignment. This may not be at the position returned 420 // is aligned per alignment. This may not be at the position returned
428 // by address(). 421 // by address().
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 605
613 PlatformData* data_; 606 PlatformData* data_;
614 607
615 char name_[kMaxThreadNameLength]; 608 char name_[kMaxThreadNameLength];
616 int stack_size_; 609 int stack_size_;
617 Semaphore* start_semaphore_; 610 Semaphore* start_semaphore_;
618 611
619 DISALLOW_COPY_AND_ASSIGN(Thread); 612 DISALLOW_COPY_AND_ASSIGN(Thread);
620 }; 613 };
621 614
622
623 // ----------------------------------------------------------------------------
624 // Socket
625 //
626
627 class Socket {
628 public:
629 virtual ~Socket() {}
630
631 // Server initialization.
632 virtual bool Bind(const int port) = 0;
633 virtual bool Listen(int backlog) const = 0;
634 virtual Socket* Accept() const = 0;
635
636 // Client initialization.
637 virtual bool Connect(const char* host, const char* port) = 0;
638
639 // Shutdown socket for both read and write. This causes blocking Send and
640 // Receive calls to exit. After Shutdown the Socket object cannot be used for
641 // any communication.
642 virtual bool Shutdown() = 0;
643
644 // Data Transimission
645 // Return 0 on failure.
646 virtual int Send(const char* data, int len) const = 0;
647 virtual int Receive(char* data, int len) const = 0;
648
649 // Set the value of the SO_REUSEADDR socket option.
650 virtual bool SetReuseAddress(bool reuse_address) = 0;
651
652 virtual bool IsValid() const = 0;
653
654 static bool SetUp();
655 static int LastError();
656 static uint16_t HToN(uint16_t value);
657 static uint16_t NToH(uint16_t value);
658 static uint32_t HToN(uint32_t value);
659 static uint32_t NToH(uint32_t value);
660 };
661
662
663 } } // namespace v8::internal 615 } } // namespace v8::internal
664 616
665 #endif // V8_PLATFORM_H_ 617 #endif // V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/debug-agent.cc ('k') | src/platform-posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698