Put everything in runtime/bin into '::dart::bin' namespace.
Review URL: https://codereview.chromium.org//14341015 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
'--output', '<(builtin_cc_file)',
|
||||
'--input_cc', '<(builtin_in_cc_file)',
|
||||
'--include', 'bin/builtin.h',
|
||||
'--var_name', 'Builtin::builtin_source_',
|
||||
'--var_name', 'dart::bin::Builtin::builtin_source_',
|
||||
'<@(_sources)',
|
||||
],
|
||||
'message': 'Generating ''<(builtin_cc_file)'' file.'
|
||||
@@ -103,7 +103,7 @@
|
||||
'--output', '<(io_cc_file)',
|
||||
'--input_cc', '<(builtin_in_cc_file)',
|
||||
'--include', 'bin/builtin.h',
|
||||
'--var_name', 'Builtin::io_source_',
|
||||
'--var_name', 'dart::bin::Builtin::io_source_',
|
||||
'<(io_dart)',
|
||||
],
|
||||
'message': 'Generating ''<(io_cc_file)'' file.'
|
||||
@@ -134,7 +134,7 @@
|
||||
'--output', '<(io_patch_cc_file)',
|
||||
'--input_cc', '<(builtin_in_cc_file)',
|
||||
'--include', 'bin/builtin.h',
|
||||
'--var_name', 'Builtin::io_patch_',
|
||||
'--var_name', 'dart::bin::Builtin::io_patch_',
|
||||
'<@(_sources)',
|
||||
],
|
||||
'message': 'Generating ''<(io_patch_cc_file)'' file.'
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "bin/dartutils.h"
|
||||
#include "bin/io_natives.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
|
||||
/* { url_, source_, patch_url_, patch_source_, has_natives_ } */
|
||||
{ DartUtils::kBuiltinLibURL, builtin_source_, NULL, NULL, true },
|
||||
@@ -64,3 +67,6 @@ Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
|
||||
DART_CHECK_VALID(library);
|
||||
return library;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "platform/assert.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
#define FUNCTION_NAME(name) Builtin_##name
|
||||
#define REGISTER_FUNCTION(name, count) \
|
||||
{ ""#name, FUNCTION_NAME(name), count },
|
||||
@@ -59,5 +62,7 @@ class Builtin {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_BUILTIN_H_
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "bin/dartutils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
|
||||
/* { url_, source_, patch_url_, patch_source_, has_natives_ } */
|
||||
{ DartUtils::kBuiltinLibURL, builtin_source_, NULL, NULL, true },
|
||||
@@ -65,3 +68,6 @@ Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
|
||||
DART_CHECK_VALID(library);
|
||||
return library;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "platform/assert.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Lists the native functions implementing basic functionality in
|
||||
// standalone dart, such as printing, file I/O, and platform information.
|
||||
// Advanced I/O classes like sockets and process management are implemented
|
||||
@@ -109,3 +112,6 @@ void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) {
|
||||
Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0));
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include "bin/dartutils.h"
|
||||
#include "bin/io_natives.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
|
||||
/* { url_, source_, patch_url_, patch_source_, has_natives_ } */
|
||||
{ DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true },
|
||||
@@ -64,3 +68,6 @@ Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
|
||||
DART_CHECK_VALID(library);
|
||||
return library;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include "bin/isolate_data.h"
|
||||
#include "include/dart_api.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void FUNCTION_NAME(Common_IsBuiltinList)(Dart_NativeArguments args) {
|
||||
Dart_EnterScope();
|
||||
Dart_Handle list = Dart_GetNativeArgument(args, 0);
|
||||
@@ -54,3 +57,6 @@ void FUNCTION_NAME(Common_IsBuiltinList)(Dart_NativeArguments args) {
|
||||
Dart_SetReturnValue(args, Dart_NewBoolean(builtin_array));
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void FUNCTION_NAME(Crypto_GetRandomBytes)(Dart_NativeArguments args) {
|
||||
Dart_EnterScope();
|
||||
Dart_Handle count_obj = Dart_GetNativeArgument(args, 0);
|
||||
@@ -34,3 +37,6 @@ void FUNCTION_NAME(Crypto_GetRandomBytes)(Dart_NativeArguments args) {
|
||||
delete[] buffer;
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "bin/utils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class Crypto {
|
||||
public:
|
||||
static bool GetRandomBytes(intptr_t count, uint8_t* buffer);
|
||||
@@ -18,5 +21,8 @@ class Crypto {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Crypto);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_CRYPTO_H_
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "bin/crypto.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
intptr_t fd = TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY));
|
||||
if (fd < 0) return false;
|
||||
@@ -20,4 +23,7 @@ bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
return bytes_read == count;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "bin/crypto.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
intptr_t fd = TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY));
|
||||
if (fd < 0) return false;
|
||||
@@ -20,4 +23,7 @@ bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
return bytes_read == count;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "bin/crypto.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
intptr_t fd = TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY));
|
||||
if (fd < 0) return false;
|
||||
@@ -20,4 +23,7 @@ bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
return bytes_read == count;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "bin/crypto.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
uint32_t num;
|
||||
intptr_t read = 0;
|
||||
@@ -25,4 +28,7 @@ bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "platform/assert.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
const char* DartUtils::original_working_directory = NULL;
|
||||
const char* DartUtils::kDartScheme = "dart:";
|
||||
const char* DartUtils::kDartExtensionScheme = "dart-ext:";
|
||||
@@ -749,3 +752,6 @@ CObject* CObject::NewOSError(OSError* os_error) {
|
||||
result->SetAt(2, error_message);
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "include/dart_api.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Forward declarations.
|
||||
class File;
|
||||
|
||||
@@ -494,4 +497,7 @@ class CObjectExternalUint8Array : public CObject {
|
||||
DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DARTUTILS_H_
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
int DebuggerConnectionHandler::listener_fd_ = -1;
|
||||
dart::Monitor DebuggerConnectionHandler::handler_lock_;
|
||||
|
||||
@@ -446,3 +449,6 @@ bool DebuggerConnectionHandler::IsConnected() {
|
||||
// Return true if a connection has been established.
|
||||
return singleton_handler != NULL;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Forward declarations.
|
||||
class DbgMessage;
|
||||
class MessageBuffer;
|
||||
@@ -105,4 +108,7 @@ class DebuggerConnectionHandler {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(DebuggerConnectionHandler);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DBG_CONNECTION_H_
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include "bin/log.h"
|
||||
#include "bin/socket.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
int DebuggerConnectionImpl::epoll_fd_ = -1;
|
||||
int DebuggerConnectionImpl::wakeup_fds_[2] = {-1, -1};
|
||||
|
||||
@@ -119,4 +123,7 @@ intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) {
|
||||
return TEMP_FAILURE_RETRY(read(socket, buf, len));
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class DebuggerConnectionImpl {
|
||||
public:
|
||||
static void StartHandler(int port_number);
|
||||
@@ -28,4 +31,7 @@ class DebuggerConnectionImpl {
|
||||
static int epoll_fd_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DBG_CONNECTION_ANDROID_H_
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include "bin/log.h"
|
||||
#include "bin/socket.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
int DebuggerConnectionImpl::epoll_fd_ = -1;
|
||||
int DebuggerConnectionImpl::wakeup_fds_[2] = {-1, -1};
|
||||
|
||||
@@ -119,4 +123,7 @@ intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) {
|
||||
return TEMP_FAILURE_RETRY(read(socket, buf, len));
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class DebuggerConnectionImpl {
|
||||
public:
|
||||
static void StartHandler(int port_number);
|
||||
@@ -28,4 +31,7 @@ class DebuggerConnectionImpl {
|
||||
static int epoll_fd_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DBG_CONNECTION_LINUX_H_
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include "platform/utils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
#define INVALID_FD -1
|
||||
|
||||
int DebuggerConnectionImpl::kqueue_fd_ = INVALID_FD;
|
||||
@@ -173,4 +176,7 @@ intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) {
|
||||
return TEMP_FAILURE_RETRY(read(socket, buf, len));
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class DebuggerConnectionImpl {
|
||||
public:
|
||||
static void StartHandler(int port_number);
|
||||
@@ -42,5 +45,7 @@ class DebuggerConnectionImpl {
|
||||
static int kqueue_fd_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DBG_CONNECTION_MACOS_H_
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include "bin/eventhandler.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void DebuggerConnectionImpl::ThreadEntry(uword args) {
|
||||
ListenSocket* listen_socket =
|
||||
reinterpret_cast<ListenSocket*>(DebuggerConnectionHandler::listener_fd_);
|
||||
@@ -43,4 +47,7 @@ intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) {
|
||||
return recv(client_socket->socket(), buf, len, 0);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#ifndef BIN_DBG_CONNECTION_WIN_H_
|
||||
#define BIN_DBG_CONNECTION_WIN_H_
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class DebuggerConnectionImpl {
|
||||
public:
|
||||
static void StartHandler(int port_number);
|
||||
@@ -15,4 +18,7 @@ class DebuggerConnectionImpl {
|
||||
static void ThreadEntry(uword args);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DBG_CONNECTION_WIN_H_
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool MessageParser::IsValidMessage() const {
|
||||
if (buf_length_ == 0) {
|
||||
return false;
|
||||
@@ -1246,3 +1250,6 @@ void DbgMsgQueueList::IsolateEventHandler(Dart_IsolateId isolate_id,
|
||||
}
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include "platform/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// TODO(hausner): Need better error handling.
|
||||
#define ASSERT_NOT_ERROR(handle) \
|
||||
ASSERT(!Dart_IsError(handle))
|
||||
@@ -258,4 +261,7 @@ class DbgMsgQueueList {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(DbgMsgQueueList);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DBG_MESSAGE_H_
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "platform/assert.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Forward declaration.
|
||||
static void DirectoryService(Dart_Port, Dart_Port, Dart_CObject*);
|
||||
|
||||
@@ -375,3 +378,6 @@ bool SyncDirectoryListing::HandleError(const char* dir_name) {
|
||||
args));
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
#include "platform/globals.h"
|
||||
#include "platform/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class DirectoryListing {
|
||||
public:
|
||||
virtual ~DirectoryListing() {}
|
||||
@@ -114,5 +118,7 @@ class Directory {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Directory);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_DIRECTORY_H_
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include "bin/file.h"
|
||||
#include "bin/platform.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class PathBuffer {
|
||||
public:
|
||||
PathBuffer() : length(0) {
|
||||
@@ -515,4 +519,7 @@ bool Directory::Rename(const char* path, const char* new_path) {
|
||||
return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include "bin/file.h"
|
||||
#include "bin/platform.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class PathBuffer {
|
||||
public:
|
||||
PathBuffer() : length(0) {
|
||||
@@ -482,4 +486,7 @@ bool Directory::Rename(const char* path, const char* new_path) {
|
||||
return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include "bin/file.h"
|
||||
#include "bin/platform.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class PathBuffer {
|
||||
public:
|
||||
PathBuffer() : length(0) {
|
||||
@@ -482,4 +486,7 @@ bool Directory::Rename(const char* path, const char* new_path) {
|
||||
return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
|
||||
#include "bin/log.h"
|
||||
|
||||
#undef DeleteFile
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class PathBuffer {
|
||||
public:
|
||||
PathBuffer() : length(0) {
|
||||
@@ -524,4 +529,7 @@ bool Directory::Rename(const char* path, const char* new_path) {
|
||||
return (move_status != 0);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kNativeEventHandlerFieldIndex = 0;
|
||||
static const intptr_t kTimerId = -1;
|
||||
static const intptr_t kInvalidId = -2;
|
||||
@@ -76,3 +79,6 @@ void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) {
|
||||
event_handler->SendData(id, dart_port, data);
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "bin/builtin.h"
|
||||
#include "bin/isolate_data.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Flags used to provide information and actions to the eventhandler
|
||||
// when sending a message about a file descriptor. These flags should
|
||||
// be kept in sync with the constants in socket_impl.dart. For more
|
||||
@@ -24,6 +27,8 @@ enum MessageFlags {
|
||||
kPipe = 17,
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
// The event handler delegation class is OS specific.
|
||||
#if defined(TARGET_OS_ANDROID)
|
||||
@@ -38,6 +43,9 @@ enum MessageFlags {
|
||||
#error Unknown target os.
|
||||
#endif
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class EventHandler {
|
||||
public:
|
||||
void SendData(intptr_t id, Dart_Port dart_port, int64_t data) {
|
||||
@@ -62,5 +70,7 @@ class EventHandler {
|
||||
EventHandlerImplementation delegate_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_EVENTHANDLER_H_
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
#include "platform/utils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kInterruptMessageSize = sizeof(InterruptMessage);
|
||||
static const int kInfinityTimeout = -1;
|
||||
static const int kTimerId = -1;
|
||||
@@ -425,4 +428,7 @@ uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
|
||||
return dart::Utils::WordHash(fd + 1);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
#include "platform/hashmap.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class InterruptMessage {
|
||||
public:
|
||||
intptr_t id;
|
||||
@@ -118,5 +122,7 @@ class EventHandlerImplementation {
|
||||
int epoll_fd_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_EVENTHANDLER_ANDROID_H_
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
#include "platform/utils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kInterruptMessageSize = sizeof(InterruptMessage);
|
||||
static const int kInfinityTimeout = -1;
|
||||
static const int kTimerId = -1;
|
||||
@@ -431,4 +434,7 @@ uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
|
||||
return dart::Utils::WordHash(fd + 1);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -10,10 +10,15 @@
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "platform/hashmap.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class InterruptMessage {
|
||||
public:
|
||||
intptr_t id;
|
||||
@@ -117,5 +122,7 @@ class EventHandlerImplementation {
|
||||
int epoll_fd_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_EVENTHANDLER_LINUX_H_
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include "platform/utils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kInterruptMessageSize = sizeof(InterruptMessage);
|
||||
static const int kInfinityTimeout = -1;
|
||||
static const int kTimerId = -1;
|
||||
@@ -435,4 +438,7 @@ uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
|
||||
return dart::Utils::WordHash(fd + 1);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -10,10 +10,15 @@
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/event.h> // NOLINT
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "platform/hashmap.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class InterruptMessage {
|
||||
public:
|
||||
intptr_t id;
|
||||
@@ -130,5 +135,7 @@ class EventHandlerImplementation {
|
||||
int kqueue_fd_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_EVENTHANDLER_MACOS_H_
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#include "platform/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kBufferSize = 32 * 1024;
|
||||
|
||||
static const int kInfinityTimeout = -1;
|
||||
@@ -991,4 +994,7 @@ void EventHandlerImplementation::Shutdown() {
|
||||
SendData(kShutdownId, 0, 0);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include "bin/builtin.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Forward declarations.
|
||||
class EventHandlerImplementation;
|
||||
class Handle;
|
||||
@@ -392,5 +395,7 @@ class EventHandlerImplementation {
|
||||
HANDLE completion_port_;
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_EVENTHANDLER_WIN_H_
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
#include "bin/dartutils.h"
|
||||
#include "bin/file.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Dart_Handle Extensions::LoadExtension(const char* extension_url,
|
||||
Dart_Handle parent_library) {
|
||||
char* library_path = strdup(extension_url);
|
||||
@@ -62,3 +66,6 @@ char* Extensions::Concatenate(const char** strings) {
|
||||
ASSERT(result[size - 1] == '\0');
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "include/dart_api.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class Extensions {
|
||||
public:
|
||||
// TODO(whesse): Make extension load from a relative path relative to
|
||||
@@ -28,4 +32,7 @@ class Extensions {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Extensions);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_EXTENSIONS_H_
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "bin/extensions.h"
|
||||
#include <dlfcn.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void* Extensions::LoadExtensionLibrary(const char* library_path,
|
||||
const char* extension_name) {
|
||||
const char* strings[] = { library_path, "/lib",
|
||||
@@ -25,4 +29,7 @@ void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "bin/extensions.h"
|
||||
#include <dlfcn.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void* Extensions::LoadExtensionLibrary(const char* library_path,
|
||||
const char* extension_name) {
|
||||
const char* strings[] = { library_path, "/lib",
|
||||
@@ -25,4 +29,7 @@ void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "bin/extensions.h"
|
||||
#include <dlfcn.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void* Extensions::LoadExtensionLibrary(const char* library_path,
|
||||
const char* extension_name) {
|
||||
const char* strings[] = { library_path, "/lib",
|
||||
@@ -25,4 +29,7 @@ void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "bin/extensions.h"
|
||||
#include "bin/utils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void* Extensions::LoadExtensionLibrary(const char* library_path,
|
||||
const char* extension_name) {
|
||||
const char* strings[] = { library_path, "/", extension_name, ".dll", NULL };
|
||||
@@ -23,4 +27,7 @@ void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
|
||||
return GetProcAddress(reinterpret_cast<HMODULE>(lib_handle), symbol);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "bin/builtin.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class FDUtils {
|
||||
public:
|
||||
static bool SetCloseOnExec(intptr_t fd);
|
||||
@@ -41,4 +45,7 @@ class FDUtils {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(FDUtils);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_FDUTILS_H_
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include "bin/fdutils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool FDUtils::SetCloseOnExec(intptr_t fd) {
|
||||
intptr_t status;
|
||||
status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD));
|
||||
@@ -136,4 +139,7 @@ ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) {
|
||||
return count;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include "bin/fdutils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool FDUtils::SetCloseOnExec(intptr_t fd) {
|
||||
intptr_t status;
|
||||
status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD));
|
||||
@@ -136,4 +139,7 @@ ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) {
|
||||
return count;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include "bin/fdutils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool FDUtils::SetCloseOnExec(intptr_t fd) {
|
||||
intptr_t status;
|
||||
status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD));
|
||||
@@ -137,4 +140,7 @@ ssize_t FDUtils::WriteToBlocking(int fd, const void* buffer, size_t count) {
|
||||
return count;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
+6
-1
@@ -12,8 +12,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
static const int kMSPerSecond = 1000;
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kMSPerSecond = 1000;
|
||||
|
||||
// Forward declaration.
|
||||
static void FileService(Dart_Port, Dart_Port, Dart_CObject*);
|
||||
@@ -1169,3 +1171,6 @@ void FUNCTION_NAME(File_NewServicePort)(Dart_NativeArguments args) {
|
||||
}
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
#include "platform/globals.h"
|
||||
#include "platform/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Forward declaration.
|
||||
class FileHandle;
|
||||
|
||||
@@ -164,4 +168,7 @@ class File {
|
||||
DISALLOW_COPY_AND_ASSIGN(File);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_FILE_H_
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
#include "bin/builtin.h"
|
||||
#include "bin/log.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class FileHandle {
|
||||
public:
|
||||
explicit FileHandle(int fd) : fd_(fd) { }
|
||||
@@ -315,4 +319,7 @@ File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
|
||||
File::kDifferent;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
#include "bin/builtin.h"
|
||||
#include "bin/log.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class FileHandle {
|
||||
public:
|
||||
explicit FileHandle(int fd) : fd_(fd) { }
|
||||
@@ -316,4 +320,7 @@ File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
|
||||
File::kDifferent;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#include "bin/fdutils.h"
|
||||
#include "bin/log.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class FileHandle {
|
||||
public:
|
||||
explicit FileHandle(int fd) : fd_(fd) { }
|
||||
@@ -324,4 +328,7 @@ File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
|
||||
File::kDifferent;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "vm/unit_test.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Helper method to be able to run the test from the runtime
|
||||
// directory, or the top directory.
|
||||
static const char* GetFileName(const char* name) {
|
||||
@@ -56,3 +59,6 @@ UNIT_TEST_CASE(FilePosition) {
|
||||
EXPECT_EQ(18, file->Position());
|
||||
delete file;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include "bin/builtin.h"
|
||||
#include "bin/log.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class FileHandle {
|
||||
public:
|
||||
explicit FileHandle(int fd) : fd_(fd) { }
|
||||
@@ -551,4 +555,7 @@ File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
const int kZlibFlagMemUsage = 8;
|
||||
const int kZLibFlagWindowBits = 15;
|
||||
const int kZLibFlagUseGZipHeader = 16;
|
||||
@@ -304,3 +308,5 @@ intptr_t ZLibInflateFilter::Processed(uint8_t* buffer,
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
|
||||
#include "../third_party/zlib/zlib.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class Filter {
|
||||
public:
|
||||
virtual ~Filter() {}
|
||||
@@ -80,5 +84,7 @@ class ZLibInflateFilter : public Filter {
|
||||
DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter);
|
||||
};
|
||||
|
||||
#endif // BIN_FILTER_H_
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_FILTER_H_
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
#include "platform/globals.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
#define CHECK_RESULT(result) \
|
||||
if (Dart_IsError(result)) { \
|
||||
free(snapshot_buffer); \
|
||||
@@ -528,3 +532,10 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return dart::bin::main(argc, argv);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
#include "bin/io_buffer.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Dart_Handle IOBuffer::Allocate(intptr_t size, uint8_t **buffer) {
|
||||
uint8_t* data = Allocate(size);
|
||||
Dart_Handle result = Dart_NewExternalTypedData(kUint8,
|
||||
@@ -22,3 +26,6 @@ Dart_Handle IOBuffer::Allocate(intptr_t size, uint8_t **buffer) {
|
||||
uint8_t* IOBuffer::Allocate(intptr_t size) {
|
||||
return new uint8_t[size];
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class IOBuffer {
|
||||
public:
|
||||
// Allocate an IO buffer dart object (of type Uint8List) backed by
|
||||
@@ -37,4 +41,7 @@ class IOBuffer {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_IO_BUFFER_H_
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include "platform/assert.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Lists the native functions implementing advanced dart:io classes.
|
||||
// Some classes, like File and Directory, list their implementations in
|
||||
// builtin_natives.cc instead.
|
||||
@@ -91,3 +94,6 @@ Dart_NativeFunction IONativeLookup(Dart_Handle name,
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -7,7 +7,14 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Dart_NativeFunction IONativeLookup(Dart_Handle name,
|
||||
int argument_count);
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_IO_NATIVES_H_
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include "include/dart_api.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Forward declaration.
|
||||
class EventHandler;
|
||||
|
||||
@@ -30,4 +34,7 @@ class IsolateData {
|
||||
DISALLOW_COPY_AND_ASSIGN(IsolateData);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_ISOLATE_DATA_H_
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include "platform/globals.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class Log {
|
||||
public:
|
||||
// Print formatted output for debugging.
|
||||
@@ -34,4 +38,7 @@ class Log {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Log);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_LOG_H_
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <stdio.h> // NOLINT
|
||||
#include <android/log.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// TODO(gram): We should be buffering the data and only outputting
|
||||
// it when we see a '\n'.
|
||||
|
||||
@@ -21,4 +25,7 @@ void Log::VPrintErr(const char* format, va_list args) {
|
||||
__android_log_vprint(ANDROID_LOG_ERROR, "Dart", format, args);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include <stdio.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void Log::VPrint(const char* format, va_list args) {
|
||||
vfprintf(stdout, format, args);
|
||||
fflush(stdout);
|
||||
@@ -19,4 +23,7 @@ void Log::VPrintErr(const char* format, va_list args) {
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include <stdio.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void Log::VPrint(const char* format, va_list args) {
|
||||
vfprintf(stdout, format, args);
|
||||
fflush(stdout);
|
||||
@@ -19,4 +23,7 @@ void Log::VPrintErr(const char* format, va_list args) {
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include <stdio.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void Log::VPrint(const char* format, va_list args) {
|
||||
vfprintf(stdout, format, args);
|
||||
fflush(stdout);
|
||||
@@ -19,4 +23,7 @@ void Log::VPrintErr(const char* format, va_list args) {
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
+10
-1
@@ -23,11 +23,13 @@
|
||||
#include "bin/vmstats_impl.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// snapshot_buffer points to a snapshot if we link in a snapshot otherwise
|
||||
// it is initialized to NULL.
|
||||
extern const uint8_t* snapshot_buffer;
|
||||
|
||||
|
||||
// Global state that stores a pointer to the application script snapshot.
|
||||
static bool generate_script_snapshot = false;
|
||||
static File* snapshot_file = NULL;
|
||||
@@ -862,3 +864,10 @@ int main(int argc, char** argv) {
|
||||
|
||||
return Process::GlobalExitCode();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return dart::bin::main(argc, argv);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "bin/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
NativeService::NativeService(const char* name,
|
||||
Dart_NativeMessageHandler handler,
|
||||
int number_of_ports)
|
||||
@@ -38,3 +41,6 @@ Dart_Port NativeService::GetServicePort() {
|
||||
service_ports_index_ = (service_ports_index_ + 1) % service_ports_size_;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#include "platform/globals.h"
|
||||
#include "platform/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// Utility class to set up a native service and allocate Dart native
|
||||
// ports to interact with it from Dart code. The number of native ports
|
||||
// allocated for each service is limited.
|
||||
@@ -42,4 +46,7 @@ class NativeService {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(NativeService);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_NATIVE_SERVICE_H_
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "bin/platform.h"
|
||||
#include "include/dart_api.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) {
|
||||
Dart_EnterScope();
|
||||
@@ -73,3 +75,6 @@ void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) {
|
||||
}
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
#include "bin/builtin.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class Platform {
|
||||
public:
|
||||
// Perform platform specific initialization.
|
||||
@@ -35,4 +39,7 @@ class Platform {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Platform);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_PLATFORM_H_
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <unistd.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Platform::Initialize() {
|
||||
// Turn off the signal handler for SIGPIPE as it causes the process
|
||||
// to terminate on writing to a closed pipe. Without the signal
|
||||
@@ -69,4 +72,7 @@ void Platform::FreeEnvironment(char** env, intptr_t count) {
|
||||
delete[] env;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <unistd.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Platform::Initialize() {
|
||||
// Turn off the signal handler for SIGPIPE as it causes the process
|
||||
// to terminate on writing to a closed pipe. Without the signal
|
||||
@@ -69,4 +72,7 @@ void Platform::FreeEnvironment(char** env, intptr_t count) {
|
||||
delete[] env;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <unistd.h> // NOLINT
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Platform::Initialize() {
|
||||
// Turn off the signal handler for SIGPIPE as it causes the process
|
||||
// to terminate on writing to a closed pipe. Without the signal
|
||||
@@ -74,4 +77,7 @@ void Platform::FreeEnvironment(char** env, intptr_t count) {
|
||||
delete[] env;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#include "bin/log.h"
|
||||
#include "bin/socket.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool Platform::Initialize() {
|
||||
// Nothing to do on Windows.
|
||||
return true;
|
||||
@@ -59,4 +63,7 @@ void Platform::FreeEnvironment(char** env, int count) {
|
||||
delete[] env;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kProcessIdNativeField = 0;
|
||||
|
||||
int Process::global_exit_code_ = 0;
|
||||
@@ -260,3 +264,6 @@ void FUNCTION_NAME(StringToSystemEncoding)(Dart_NativeArguments args) {
|
||||
Dart_SetReturnValue(args, external_array);
|
||||
Dart_ExitScope();
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "platform/globals.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class Process {
|
||||
public:
|
||||
// Start a new process providing access to stdin, stdout, stderr and
|
||||
@@ -59,4 +62,7 @@ class Process {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Process);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_PROCESS_H_
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "bin/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// ProcessInfo is used to map a process id to the file descriptor for
|
||||
// the pipe used to communicate the exit code of the process to Dart.
|
||||
// ProcessInfo objects are kept in the static singly-linked
|
||||
@@ -570,4 +573,7 @@ intptr_t Process::CurrentProcessId() {
|
||||
return static_cast<intptr_t>(getpid());
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
|
||||
extern char **environ;
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// ProcessInfo is used to map a process id to the file descriptor for
|
||||
// the pipe used to communicate the exit code of the process to Dart.
|
||||
// ProcessInfo objects are kept in the static singly-linked
|
||||
@@ -566,4 +570,7 @@ intptr_t Process::CurrentProcessId() {
|
||||
return static_cast<intptr_t>(getpid());
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
extern char **environ;
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// ProcessInfo is used to map a process id to the file descriptor for
|
||||
// the pipe used to communicate the exit code of the process to Dart.
|
||||
// ProcessInfo objects are kept in the static singly-linked
|
||||
@@ -564,4 +568,7 @@ intptr_t Process::CurrentProcessId() {
|
||||
return static_cast<intptr_t>(getpid());
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
#include "bin/thread.h"
|
||||
#include "bin/utils.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kReadHandle = 0;
|
||||
static const int kWriteHandle = 1;
|
||||
|
||||
@@ -663,4 +667,7 @@ intptr_t Process::CurrentProcessId() {
|
||||
return static_cast<intptr_t>(GetCurrentProcessId());
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include "platform/assert.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
class Resources {
|
||||
public:
|
||||
static const int kNoSuchInstance = -1;
|
||||
@@ -50,4 +53,7 @@ class Resources {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Resources);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_RESOURCES_H_
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
bool SSLFilter::library_initialized_ = false;
|
||||
dart::Mutex SSLFilter::mutex_; // To protect library initialization.
|
||||
// The password is needed when creating secure server sockets. It can
|
||||
@@ -714,3 +718,6 @@ intptr_t SSLFilter::ProcessBuffer(int buffer_index) {
|
||||
}
|
||||
return bytes_processed;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include "platform/globals.h"
|
||||
#include "platform/thread.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static void ThrowException(const char* message) {
|
||||
Dart_Handle socket_io_exception =
|
||||
DartUtils::NewDartSocketIOException(message, Dart_Null());
|
||||
@@ -120,4 +124,7 @@ class SSLFilter {
|
||||
DISALLOW_COPY_AND_ASSIGN(SSLFilter);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_SECURE_SOCKET_H_
|
||||
|
||||
@@ -13,4 +13,11 @@ typedef unsigned __int8 uint8_t;
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
const uint8_t* snapshot_buffer = NULL;
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -13,6 +13,10 @@ typedef unsigned __int8 uint8_t;
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
// The string on the next line will be filled in with the contents of the
|
||||
// generated snapshot binary file.
|
||||
// This string forms the content of a snapshot which is loaded in by dart.
|
||||
@@ -20,3 +24,6 @@ static const uint8_t snapshot_buffer_[] = {
|
||||
%s
|
||||
};
|
||||
const uint8_t* snapshot_buffer = snapshot_buffer_;
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
static const int kSocketIdNativeField = 0;
|
||||
|
||||
dart::Mutex Socket::mutex_;
|
||||
@@ -529,3 +533,6 @@ Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) {
|
||||
Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) {
|
||||
return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
union RawAddr {
|
||||
struct sockaddr_in in;
|
||||
struct sockaddr_in6 in6;
|
||||
@@ -170,4 +173,7 @@ class ServerSocket {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket);
|
||||
};
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // BIN_SOCKET_H_
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
#include "bin/log.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
SocketAddress::SocketAddress(struct addrinfo* addrinfo) {
|
||||
ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN);
|
||||
RawAddr* raw = reinterpret_cast<RawAddr*>(addrinfo->ai_addr);
|
||||
@@ -290,4 +293,7 @@ bool Socket::SetNoDelay(intptr_t fd, bool enabled) {
|
||||
sizeof(on))) == 0;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_ANDROID)
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#include "bin/socket.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
SocketAddress::SocketAddress(struct addrinfo* addrinfo) {
|
||||
ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN);
|
||||
RawAddr* raw = reinterpret_cast<RawAddr*>(addrinfo->ai_addr);
|
||||
@@ -302,4 +305,7 @@ bool Socket::SetNoDelay(intptr_t fd, bool enabled) {
|
||||
sizeof(on))) == 0;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_LINUX)
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#include "bin/socket.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
SocketAddress::SocketAddress(struct addrinfo* addrinfo) {
|
||||
ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN);
|
||||
RawAddr* raw = reinterpret_cast<RawAddr*>(addrinfo->ai_addr);
|
||||
@@ -292,4 +295,7 @@ bool Socket::SetNoDelay(intptr_t fd, bool enabled) {
|
||||
sizeof(on))) == 0;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_MACOS)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "bin/socket.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
SocketAddress::SocketAddress(struct addrinfo* addrinfo) {
|
||||
ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN);
|
||||
RawAddr* raw = reinterpret_cast<RawAddr*>(addrinfo->ai_addr);
|
||||
@@ -326,4 +329,7 @@ bool Socket::SetNoDelay(intptr_t fd, bool enabled) {
|
||||
sizeof(on)) == 0;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
#endif // defined(TARGET_OS_WINDOWS)
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Dart_NativeFunction ResolveName(Dart_Handle name, int argc);
|
||||
|
||||
DART_EXPORT Dart_Handle test_extension_Init(Dart_Handle parent_library) {
|
||||
@@ -50,3 +54,6 @@ Dart_NativeFunction ResolveName(Dart_Handle name, int argc) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user