mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:31:58 +00:00
[vm] Update to constexpr in runtime/bin.
TEST=build Change-Id: I18fc7cfe725dc978d4b23de6191e455ac7cd75e5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293800 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
89472a00e4
commit
3c298dbca5
|
@ -23,7 +23,7 @@ namespace bin {
|
|||
|
||||
class ConsoleWin {
|
||||
public:
|
||||
static const int kInvalidFlag = -1;
|
||||
static constexpr int kInvalidFlag = -1;
|
||||
|
||||
static void Initialize() {
|
||||
saved_output_cp_ = kInvalidFlag;
|
||||
|
|
|
@ -32,20 +32,6 @@ namespace dart {
|
|||
namespace bin {
|
||||
|
||||
const char* DartUtils::original_working_directory = nullptr;
|
||||
const char* const DartUtils::kDartScheme = "dart:";
|
||||
const char* const DartUtils::kAsyncLibURL = "dart:async";
|
||||
const char* const DartUtils::kBuiltinLibURL = "dart:_builtin";
|
||||
const char* const DartUtils::kCoreLibURL = "dart:core";
|
||||
const char* const DartUtils::kInternalLibURL = "dart:_internal";
|
||||
const char* const DartUtils::kIsolateLibURL = "dart:isolate";
|
||||
const char* const DartUtils::kHttpLibURL = "dart:_http";
|
||||
const char* const DartUtils::kIOLibURL = "dart:io";
|
||||
const char* const DartUtils::kIOLibPatchURL = "dart:io-patch";
|
||||
const char* const DartUtils::kCLILibURL = "dart:cli";
|
||||
const char* const DartUtils::kCLILibPatchURL = "dart:cli-patch";
|
||||
const char* const DartUtils::kUriLibURL = "dart:uri";
|
||||
const char* const DartUtils::kHttpScheme = "http:";
|
||||
const char* const DartUtils::kVMServiceLibURL = "dart:vmservice";
|
||||
|
||||
dart::SimpleHashMap* DartUtils::environment_ = nullptr;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class CommandLineOptions {
|
|||
public:
|
||||
explicit CommandLineOptions(int max_count)
|
||||
: count_(0), max_count_(max_count), arguments_(nullptr) {
|
||||
static const int kWordSize = sizeof(intptr_t);
|
||||
const int kWordSize = sizeof(intptr_t);
|
||||
arguments_ = reinterpret_cast<const char**>(malloc(max_count * kWordSize));
|
||||
if (arguments_ == nullptr) {
|
||||
max_count_ = 0;
|
||||
|
@ -256,20 +256,20 @@ class DartUtils {
|
|||
// Global state that stores the original working directory..
|
||||
static const char* original_working_directory;
|
||||
|
||||
static const char* const kDartScheme;
|
||||
static const char* const kAsyncLibURL;
|
||||
static const char* const kBuiltinLibURL;
|
||||
static const char* const kCoreLibURL;
|
||||
static const char* const kInternalLibURL;
|
||||
static const char* const kIsolateLibURL;
|
||||
static const char* const kHttpLibURL;
|
||||
static const char* const kIOLibURL;
|
||||
static const char* const kIOLibPatchURL;
|
||||
static const char* const kCLILibURL;
|
||||
static const char* const kCLILibPatchURL;
|
||||
static const char* const kUriLibURL;
|
||||
static const char* const kHttpScheme;
|
||||
static const char* const kVMServiceLibURL;
|
||||
static constexpr const char* kDartScheme = "dart:";
|
||||
static constexpr const char* kAsyncLibURL = "dart:async";
|
||||
static constexpr const char* kBuiltinLibURL = "dart:_builtin";
|
||||
static constexpr const char* kCoreLibURL = "dart:core";
|
||||
static constexpr const char* kInternalLibURL = "dart:_internal";
|
||||
static constexpr const char* kIsolateLibURL = "dart:isolate";
|
||||
static constexpr const char* kHttpLibURL = "dart:_http";
|
||||
static constexpr const char* kIOLibURL = "dart:io";
|
||||
static constexpr const char* kIOLibPatchURL = "dart:io-patch";
|
||||
static constexpr const char* kCLILibURL = "dart:cli";
|
||||
static constexpr const char* kCLILibPatchURL = "dart:cli-patch";
|
||||
static constexpr const char* kUriLibURL = "dart:uri";
|
||||
static constexpr const char* kHttpScheme = "http:";
|
||||
static constexpr const char* kVMServiceLibURL = "dart:vmservice";
|
||||
|
||||
static void SetEnvironment(dart::SimpleHashMap* environment);
|
||||
static Dart_Handle EnvironmentCallback(Dart_Handle name);
|
||||
|
@ -298,10 +298,10 @@ class DartUtils {
|
|||
class CObject {
|
||||
public:
|
||||
// These match the constants in sdk/lib/io/common.dart.
|
||||
static const int kSuccess = 0;
|
||||
static const int kArgumentError = 1;
|
||||
static const int kOSError = 2;
|
||||
static const int kFileClosedError = 3;
|
||||
static constexpr int kSuccess = 0;
|
||||
static constexpr int kArgumentError = 1;
|
||||
static constexpr int kOSError = 2;
|
||||
static constexpr int kFileClosedError = 3;
|
||||
|
||||
explicit CObject(Dart_CObject* cobject) : cobject_(cobject) {}
|
||||
Dart_CObject_Type type() { return cobject_->type; }
|
||||
|
@ -620,7 +620,7 @@ class ScopedBlockingCall {
|
|||
};
|
||||
|
||||
struct MagicNumberData {
|
||||
static const intptr_t kMaxLength = 8;
|
||||
static constexpr intptr_t kMaxLength = 8;
|
||||
|
||||
intptr_t length;
|
||||
const uint8_t bytes[kMaxLength];
|
||||
|
|
|
@ -56,8 +56,8 @@ void FUNCTION_NAME(Directory_SetCurrent)(Dart_NativeArguments args) {
|
|||
}
|
||||
|
||||
void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) {
|
||||
static const int kExists = 1;
|
||||
static const int kDoesNotExist = 0;
|
||||
const int kExists = 1;
|
||||
const int kDoesNotExist = 0;
|
||||
Namespace* namespc = Namespace::GetNamespace(args, 0);
|
||||
Dart_Handle path = Dart_GetNativeArgument(args, 1);
|
||||
OSError os_error;
|
||||
|
@ -212,7 +212,7 @@ void FUNCTION_NAME(Directory_FillWithDirectoryListing)(
|
|||
}
|
||||
}
|
||||
|
||||
static const int kAsyncDirectoryListerFieldIndex = 0;
|
||||
static constexpr int kAsyncDirectoryListerFieldIndex = 0;
|
||||
|
||||
void FUNCTION_NAME(Directory_GetAsyncDirectoryListerPointer)(
|
||||
Dart_NativeArguments args) {
|
||||
|
@ -303,8 +303,8 @@ CObject* Directory::DeleteRequest(const CObjectArray& request) {
|
|||
}
|
||||
|
||||
CObject* Directory::ExistsRequest(const CObjectArray& request) {
|
||||
static const int kExists = 1;
|
||||
static const int kDoesNotExist = 0;
|
||||
const int kExists = 1;
|
||||
const int kDoesNotExist = 0;
|
||||
if ((request.Length() < 1) || !request[0]->IsIntptr()) {
|
||||
return CObject::IllegalArgumentError();
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@ namespace dart {
|
|||
namespace bin {
|
||||
|
||||
// Exit code indicating an internal Dart Frontend error.
|
||||
static const int kDartFrontendErrorExitCode = 252;
|
||||
constexpr int kDartFrontendErrorExitCode = 252;
|
||||
// Exit code indicating an API error.
|
||||
static const int kApiErrorExitCode = 253;
|
||||
constexpr int kApiErrorExitCode = 253;
|
||||
// Exit code indicating a compilation error.
|
||||
static const int kCompilationErrorExitCode = 254;
|
||||
constexpr int kCompilationErrorExitCode = 254;
|
||||
// Exit code indicating an unhandled error that is not a compilation error.
|
||||
static const int kErrorExitCode = 255;
|
||||
constexpr int kErrorExitCode = 255;
|
||||
|
||||
void ErrorExit(int exit_code, const char* format, ...);
|
||||
|
||||
|
|
|
@ -104,10 +104,10 @@ class InterruptMessage {
|
|||
int64_t data;
|
||||
};
|
||||
|
||||
static const int kInterruptMessageSize = sizeof(InterruptMessage);
|
||||
static const int kInfinityTimeout = -1;
|
||||
static const int kTimerId = -1;
|
||||
static const int kShutdownId = -2;
|
||||
static constexpr int kInterruptMessageSize = sizeof(InterruptMessage);
|
||||
static constexpr int kInfinityTimeout = -1;
|
||||
static constexpr int kTimerId = -1;
|
||||
static constexpr int kShutdownId = -2;
|
||||
|
||||
template <typename T>
|
||||
class CircularLinkedList {
|
||||
|
@ -266,7 +266,7 @@ class DescriptorInfoBase {
|
|||
template <typename DI>
|
||||
class DescriptorInfoSingleMixin : public DI {
|
||||
private:
|
||||
static const int kTokenCount = 16;
|
||||
static constexpr int kTokenCount = 16;
|
||||
|
||||
public:
|
||||
DescriptorInfoSingleMixin(intptr_t fd, bool disable_tokens)
|
||||
|
@ -356,7 +356,7 @@ class DescriptorInfoSingleMixin : public DI {
|
|||
template <typename DI>
|
||||
class DescriptorInfoMultipleMixin : public DI {
|
||||
private:
|
||||
static const int kTokenCount = 4;
|
||||
static constexpr int kTokenCount = 4;
|
||||
|
||||
static bool SamePortValue(void* key1, void* key2) {
|
||||
return reinterpret_cast<Dart_Port>(key1) ==
|
||||
|
|
|
@ -95,7 +95,7 @@ EventHandlerImplementation::EventHandlerImplementation()
|
|||
shutdown_ = false;
|
||||
// The initial size passed to epoll_create is ignored on newer (>= 2.6.8)
|
||||
// Linux versions
|
||||
static const int kEpollInitialSize = 64;
|
||||
const int kEpollInitialSize = 64;
|
||||
epoll_fd_ = NO_RETRY_EXPECTED(epoll_create(kEpollInitialSize));
|
||||
if (epoll_fd_ == -1) {
|
||||
FATAL("Failed creating epoll file descriptor: %i", errno);
|
||||
|
@ -377,7 +377,7 @@ void EventHandlerImplementation::HandleTimeout() {
|
|||
|
||||
void EventHandlerImplementation::Poll(uword args) {
|
||||
ThreadSignalBlocker signal_blocker(SIGPROF);
|
||||
static const intptr_t kMaxEvents = 16;
|
||||
const intptr_t kMaxEvents = 16;
|
||||
struct epoll_event events[kMaxEvents];
|
||||
EventHandler* handler = reinterpret_cast<EventHandler*>(args);
|
||||
EventHandlerImplementation* handler_impl = &handler->delegate_;
|
||||
|
|
|
@ -150,7 +150,7 @@ class EventHandlerImplementation {
|
|||
void Shutdown();
|
||||
|
||||
private:
|
||||
static const uint64_t kInterruptPacketKey = 1;
|
||||
static constexpr uint64_t kInterruptPacketKey = 1;
|
||||
|
||||
static void Poll(uword args);
|
||||
static void* GetHashmapKeyFromFd(intptr_t fd);
|
||||
|
|
|
@ -89,7 +89,7 @@ EventHandlerImplementation::EventHandlerImplementation()
|
|||
shutdown_ = false;
|
||||
// The initial size passed to epoll_create is ignore on newer (>=
|
||||
// 2.6.8) Linux versions
|
||||
static const int kEpollInitialSize = 64;
|
||||
const int kEpollInitialSize = 64;
|
||||
epoll_fd_ = NO_RETRY_EXPECTED(epoll_create(kEpollInitialSize));
|
||||
if (epoll_fd_ == -1) {
|
||||
FATAL("Failed creating epoll file descriptor: %i", errno);
|
||||
|
@ -387,7 +387,7 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
|
|||
|
||||
void EventHandlerImplementation::Poll(uword args) {
|
||||
ThreadSignalBlocker signal_blocker(SIGPROF);
|
||||
static const intptr_t kMaxEvents = 16;
|
||||
const intptr_t kMaxEvents = 16;
|
||||
struct epoll_event events[kMaxEvents];
|
||||
EventHandler* handler = reinterpret_cast<EventHandler*>(args);
|
||||
EventHandlerImplementation* handler_impl = &handler->delegate_;
|
||||
|
|
|
@ -43,7 +43,7 @@ static void RemoveFromKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) {
|
|||
if (!di->tracked_by_kqueue()) {
|
||||
return;
|
||||
}
|
||||
static const intptr_t kMaxChanges = 2;
|
||||
const intptr_t kMaxChanges = 2;
|
||||
struct kevent events[kMaxChanges];
|
||||
EV_SET(events, di->fd(), EVFILT_READ, EV_DELETE, 0, 0, nullptr);
|
||||
VOID_NO_RETRY_EXPECTED(kevent(kqueue_fd_, events, 1, nullptr, 0, nullptr));
|
||||
|
@ -56,7 +56,7 @@ static void RemoveFromKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) {
|
|||
// the events currently of interest.
|
||||
static void AddToKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) {
|
||||
ASSERT(!di->tracked_by_kqueue());
|
||||
static const intptr_t kMaxChanges = 2;
|
||||
const intptr_t kMaxChanges = 2;
|
||||
intptr_t changes = 0;
|
||||
struct kevent events[kMaxChanges];
|
||||
int flags = EV_ADD;
|
||||
|
@ -428,7 +428,7 @@ void EventHandlerImplementation::HandleTimeout() {
|
|||
}
|
||||
|
||||
void EventHandlerImplementation::EventHandlerEntry(uword args) {
|
||||
static const intptr_t kMaxEvents = 16;
|
||||
const intptr_t kMaxEvents = 16;
|
||||
struct kevent events[kMaxEvents];
|
||||
EventHandler* handler = reinterpret_cast<EventHandler*>(args);
|
||||
EventHandlerImplementation* handler_impl = &handler->delegate_;
|
||||
|
|
|
@ -30,9 +30,9 @@ namespace bin {
|
|||
|
||||
// kBufferSize must be >= kMaxUDPPackageLength so that a complete UDP packet
|
||||
// can fit in the buffer.
|
||||
static const int kBufferSize = 64 * 1024;
|
||||
static const int kStdOverlappedBufferSize = 16 * 1024;
|
||||
static const int kMaxUDPPackageLength = 64 * 1024;
|
||||
static constexpr int kBufferSize = 64 * 1024;
|
||||
static constexpr int kStdOverlappedBufferSize = 16 * 1024;
|
||||
static constexpr int kMaxUDPPackageLength = 64 * 1024;
|
||||
|
||||
OverlappedBuffer* OverlappedBuffer::AllocateBuffer(int buffer_size,
|
||||
Operation operation) {
|
||||
|
@ -463,8 +463,8 @@ bool ListenSocket::IssueAccept() {
|
|||
// AcceptEx documentation says: "This value must be at least 16
|
||||
// bytes more than the maximum address length for the transport
|
||||
// protocol in use."
|
||||
static const int kAcceptExAddressAdditionalBytes = 16;
|
||||
static const int kAcceptExAddressStorageSize =
|
||||
const int kAcceptExAddressAdditionalBytes = 16;
|
||||
const int kAcceptExAddressStorageSize =
|
||||
sizeof(SOCKADDR_STORAGE) + kAcceptExAddressAdditionalBytes;
|
||||
OverlappedBuffer* buffer =
|
||||
OverlappedBuffer::AllocateAcceptBuffer(2 * kAcceptExAddressStorageSize);
|
||||
|
|
|
@ -17,14 +17,14 @@ namespace dart {
|
|||
namespace compiler {
|
||||
namespace ffi {
|
||||
|
||||
static const char* const kNone = "No Test";
|
||||
static const char* const kList = "List all Tests";
|
||||
static const char* const kAll = "Run all Tests";
|
||||
static constexpr const char* kNone = "No Test";
|
||||
static constexpr const char* kList = "List all Tests";
|
||||
static constexpr const char* kAll = "Run all Tests";
|
||||
static const char* run_filter = kNone;
|
||||
|
||||
static const char* kCommandAll = "--all";
|
||||
static const char* kCommandList = "--list";
|
||||
static const char* kCommandUpdate = "--update";
|
||||
static constexpr const char* kCommandAll = "--all";
|
||||
static constexpr const char* kCommandList = "--list";
|
||||
static constexpr const char* kCommandUpdate = "--update";
|
||||
|
||||
static int run_matches = 0;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kFileNativeFieldIndex = 0;
|
||||
static constexpr int kFileNativeFieldIndex = 0;
|
||||
|
||||
#if !defined(PRODUCT)
|
||||
static bool IsFile(Dart_Handle file_obj) {
|
||||
|
|
|
@ -340,7 +340,7 @@ class File : public ReferenceCounted<File> {
|
|||
|
||||
static File* FileOpenW(const wchar_t* system_name, FileOpenMode mode);
|
||||
|
||||
static const int kClosedFd = -1;
|
||||
static constexpr int kClosedFd = -1;
|
||||
|
||||
// FileHandle is an OS specific class which stores data about the file.
|
||||
FileHandle* handle_; // OS specific handle for the file.
|
||||
|
|
|
@ -589,8 +589,9 @@ typedef struct _REPARSE_DATA_BUFFER {
|
|||
};
|
||||
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
|
||||
|
||||
static const int kReparseDataHeaderSize = sizeof(ULONG) + 2 * sizeof(USHORT);
|
||||
static const int kMountPointHeaderSize = 4 * sizeof(USHORT);
|
||||
static constexpr int kReparseDataHeaderSize =
|
||||
sizeof(ULONG) + 2 * sizeof(USHORT);
|
||||
static constexpr int kMountPointHeaderSize = 4 * sizeof(USHORT);
|
||||
|
||||
// Note: CreateLink used to create junctions on Windows instead of true
|
||||
// symbolic links. All File::*Link methods now support handling links created
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace bin {
|
|||
const int kZLibFlagUseGZipHeader = 16;
|
||||
const int kZLibFlagAcceptAnyHeader = 32;
|
||||
|
||||
static const int kFilterPointerNativeField = 0;
|
||||
static constexpr int kFilterPointerNativeField = 0;
|
||||
|
||||
static Dart_Handle GetFilter(Dart_Handle filter_obj, Filter** filter) {
|
||||
ASSERT(filter != nullptr);
|
||||
|
|
|
@ -45,7 +45,7 @@ class Filter {
|
|||
Filter() : initialized_(false) {}
|
||||
|
||||
private:
|
||||
static const intptr_t kFilterBufferSize = 64 * KB;
|
||||
static constexpr intptr_t kFilterBufferSize = 64 * KB;
|
||||
uint8_t processed_buffer_[kFilterBufferSize];
|
||||
bool initialized_;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "bin/builtin.h"
|
||||
#include "bin/console.h"
|
||||
#include "bin/dartutils.h"
|
||||
#include "bin/error_exit.h"
|
||||
#include "bin/eventhandler.h"
|
||||
#include "bin/file.h"
|
||||
#include "bin/loader.h"
|
||||
|
@ -37,13 +38,6 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Exit code indicating an API error.
|
||||
static const int kApiErrorExitCode = 253;
|
||||
// Exit code indicating a compilation error.
|
||||
static const int kCompilationErrorExitCode = 254;
|
||||
// Exit code indicating an unhandled error that is not a compilation error.
|
||||
static const int kErrorExitCode = 255;
|
||||
|
||||
#define CHECK_RESULT(result) \
|
||||
if (Dart_IsError(result)) { \
|
||||
intptr_t exit_code = 0; \
|
||||
|
|
|
@ -918,8 +918,8 @@ static void DeleteIsolateGroupData(void* callback_data) {
|
|||
delete isolate_group_data;
|
||||
}
|
||||
|
||||
static const char* kStdoutStreamId = "Stdout";
|
||||
static const char* kStderrStreamId = "Stderr";
|
||||
static constexpr const char* kStdoutStreamId = "Stdout";
|
||||
static constexpr const char* kStderrStreamId = "Stderr";
|
||||
|
||||
static bool ServiceStreamListenCallback(const char* stream_id) {
|
||||
if (strcmp(stream_id, kStdoutStreamId) == 0) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kNamespaceNativeFieldIndex = 0;
|
||||
static constexpr int kNamespaceNativeFieldIndex = 0;
|
||||
|
||||
static void ReleaseNamespace(void* isolate_callback_data, void* peer) {
|
||||
Namespace* namespc = reinterpret_cast<Namespace*>(peer);
|
||||
|
|
|
@ -43,7 +43,7 @@ class Namespace : public ReferenceCounted<Namespace> {
|
|||
private:
|
||||
// When namespc_ has this value, it indicates that there is currently
|
||||
// no namespace for resolving absolute paths.
|
||||
static const intptr_t kNone = 0;
|
||||
static constexpr intptr_t kNone = 0;
|
||||
|
||||
explicit Namespace(NamespaceImpl* namespc)
|
||||
: ReferenceCounted(), namespc_(namespc) {}
|
||||
|
|
|
@ -115,7 +115,7 @@ int Platform::NumberOfProcessors() {
|
|||
// registry because GetVersionEx() and friends lie about the OS version after
|
||||
// Windows 8.1. See:
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
|
||||
static const wchar_t* kCurrentVersion =
|
||||
static constexpr const wchar_t* kCurrentVersion =
|
||||
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||
|
||||
static bool GetCurrentVersionDWord(const wchar_t* field, DWORD* value) {
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kProcessIdNativeField = 0;
|
||||
static constexpr int kProcessIdNativeField = 0;
|
||||
|
||||
// Extract an array of C strings from a list of Dart strings.
|
||||
static char** ExtractCStringList(Dart_Handle strings,
|
||||
Dart_Handle status_handle,
|
||||
const char* error_msg,
|
||||
intptr_t* length) {
|
||||
static const intptr_t kMaxArgumentListLength = 1024 * 1024;
|
||||
static constexpr intptr_t kMaxArgumentListLength = 1024 * 1024;
|
||||
ASSERT(Dart_IsList(strings));
|
||||
intptr_t len = 0;
|
||||
Dart_Handle result = Dart_ListLength(strings, &len);
|
||||
|
|
|
@ -225,7 +225,7 @@ class SignalInfo {
|
|||
// allocated.
|
||||
class BufferListBase {
|
||||
protected:
|
||||
static const intptr_t kBufferSize = 16 * 1024;
|
||||
static constexpr intptr_t kBufferSize = 16 * 1024;
|
||||
|
||||
class BufferListNode {
|
||||
public:
|
||||
|
|
|
@ -965,7 +965,7 @@ int64_t Process::MaxRSS() {
|
|||
|
||||
static Mutex* signal_mutex = nullptr;
|
||||
static SignalInfo* signal_handlers = nullptr;
|
||||
static const int kSignalsCount = 7;
|
||||
static constexpr int kSignalsCount = 7;
|
||||
static const int kSignals[kSignalsCount] = {
|
||||
SIGHUP, SIGINT, SIGTERM, SIGUSR1, SIGUSR2, SIGWINCH,
|
||||
SIGQUIT // Allow VMService to listen on SIGQUIT.
|
||||
|
|
|
@ -206,7 +206,7 @@ class ExitCodeHandler {
|
|||
}
|
||||
|
||||
private:
|
||||
static const uint64_t kShutdownPacketKey = 1;
|
||||
static constexpr uint64_t kShutdownPacketKey = 1;
|
||||
|
||||
static void SendShutdownMessage() {
|
||||
zx_port_packet_t pkt;
|
||||
|
|
|
@ -964,7 +964,7 @@ int64_t Process::MaxRSS() {
|
|||
|
||||
static Mutex* signal_mutex = nullptr;
|
||||
static SignalInfo* signal_handlers = nullptr;
|
||||
static const int kSignalsCount = 7;
|
||||
static constexpr int kSignalsCount = 7;
|
||||
static const int kSignals[kSignalsCount] = {
|
||||
SIGHUP, SIGINT, SIGTERM, SIGUSR1, SIGUSR2, SIGWINCH,
|
||||
SIGQUIT // Allow VMService to listen on SIGQUIT.
|
||||
|
|
|
@ -989,7 +989,7 @@ int64_t Process::MaxRSS() {
|
|||
|
||||
static Mutex* signal_mutex = nullptr;
|
||||
static SignalInfo* signal_handlers = nullptr;
|
||||
static const int kSignalsCount = 7;
|
||||
static constexpr int kSignalsCount = 7;
|
||||
static const int kSignals[kSignalsCount] = {
|
||||
SIGHUP, SIGINT, SIGTERM, SIGUSR1, SIGUSR2, SIGWINCH,
|
||||
SIGQUIT // Allow VMService to listen on SIGQUIT.
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kReadHandle = 0;
|
||||
static const int kWriteHandle = 1;
|
||||
static constexpr int kReadHandle = 0;
|
||||
static constexpr int kWriteHandle = 1;
|
||||
|
||||
int Process::global_exit_code_ = 0;
|
||||
Mutex* Process::global_exit_code_mutex_ = nullptr;
|
||||
|
@ -849,7 +849,7 @@ bool Process::Wait(intptr_t pid,
|
|||
|
||||
// Create three events for overlapped IO. These are created as already
|
||||
// signalled to ensure they have read called at least once.
|
||||
static const int kHandles = 3;
|
||||
const int kHandles = 3;
|
||||
HANDLE events[kHandles];
|
||||
for (int i = 0; i < kHandles; i++) {
|
||||
events[i] = CreateEvent(nullptr, FALSE, TRUE, nullptr);
|
||||
|
|
|
@ -39,9 +39,9 @@ const uint8_t* bin::core_isolate_snapshot_instructions =
|
|||
|
||||
// Only run tests that match the filter string. The default does not match any
|
||||
// tests.
|
||||
static const char* const kNone = "No Test or Benchmarks";
|
||||
static const char* const kList = "List all Tests and Benchmarks";
|
||||
static const char* const kAllBenchmarks = "All Benchmarks";
|
||||
static constexpr const char* kNone = "No Test or Benchmarks";
|
||||
static constexpr const char* kList = "List all Tests and Benchmarks";
|
||||
static constexpr const char* kAllBenchmarks = "All Benchmarks";
|
||||
static const char* run_filter = kNone;
|
||||
static const char* kernel_snapshot = nullptr;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class SSLFilter : public ReferenceCounted<SSLFilter> {
|
|||
};
|
||||
|
||||
static const intptr_t kApproximateSize;
|
||||
static const int kSSLFilterNativeFieldIndex = 0;
|
||||
static constexpr int kSSLFilterNativeFieldIndex = 0;
|
||||
|
||||
SSLFilter()
|
||||
: callback_error(nullptr),
|
||||
|
|
|
@ -25,7 +25,7 @@ const bool SSL_LOG_CERTS = false;
|
|||
|
||||
class SecureSocketUtils : public AllStatic {
|
||||
public:
|
||||
static const int SSL_ERROR_MESSAGE_BUFFER_SIZE = 1000;
|
||||
static constexpr int SSL_ERROR_MESSAGE_BUFFER_SIZE = 1000;
|
||||
|
||||
static void ThrowIOException(int status,
|
||||
const char* exception_type,
|
||||
|
|
|
@ -24,8 +24,8 @@ typedef void (*TrustEvaluateHandlerFunc)(Dart_Port dest_port_id,
|
|||
class SSLCertContext : public ReferenceCounted<SSLCertContext> {
|
||||
public:
|
||||
static const intptr_t kApproximateSize;
|
||||
static const int kSecurityContextNativeFieldIndex = 0;
|
||||
static const int kX509NativeFieldIndex = 0;
|
||||
static constexpr int kSecurityContextNativeFieldIndex = 0;
|
||||
static constexpr int kX509NativeFieldIndex = 0;
|
||||
|
||||
explicit SSLCertContext(SSL_CTX* context)
|
||||
: ReferenceCounted(),
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int64_t kAppSnapshotHeaderSize = 5 * kInt64Size;
|
||||
static const int64_t kAppSnapshotPageSize = 16 * KB;
|
||||
static constexpr int64_t kAppSnapshotHeaderSize = 5 * kInt64Size;
|
||||
static constexpr int64_t kAppSnapshotPageSize = 16 * KB;
|
||||
|
||||
static const char kMachOAppSnapshotNoteName[] DART_UNUSED = "__dart_app_snap";
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kSocketIdNativeField = 0;
|
||||
static constexpr int kSocketIdNativeField = 0;
|
||||
|
||||
ListeningSocketRegistry* globalTcpListeningSocketRegistry = nullptr;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class Socket : public ReferenceCounted<Socket> {
|
|||
udp_receive_buffer_ = nullptr;
|
||||
}
|
||||
|
||||
static const int kClosedFd = -1;
|
||||
static constexpr int kClosedFd = -1;
|
||||
|
||||
static bool short_socket_read_;
|
||||
static bool short_socket_write_;
|
||||
|
@ -135,7 +135,7 @@ class Socket : public ReferenceCounted<Socket> {
|
|||
|
||||
class ServerSocket {
|
||||
public:
|
||||
static const intptr_t kTemporaryFailure = -2;
|
||||
static constexpr intptr_t kTemporaryFailure = -2;
|
||||
|
||||
static intptr_t Accept(intptr_t fd);
|
||||
|
||||
|
@ -245,7 +245,7 @@ class ListeningSocketRegistry {
|
|||
}
|
||||
};
|
||||
|
||||
static const intptr_t kInitialSocketsCount = 8;
|
||||
static constexpr intptr_t kInitialSocketsCount = 8;
|
||||
|
||||
OSSocket* FindOSSocketWithAddress(OSSocket* current, const RawAddr& addr) {
|
||||
while (current != nullptr) {
|
||||
|
|
|
@ -91,7 +91,7 @@ class SocketAddress {
|
|||
// Unix domain address is only on Linux, Mac OS and Android now.
|
||||
// unix(7) require sun_path to be 108 bytes on Linux and Android, 104 bytes on
|
||||
// Mac OS.
|
||||
static const intptr_t kMaxUnixPathLength =
|
||||
static constexpr intptr_t kMaxUnixPathLength =
|
||||
sizeof(((struct sockaddr_un*)nullptr)->sun_path);
|
||||
char as_string_[kMaxUnixPathLength];
|
||||
#else
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kSocketIdNativeField = 0;
|
||||
static constexpr int kSocketIdNativeField = 0;
|
||||
|
||||
void FUNCTION_NAME(SynchronousSocket_LookupRequest)(Dart_NativeArguments args) {
|
||||
if (Dart_GetNativeArgumentCount(args) != 2) {
|
||||
|
|
|
@ -39,7 +39,7 @@ class SynchronousSocket {
|
|||
static void Close(intptr_t fd);
|
||||
|
||||
private:
|
||||
static const int kClosedFd = -1;
|
||||
static constexpr int kClosedFd = -1;
|
||||
|
||||
intptr_t fd_;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const char* GetFileName(const char* name) {
|
|||
if (bin::File::Exists(nullptr, name)) {
|
||||
return name;
|
||||
} else {
|
||||
static const int kRuntimeLength = strlen("runtime/");
|
||||
const int kRuntimeLength = strlen("runtime/");
|
||||
return name + kRuntimeLength;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class Monitor {
|
|||
public:
|
||||
enum WaitResult { kNotified, kTimedOut };
|
||||
|
||||
static const int64_t kNoTimeout = 0;
|
||||
static constexpr int64_t kNoTimeout = 0;
|
||||
|
||||
Monitor();
|
||||
~Monitor();
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace bin {
|
|||
// epoch (January 1, 1970 UTC) measured in 100ns intervals.
|
||||
//
|
||||
// See https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime
|
||||
static const int64_t kFileTimeEpoch = 116444736000000000LL;
|
||||
static constexpr int64_t kFileTimeEpoch = 116444736000000000LL;
|
||||
|
||||
// Although win32 uses 64-bit integers for representing timestamps,
|
||||
// these are packed into a FILETIME structure. The FILETIME
|
||||
|
@ -50,7 +50,7 @@ void FormatMessageIntoBuffer(DWORD code, wchar_t* buffer, int buffer_length) {
|
|||
}
|
||||
|
||||
FILETIME GetFiletimeFromMillis(int64_t millis) {
|
||||
static const int64_t kTimeScaler = 10000; // 100 ns to ms.
|
||||
const int64_t kTimeScaler = 10000; // 100 ns to ms.
|
||||
TimeStamp t;
|
||||
t.t_ = millis * kTimeScaler + kFileTimeEpoch;
|
||||
return t.ft_;
|
||||
|
@ -68,7 +68,7 @@ void OSError::SetCodeAndMessage(SubSystem sub_system, int code) {
|
|||
set_sub_system(sub_system);
|
||||
set_code(code);
|
||||
|
||||
static const int kMaxMessageLength = 256;
|
||||
const int kMaxMessageLength = 256;
|
||||
wchar_t message[kMaxMessageLength];
|
||||
FormatMessageIntoBuffer(code_, message, kMaxMessageLength);
|
||||
char* utf8 = StringUtilsWin::WideToUtf8(message);
|
||||
|
@ -194,7 +194,7 @@ bool ShellUtils::GetUtf8Argv(int argc, char** argv) {
|
|||
}
|
||||
|
||||
static int64_t GetCurrentTimeMicros() {
|
||||
static const int64_t kTimeScaler = 10; // 100 ns to us.
|
||||
const int64_t kTimeScaler = 10; // 100 ns to us.
|
||||
|
||||
TimeStamp time;
|
||||
GetSystemTimeAsFileTime(&time.ft_);
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace bin {
|
|||
return false; \
|
||||
}
|
||||
|
||||
static const char* const kVMServiceIOLibraryUri = "dart:vmservice_io";
|
||||
static constexpr const char* kVMServiceIOLibraryUri = "dart:vmservice_io";
|
||||
|
||||
void NotifyServerState(Dart_NativeArguments args) {
|
||||
Dart_EnterScope();
|
||||
|
|
|
@ -34,7 +34,7 @@ class VmService {
|
|||
static const char* GetServerAddress() { return &server_uri_[0]; }
|
||||
|
||||
private:
|
||||
static const intptr_t kServerUriStringBufferSize = 1024;
|
||||
static constexpr intptr_t kServerUriStringBufferSize = 1024;
|
||||
friend void NotifyServerState(Dart_NativeArguments args);
|
||||
|
||||
static void SetServerAddress(const char* server_uri_);
|
||||
|
|
Loading…
Reference in a new issue