v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
win32-headers.h
Go to the documentation of this file.
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
3
// found in the LICENSE file.
4
5
#ifndef V8_BASE_WIN32_HEADERS_H_
6
#define V8_BASE_WIN32_HEADERS_H_
7
8
// This file contains defines and typedefs that allow popular Windows types to
9
// be used without the overhead of including windows.h.
10
// This file no longer includes windows.h but it still sets the defines that
11
// tell windows.h to omit some includes so that the V8 source files that do
12
// include windows.h will still get the minimal version.
13
14
#ifndef WIN32_LEAN_AND_MEAN
15
// WIN32_LEAN_AND_MEAN implies NOCRYPT and NOGDI.
16
#define WIN32_LEAN_AND_MEAN
17
#endif
18
#ifndef NOMINMAX
19
#define NOMINMAX
20
#endif
21
#ifndef NOKERNEL
22
#define NOKERNEL
23
#endif
24
#ifndef NOUSER
25
#define NOUSER
26
#endif
27
#ifndef NOSERVICE
28
#define NOSERVICE
29
#endif
30
#ifndef NOSOUND
31
#define NOSOUND
32
#endif
33
#ifndef NOMCX
34
#define NOMCX
35
#endif
36
#ifndef _WIN32_WINNT
37
#error This should be set in build config files. See build\config\win\BUILD.gn
38
#endif
39
40
#include <signal.h>
// For raise().
41
#include <
time.h
>
// For LocalOffset() implementation.
42
#if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
43
#include <errno.h>
// For STRUNCATE
44
#endif
// !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
45
#include <limits.h>
// For INT_MAX and al.
46
#include <process.h>
// For _beginthreadex().
47
#include <stdlib.h>
48
49
// typedef and define the most commonly used Windows integer types.
50
51
typedef
int
BOOL
;
// NOLINT(runtime/int)
52
typedef
unsigned
long
DWORD
;
// NOLINT(runtime/int)
53
typedef
long
LONG
;
// NOLINT(runtime/int)
54
typedef
void
*
LPVOID
;
55
typedef
void
*
PVOID
;
56
typedef
void
*
HANDLE
;
57
58
#define WINAPI __stdcall
59
60
#if defined(_WIN64)
61
typedef
unsigned
__int64
ULONG_PTR
, *
PULONG_PTR
;
62
#else
63
typedef
__w64
unsigned
long
ULONG_PTR
, *
PULONG_PTR
;
// NOLINT(runtime/int)
64
#endif
65
66
typedef
struct
_RTL_SRWLOCK
SRWLOCK
;
67
typedef
struct
_RTL_CONDITION_VARIABLE
CONDITION_VARIABLE
;
68
typedef
struct
_RTL_CRITICAL_SECTION
CRITICAL_SECTION
;
69
typedef
struct
_RTL_CRITICAL_SECTION_DEBUG*
PRTL_CRITICAL_SECTION_DEBUG
;
70
71
// Declare V8 versions of some Windows structures. These are needed for
72
// when we need a concrete type but don't want to pull in Windows.h. We can't
73
// declare the Windows types so we declare our types and cast to the Windows
74
// types in a few places. The sizes must match the Windows types so we verify
75
// that with static asserts in platform-win32.cc.
76
// ChromeToWindowsType functions are provided for pointer conversions.
77
78
struct
V8_SRWLOCK
{
79
PVOID
Ptr
;
80
};
81
82
struct
V8_CONDITION_VARIABLE
{
83
PVOID
Ptr
;
84
};
85
86
struct
V8_CRITICAL_SECTION
{
87
PRTL_CRITICAL_SECTION_DEBUG
DebugInfo
;
88
LONG
LockCount
;
89
LONG
RecursionCount
;
90
HANDLE
OwningThread
;
91
HANDLE
LockSemaphore
;
92
ULONG_PTR
SpinCount
;
93
};
94
95
inline
SRWLOCK
*
V8ToWindowsType
(
V8_SRWLOCK
* p) {
96
return
reinterpret_cast<
SRWLOCK
*
>
(p);
97
}
98
99
inline
const
SRWLOCK
*
V8ToWindowsType
(
const
V8_SRWLOCK
* p) {
100
return
reinterpret_cast<
const
SRWLOCK
*
>
(p);
101
}
102
103
inline
CONDITION_VARIABLE
*
V8ToWindowsType
(
V8_CONDITION_VARIABLE
* p) {
104
return
reinterpret_cast<
CONDITION_VARIABLE
*
>
(p);
105
}
106
107
inline
const
CONDITION_VARIABLE
*
V8ToWindowsType
(
108
const
V8_CONDITION_VARIABLE
* p) {
109
return
reinterpret_cast<
const
CONDITION_VARIABLE
*
>
(p);
110
}
111
112
inline
CRITICAL_SECTION
*
V8ToWindowsType
(
V8_CRITICAL_SECTION
* p) {
113
return
reinterpret_cast<
CRITICAL_SECTION
*
>
(p);
114
}
115
116
inline
const
CRITICAL_SECTION
*
V8ToWindowsType
(
const
V8_CRITICAL_SECTION
* p) {
117
return
reinterpret_cast<
const
CRITICAL_SECTION
*
>
(p);
118
}
119
120
#endif
// V8_BASE_WIN32_HEADERS_H_
V8_CONDITION_VARIABLE
Definition
win32-headers.h:82
V8_CONDITION_VARIABLE::Ptr
PVOID Ptr
Definition
win32-headers.h:83
V8_CRITICAL_SECTION
Definition
win32-headers.h:86
V8_CRITICAL_SECTION::LockCount
LONG LockCount
Definition
win32-headers.h:88
V8_CRITICAL_SECTION::DebugInfo
PRTL_CRITICAL_SECTION_DEBUG DebugInfo
Definition
win32-headers.h:87
V8_CRITICAL_SECTION::LockSemaphore
HANDLE LockSemaphore
Definition
win32-headers.h:91
V8_CRITICAL_SECTION::RecursionCount
LONG RecursionCount
Definition
win32-headers.h:89
V8_CRITICAL_SECTION::OwningThread
HANDLE OwningThread
Definition
win32-headers.h:90
V8_CRITICAL_SECTION::SpinCount
ULONG_PTR SpinCount
Definition
win32-headers.h:92
V8_SRWLOCK
Definition
win32-headers.h:78
V8_SRWLOCK::Ptr
PVOID Ptr
Definition
win32-headers.h:79
time.h
BOOL
int BOOL
Definition
win32-headers.h:51
V8ToWindowsType
SRWLOCK * V8ToWindowsType(V8_SRWLOCK *p)
Definition
win32-headers.h:95
LONG
long LONG
Definition
win32-headers.h:53
PVOID
void * PVOID
Definition
win32-headers.h:55
CRITICAL_SECTION
struct _RTL_CRITICAL_SECTION CRITICAL_SECTION
Definition
win32-headers.h:68
PRTL_CRITICAL_SECTION_DEBUG
struct _RTL_CRITICAL_SECTION_DEBUG * PRTL_CRITICAL_SECTION_DEBUG
Definition
win32-headers.h:69
PULONG_PTR
__w64 unsigned long * PULONG_PTR
Definition
win32-headers.h:63
HANDLE
void * HANDLE
Definition
win32-headers.h:56
LPVOID
void * LPVOID
Definition
win32-headers.h:54
ULONG_PTR
__w64 unsigned long ULONG_PTR
Definition
win32-headers.h:63
SRWLOCK
struct _RTL_SRWLOCK SRWLOCK
Definition
win32-headers.h:66
CONDITION_VARIABLE
struct _RTL_CONDITION_VARIABLE CONDITION_VARIABLE
Definition
win32-headers.h:67
DWORD
unsigned long DWORD
Definition
win32-headers.h:52
src
base
win32-headers.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0