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
51typedef int BOOL; // NOLINT(runtime/int)
52typedef unsigned long DWORD; // NOLINT(runtime/int)
53typedef long LONG; // NOLINT(runtime/int)
54typedef void* LPVOID;
55typedef void* PVOID;
56typedef void* HANDLE;
57
58#define WINAPI __stdcall
59
60#if defined(_WIN64)
61typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
62#else
63typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; // NOLINT(runtime/int)
64#endif
65
66typedef struct _RTL_SRWLOCK SRWLOCK;
67typedef struct _RTL_CONDITION_VARIABLE CONDITION_VARIABLE;
68typedef struct _RTL_CRITICAL_SECTION CRITICAL_SECTION;
69typedef 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
78struct V8_SRWLOCK {
80};
81
85
94
96 return reinterpret_cast<SRWLOCK*>(p);
97}
98
99inline const SRWLOCK* V8ToWindowsType(const V8_SRWLOCK* p) {
100 return reinterpret_cast<const SRWLOCK*>(p);
101}
102
104 return reinterpret_cast<CONDITION_VARIABLE*>(p);
105}
106
108 const V8_CONDITION_VARIABLE* p) {
109 return reinterpret_cast<const CONDITION_VARIABLE*>(p);
110}
111
113 return reinterpret_cast<CRITICAL_SECTION*>(p);
114}
115
117 return reinterpret_cast<const CRITICAL_SECTION*>(p);
118}
119
120#endif // V8_BASE_WIN32_HEADERS_H_
PRTL_CRITICAL_SECTION_DEBUG DebugInfo
int BOOL
SRWLOCK * V8ToWindowsType(V8_SRWLOCK *p)
long LONG
void * PVOID
struct _RTL_CRITICAL_SECTION CRITICAL_SECTION
struct _RTL_CRITICAL_SECTION_DEBUG * PRTL_CRITICAL_SECTION_DEBUG
__w64 unsigned long * PULONG_PTR
void * HANDLE
void * LPVOID
__w64 unsigned long ULONG_PTR
struct _RTL_SRWLOCK SRWLOCK
struct _RTL_CONDITION_VARIABLE CONDITION_VARIABLE
unsigned long DWORD