| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 // This module contains the platform-specific code. This make the rest of the | 5 // This module contains the platform-specific code. This make the rest of the |
| 6 // code less dependent on operating system, compilers and runtime libraries. | 6 // code less dependent on operating system, compilers and runtime libraries. |
| 7 // This module does specifically not deal with differences between different | 7 // This module does specifically not deal with differences between different |
| 8 // processor architecture. | 8 // processor architecture. |
| 9 // The platform classes have the same definition for all platforms. The | 9 // The platform classes have the same definition for all platforms. The |
| 10 // implementation for a particular platform is put in platform_<os>.cc. | 10 // implementation for a particular platform is put in platform_<os>.cc. |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 static const int kStackWalkError = -1; | 203 static const int kStackWalkError = -1; |
| 204 static const int kStackWalkMaxNameLen = 256; | 204 static const int kStackWalkMaxNameLen = 256; |
| 205 static const int kStackWalkMaxTextLen = 256; | 205 static const int kStackWalkMaxTextLen = 256; |
| 206 struct StackFrame { | 206 struct StackFrame { |
| 207 void* address; | 207 void* address; |
| 208 char text[kStackWalkMaxTextLen]; | 208 char text[kStackWalkMaxTextLen]; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 class MemoryMappedFile { | 211 class MemoryMappedFile { |
| 212 public: | 212 public: |
| 213 virtual ~MemoryMappedFile() {} |
| 214 virtual void* memory() const = 0; |
| 215 virtual size_t size() const = 0; |
| 216 |
| 213 static MemoryMappedFile* open(const char* name); | 217 static MemoryMappedFile* open(const char* name); |
| 214 static MemoryMappedFile* create(const char* name, int size, void* initial); | 218 static MemoryMappedFile* create(const char* name, size_t size, |
| 215 virtual ~MemoryMappedFile() { } | 219 void* initial); |
| 216 virtual void* memory() = 0; | |
| 217 virtual int size() = 0; | |
| 218 }; | 220 }; |
| 219 | 221 |
| 220 // Safe formatting print. Ensures that str is always null-terminated. | 222 // Safe formatting print. Ensures that str is always null-terminated. |
| 221 // Returns the number of chars written, or -1 if output was truncated. | 223 // Returns the number of chars written, or -1 if output was truncated. |
| 222 static int SNPrintF(char* str, int length, const char* format, ...); | 224 static int SNPrintF(char* str, int length, const char* format, ...); |
| 223 static int VSNPrintF(char* str, | 225 static int VSNPrintF(char* str, |
| 224 int length, | 226 int length, |
| 225 const char* format, | 227 const char* format, |
| 226 va_list args); | 228 va_list args); |
| 227 | 229 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 char name_[kMaxThreadNameLength]; | 470 char name_[kMaxThreadNameLength]; |
| 469 int stack_size_; | 471 int stack_size_; |
| 470 Semaphore* start_semaphore_; | 472 Semaphore* start_semaphore_; |
| 471 | 473 |
| 472 DISALLOW_COPY_AND_ASSIGN(Thread); | 474 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 473 }; | 475 }; |
| 474 | 476 |
| 475 } } // namespace v8::base | 477 } } // namespace v8::base |
| 476 | 478 |
| 477 #endif // V8_BASE_PLATFORM_PLATFORM_H_ | 479 #endif // V8_BASE_PLATFORM_PLATFORM_H_ |
| OLD | NEW |