diff --git a/runtime/bin/bin.gypi b/runtime/bin/bin.gypi index 1cf2bb4b002..ffc22e2616b 100644 --- a/runtime/bin/bin.gypi +++ b/runtime/bin/bin.gypi @@ -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.' diff --git a/runtime/bin/builtin.cc b/runtime/bin/builtin.cc index 2af1339980c..a2d646c079d 100644 --- a/runtime/bin/builtin.cc +++ b/runtime/bin/builtin.cc @@ -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 diff --git a/runtime/bin/builtin.h b/runtime/bin/builtin.h index 4a33b6cc2db..67fc9fb7f2c 100644 --- a/runtime/bin/builtin.h +++ b/runtime/bin/builtin.h @@ -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_ diff --git a/runtime/bin/builtin_gen_snapshot.cc b/runtime/bin/builtin_gen_snapshot.cc index af687594949..c76cd557412 100644 --- a/runtime/bin/builtin_gen_snapshot.cc +++ b/runtime/bin/builtin_gen_snapshot.cc @@ -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 diff --git a/runtime/bin/builtin_natives.cc b/runtime/bin/builtin_natives.cc index 555dfe5b3cd..86f9aee697a 100644 --- a/runtime/bin/builtin_natives.cc +++ b/runtime/bin/builtin_natives.cc @@ -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 diff --git a/runtime/bin/builtin_nolib.cc b/runtime/bin/builtin_nolib.cc index 048aa863724..6ca4a20ade6 100644 --- a/runtime/bin/builtin_nolib.cc +++ b/runtime/bin/builtin_nolib.cc @@ -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 diff --git a/runtime/bin/common.cc b/runtime/bin/common.cc index 261557d7f7c..030fcfaabea 100644 --- a/runtime/bin/common.cc +++ b/runtime/bin/common.cc @@ -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 diff --git a/runtime/bin/crypto.cc b/runtime/bin/crypto.cc index af5886dc02f..cd707dd47e4 100644 --- a/runtime/bin/crypto.cc +++ b/runtime/bin/crypto.cc @@ -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 diff --git a/runtime/bin/crypto.h b/runtime/bin/crypto.h index b1559729854..1feaf9c4fbc 100644 --- a/runtime/bin/crypto.h +++ b/runtime/bin/crypto.h @@ -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_ diff --git a/runtime/bin/crypto_android.cc b/runtime/bin/crypto_android.cc index 701a2082772..61b87a1e375 100644 --- a/runtime/bin/crypto_android.cc +++ b/runtime/bin/crypto_android.cc @@ -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) diff --git a/runtime/bin/crypto_linux.cc b/runtime/bin/crypto_linux.cc index 7ff6b6e922a..849fe71a3f0 100644 --- a/runtime/bin/crypto_linux.cc +++ b/runtime/bin/crypto_linux.cc @@ -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) diff --git a/runtime/bin/crypto_macos.cc b/runtime/bin/crypto_macos.cc index 0a44ff8eb75..19745fc0d5c 100644 --- a/runtime/bin/crypto_macos.cc +++ b/runtime/bin/crypto_macos.cc @@ -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) diff --git a/runtime/bin/crypto_win.cc b/runtime/bin/crypto_win.cc index 8f4952f3b93..01b82a9059b 100644 --- a/runtime/bin/crypto_win.cc +++ b/runtime/bin/crypto_win.cc @@ -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) diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc index e2390c66b72..3379b168ffd 100644 --- a/runtime/bin/dartutils.cc +++ b/runtime/bin/dartutils.cc @@ -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 diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h index 83457dc27c0..074cc121a4f 100644 --- a/runtime/bin/dartutils.h +++ b/runtime/bin/dartutils.h @@ -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_ diff --git a/runtime/bin/dbg_connection.cc b/runtime/bin/dbg_connection.cc index 381c5d349d3..dc6dc84df6f 100644 --- a/runtime/bin/dbg_connection.cc +++ b/runtime/bin/dbg_connection.cc @@ -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 diff --git a/runtime/bin/dbg_connection.h b/runtime/bin/dbg_connection.h index 791ab13e113..37080fb077a 100644 --- a/runtime/bin/dbg_connection.h +++ b/runtime/bin/dbg_connection.h @@ -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_ diff --git a/runtime/bin/dbg_connection_android.cc b/runtime/bin/dbg_connection_android.cc index 0fc57ac7e08..92fb7ca5b37 100644 --- a/runtime/bin/dbg_connection_android.cc +++ b/runtime/bin/dbg_connection_android.cc @@ -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) diff --git a/runtime/bin/dbg_connection_android.h b/runtime/bin/dbg_connection_android.h index f762c735197..c1c16c55c12 100644 --- a/runtime/bin/dbg_connection_android.h +++ b/runtime/bin/dbg_connection_android.h @@ -10,6 +10,9 @@ #include +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_ diff --git a/runtime/bin/dbg_connection_linux.cc b/runtime/bin/dbg_connection_linux.cc index c278987fadf..020b8cb7b25 100644 --- a/runtime/bin/dbg_connection_linux.cc +++ b/runtime/bin/dbg_connection_linux.cc @@ -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) diff --git a/runtime/bin/dbg_connection_linux.h b/runtime/bin/dbg_connection_linux.h index 12b0395d7b4..94a966463e4 100644 --- a/runtime/bin/dbg_connection_linux.h +++ b/runtime/bin/dbg_connection_linux.h @@ -10,6 +10,9 @@ #include +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_ diff --git a/runtime/bin/dbg_connection_macos.cc b/runtime/bin/dbg_connection_macos.cc index a3e17fd3395..4fd2d1d9a8c 100644 --- a/runtime/bin/dbg_connection_macos.cc +++ b/runtime/bin/dbg_connection_macos.cc @@ -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) diff --git a/runtime/bin/dbg_connection_macos.h b/runtime/bin/dbg_connection_macos.h index f6962ff70d2..966570042c4 100644 --- a/runtime/bin/dbg_connection_macos.h +++ b/runtime/bin/dbg_connection_macos.h @@ -10,6 +10,9 @@ #include +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_ diff --git a/runtime/bin/dbg_connection_win.cc b/runtime/bin/dbg_connection_win.cc index a241c85bf40..bd650a47e05 100644 --- a/runtime/bin/dbg_connection_win.cc +++ b/runtime/bin/dbg_connection_win.cc @@ -9,6 +9,10 @@ #include "bin/eventhandler.h" + +namespace dart { +namespace bin { + void DebuggerConnectionImpl::ThreadEntry(uword args) { ListenSocket* listen_socket = reinterpret_cast(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) diff --git a/runtime/bin/dbg_connection_win.h b/runtime/bin/dbg_connection_win.h index 24ac711e1a8..2a9feb259bf 100644 --- a/runtime/bin/dbg_connection_win.h +++ b/runtime/bin/dbg_connection_win.h @@ -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_ diff --git a/runtime/bin/dbg_message.cc b/runtime/bin/dbg_message.cc index c361a5c4cf2..5713657f7a1 100644 --- a/runtime/bin/dbg_message.cc +++ b/runtime/bin/dbg_message.cc @@ -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 diff --git a/runtime/bin/dbg_message.h b/runtime/bin/dbg_message.h index 0815cb2be7d..85be1a5d613 100644 --- a/runtime/bin/dbg_message.h +++ b/runtime/bin/dbg_message.h @@ -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_ diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc index c2185953cb8..758df5af8ae 100644 --- a/runtime/bin/directory.cc +++ b/runtime/bin/directory.cc @@ -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 diff --git a/runtime/bin/directory.h b/runtime/bin/directory.h index 331b4c4fbdb..a8dde3d7d0e 100644 --- a/runtime/bin/directory.h +++ b/runtime/bin/directory.h @@ -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_ diff --git a/runtime/bin/directory_android.cc b/runtime/bin/directory_android.cc index 58060d8b8a9..7c30274f15f 100644 --- a/runtime/bin/directory_android.cc +++ b/runtime/bin/directory_android.cc @@ -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) diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc index 2f86f5be475..67ac94714fc 100644 --- a/runtime/bin/directory_linux.cc +++ b/runtime/bin/directory_linux.cc @@ -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) diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc index ece368505e7..5c7b1159649 100644 --- a/runtime/bin/directory_macos.cc +++ b/runtime/bin/directory_macos.cc @@ -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) diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc index 79c7b082d9b..dc6cd699b68 100644 --- a/runtime/bin/directory_win.cc +++ b/runtime/bin/directory_win.cc @@ -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) diff --git a/runtime/bin/eventhandler.cc b/runtime/bin/eventhandler.cc index c1e88e7e1e8..94f0778df60 100644 --- a/runtime/bin/eventhandler.cc +++ b/runtime/bin/eventhandler.cc @@ -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 diff --git a/runtime/bin/eventhandler.h b/runtime/bin/eventhandler.h index c487c52ba0c..5d7832e730c 100644 --- a/runtime/bin/eventhandler.h +++ b/runtime/bin/eventhandler.h @@ -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_ diff --git a/runtime/bin/eventhandler_android.cc b/runtime/bin/eventhandler_android.cc index 2a708fd7d1f..9f7a8eed2e0 100644 --- a/runtime/bin/eventhandler_android.cc +++ b/runtime/bin/eventhandler_android.cc @@ -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) diff --git a/runtime/bin/eventhandler_android.h b/runtime/bin/eventhandler_android.h index dfe2ff2ffe8..51960231cd1 100644 --- a/runtime/bin/eventhandler_android.h +++ b/runtime/bin/eventhandler_android.h @@ -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_ diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc index 8cda7927c3c..e2e274611ac 100644 --- a/runtime/bin/eventhandler_linux.cc +++ b/runtime/bin/eventhandler_linux.cc @@ -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) diff --git a/runtime/bin/eventhandler_linux.h b/runtime/bin/eventhandler_linux.h index e44e28309ad..4c423f2fecd 100644 --- a/runtime/bin/eventhandler_linux.h +++ b/runtime/bin/eventhandler_linux.h @@ -10,10 +10,15 @@ #endif #include +#include #include #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_ diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc index 5972cfba771..6823ef878ff 100644 --- a/runtime/bin/eventhandler_macos.cc +++ b/runtime/bin/eventhandler_macos.cc @@ -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) diff --git a/runtime/bin/eventhandler_macos.h b/runtime/bin/eventhandler_macos.h index cbc6040df59..4303586d062 100644 --- a/runtime/bin/eventhandler_macos.h +++ b/runtime/bin/eventhandler_macos.h @@ -10,10 +10,15 @@ #endif #include +#include // NOLINT #include #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_ diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc index 3ed6e3f9da7..6a43dd5ea4a 100644 --- a/runtime/bin/eventhandler_win.cc +++ b/runtime/bin/eventhandler_win.cc @@ -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) diff --git a/runtime/bin/eventhandler_win.h b/runtime/bin/eventhandler_win.h index 09044e0fca7..30d229be7db 100644 --- a/runtime/bin/eventhandler_win.h +++ b/runtime/bin/eventhandler_win.h @@ -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_ diff --git a/runtime/bin/extensions.cc b/runtime/bin/extensions.cc index d8b13f9d33b..71eaeac5b53 100644 --- a/runtime/bin/extensions.cc +++ b/runtime/bin/extensions.cc @@ -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 diff --git a/runtime/bin/extensions.h b/runtime/bin/extensions.h index a233a25e5c0..6f3853c5d37 100644 --- a/runtime/bin/extensions.h +++ b/runtime/bin/extensions.h @@ -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_ diff --git a/runtime/bin/extensions_android.cc b/runtime/bin/extensions_android.cc index b1367366eb0..72c757f8769 100644 --- a/runtime/bin/extensions_android.cc +++ b/runtime/bin/extensions_android.cc @@ -8,6 +8,10 @@ #include "bin/extensions.h" #include // 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) diff --git a/runtime/bin/extensions_linux.cc b/runtime/bin/extensions_linux.cc index 8321efe6d3e..3920adeab90 100644 --- a/runtime/bin/extensions_linux.cc +++ b/runtime/bin/extensions_linux.cc @@ -8,6 +8,10 @@ #include "bin/extensions.h" #include // 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) diff --git a/runtime/bin/extensions_macos.cc b/runtime/bin/extensions_macos.cc index 6d7842a090a..bfda5e7f442 100644 --- a/runtime/bin/extensions_macos.cc +++ b/runtime/bin/extensions_macos.cc @@ -8,6 +8,10 @@ #include "bin/extensions.h" #include // 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) diff --git a/runtime/bin/extensions_win.cc b/runtime/bin/extensions_win.cc index 9e8a653dfcb..0f764d3b359 100644 --- a/runtime/bin/extensions_win.cc +++ b/runtime/bin/extensions_win.cc @@ -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(lib_handle), symbol); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_WINDOWS) diff --git a/runtime/bin/fdutils.h b/runtime/bin/fdutils.h index 6771f21d456..da4fcf5c9a8 100644 --- a/runtime/bin/fdutils.h +++ b/runtime/bin/fdutils.h @@ -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_ diff --git a/runtime/bin/fdutils_android.cc b/runtime/bin/fdutils_android.cc index 18b4ec39a52..7a603875384 100644 --- a/runtime/bin/fdutils_android.cc +++ b/runtime/bin/fdutils_android.cc @@ -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) diff --git a/runtime/bin/fdutils_linux.cc b/runtime/bin/fdutils_linux.cc index 84c21941b07..a763c9b10ef 100644 --- a/runtime/bin/fdutils_linux.cc +++ b/runtime/bin/fdutils_linux.cc @@ -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) diff --git a/runtime/bin/fdutils_macos.cc b/runtime/bin/fdutils_macos.cc index 7087add7b2e..65f283257c3 100644 --- a/runtime/bin/fdutils_macos.cc +++ b/runtime/bin/fdutils_macos.cc @@ -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) diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc index c9fc1b235d2..de9d1e92c43 100644 --- a/runtime/bin/file.cc +++ b/runtime/bin/file.cc @@ -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 diff --git a/runtime/bin/file.h b/runtime/bin/file.h index 944fd6a0a42..9e12463d9f9 100644 --- a/runtime/bin/file.h +++ b/runtime/bin/file.h @@ -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_ diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc index 2d7c99d1cba..9bb5e1a5767 100644 --- a/runtime/bin/file_android.cc +++ b/runtime/bin/file_android.cc @@ -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) diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc index 8126ff98179..26c047d4dbb 100644 --- a/runtime/bin/file_linux.cc +++ b/runtime/bin/file_linux.cc @@ -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) diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc index a5af90428f1..0b99153dc3b 100644 --- a/runtime/bin/file_macos.cc +++ b/runtime/bin/file_macos.cc @@ -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) diff --git a/runtime/bin/file_test.cc b/runtime/bin/file_test.cc index 5765cf22d5d..20c6bf75399 100644 --- a/runtime/bin/file_test.cc +++ b/runtime/bin/file_test.cc @@ -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 diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc index 78074cc820b..6877fb33ab5 100644 --- a/runtime/bin/file_win.cc +++ b/runtime/bin/file_win.cc @@ -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) diff --git a/runtime/bin/filter.cc b/runtime/bin/filter.cc index 1a609c576e3..a423651a089 100644 --- a/runtime/bin/filter.cc +++ b/runtime/bin/filter.cc @@ -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 diff --git a/runtime/bin/filter.h b/runtime/bin/filter.h index cc3a0a93920..fcfaa0ecaea 100644 --- a/runtime/bin/filter.h +++ b/runtime/bin/filter.h @@ -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_ diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc index 0f9c7839466..d5e0a5e3db7 100644 --- a/runtime/bin/gen_snapshot.cc +++ b/runtime/bin/gen_snapshot.cc @@ -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); +} diff --git a/runtime/bin/io_buffer.cc b/runtime/bin/io_buffer.cc index b1bc95837ca..65fe2343643 100644 --- a/runtime/bin/io_buffer.cc +++ b/runtime/bin/io_buffer.cc @@ -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 diff --git a/runtime/bin/io_buffer.h b/runtime/bin/io_buffer.h index 0c731640ba7..06ce0a637c7 100644 --- a/runtime/bin/io_buffer.h +++ b/runtime/bin/io_buffer.h @@ -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_ diff --git a/runtime/bin/io_natives.cc b/runtime/bin/io_natives.cc index a5c6a9f51cd..0b4cedd6065 100644 --- a/runtime/bin/io_natives.cc +++ b/runtime/bin/io_natives.cc @@ -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 diff --git a/runtime/bin/io_natives.h b/runtime/bin/io_natives.h index 17455552ff5..dac7fce8b9f 100644 --- a/runtime/bin/io_natives.h +++ b/runtime/bin/io_natives.h @@ -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_ diff --git a/runtime/bin/isolate_data.h b/runtime/bin/isolate_data.h index 7824285cc01..9b0806eb670 100644 --- a/runtime/bin/isolate_data.h +++ b/runtime/bin/isolate_data.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_ diff --git a/runtime/bin/log.h b/runtime/bin/log.h index c49584045cb..10629d59105 100644 --- a/runtime/bin/log.h +++ b/runtime/bin/log.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_ diff --git a/runtime/bin/log_android.cc b/runtime/bin/log_android.cc index 5f878f24e29..e8d8e68a3ec 100644 --- a/runtime/bin/log_android.cc +++ b/runtime/bin/log_android.cc @@ -10,6 +10,10 @@ #include // NOLINT #include // 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) diff --git a/runtime/bin/log_linux.cc b/runtime/bin/log_linux.cc index 0b825af3422..f398c9e93d6 100644 --- a/runtime/bin/log_linux.cc +++ b/runtime/bin/log_linux.cc @@ -9,6 +9,10 @@ #include // 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) diff --git a/runtime/bin/log_macos.cc b/runtime/bin/log_macos.cc index 87c90754df2..371124577db 100644 --- a/runtime/bin/log_macos.cc +++ b/runtime/bin/log_macos.cc @@ -9,6 +9,10 @@ #include // 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) diff --git a/runtime/bin/log_win.cc b/runtime/bin/log_win.cc index 30c265d9612..9fb69cf7e89 100644 --- a/runtime/bin/log_win.cc +++ b/runtime/bin/log_win.cc @@ -9,6 +9,10 @@ #include // 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) diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc index 41f2ba9c0d5..96ec29501cc 100644 --- a/runtime/bin/main.cc +++ b/runtime/bin/main.cc @@ -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); +} diff --git a/runtime/bin/native_service.cc b/runtime/bin/native_service.cc index 9d4c3e86d72..37506aa0948 100644 --- a/runtime/bin/native_service.cc +++ b/runtime/bin/native_service.cc @@ -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 diff --git a/runtime/bin/native_service.h b/runtime/bin/native_service.h index 8bb433078ff..ff1b0bfd7a0 100644 --- a/runtime/bin/native_service.h +++ b/runtime/bin/native_service.h @@ -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_ diff --git a/runtime/bin/platform.cc b/runtime/bin/platform.cc index 7e76c095e13..c47194ef378 100644 --- a/runtime/bin/platform.cc +++ b/runtime/bin/platform.cc @@ -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 diff --git a/runtime/bin/platform.h b/runtime/bin/platform.h index 9ee217235b2..54412bac320 100644 --- a/runtime/bin/platform.h +++ b/runtime/bin/platform.h @@ -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_ diff --git a/runtime/bin/platform_android.cc b/runtime/bin/platform_android.cc index 435f16be1df..e069d5aa520 100644 --- a/runtime/bin/platform_android.cc +++ b/runtime/bin/platform_android.cc @@ -12,6 +12,9 @@ #include // 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) diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc index 48f61541358..4a70ee5821d 100644 --- a/runtime/bin/platform_linux.cc +++ b/runtime/bin/platform_linux.cc @@ -12,6 +12,9 @@ #include // 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) diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc index d538eb77bc4..e1b914b1a2f 100644 --- a/runtime/bin/platform_macos.cc +++ b/runtime/bin/platform_macos.cc @@ -13,6 +13,9 @@ #include // 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) diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc index a71a455b289..3ba93037e49 100644 --- a/runtime/bin/platform_win.cc +++ b/runtime/bin/platform_win.cc @@ -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) diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc index c112e853a91..df53cd575da 100644 --- a/runtime/bin/process.cc +++ b/runtime/bin/process.cc @@ -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 diff --git a/runtime/bin/process.h b/runtime/bin/process.h index d0ac1bc70ba..c0d8b8b7472 100644 --- a/runtime/bin/process.h +++ b/runtime/bin/process.h @@ -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_ diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc index f0bbb836bf0..677097b3890 100644 --- a/runtime/bin/process_android.cc +++ b/runtime/bin/process_android.cc @@ -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(getpid()); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_ANDROID) diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc index 9ff0ce71e9a..838dc27a75b 100644 --- a/runtime/bin/process_linux.cc +++ b/runtime/bin/process_linux.cc @@ -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(getpid()); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_LINUX) diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc index fb60ecd5fc9..0022a8b6cdd 100644 --- a/runtime/bin/process_macos.cc +++ b/runtime/bin/process_macos.cc @@ -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(getpid()); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_MACOS) diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc index 407dd373cbb..1237f1335ac 100644 --- a/runtime/bin/process_win.cc +++ b/runtime/bin/process_win.cc @@ -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(GetCurrentProcessId()); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_WINDOWS) diff --git a/runtime/bin/resources.h b/runtime/bin/resources.h index 6279bba4d00..0f3f7c36994 100644 --- a/runtime/bin/resources.h +++ b/runtime/bin/resources.h @@ -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_ diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc index 7a5b6f3ad5f..4f7bd6bd6da 100644 --- a/runtime/bin/secure_socket.cc +++ b/runtime/bin/secure_socket.cc @@ -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 diff --git a/runtime/bin/secure_socket.h b/runtime/bin/secure_socket.h index 551fde01c7b..536a77a10f5 100644 --- a/runtime/bin/secure_socket.h +++ b/runtime/bin/secure_socket.h @@ -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_ diff --git a/runtime/bin/snapshot_empty.cc b/runtime/bin/snapshot_empty.cc index abc5522ae8b..f8c3f95ddc1 100644 --- a/runtime/bin/snapshot_empty.cc +++ b/runtime/bin/snapshot_empty.cc @@ -13,4 +13,11 @@ typedef unsigned __int8 uint8_t; #endif #include + +namespace dart { +namespace bin { + const uint8_t* snapshot_buffer = NULL; + +} // namespace bin +} // namespace dart diff --git a/runtime/bin/snapshot_in.cc b/runtime/bin/snapshot_in.cc index b281cd582ab..2e2a497f813 100644 --- a/runtime/bin/snapshot_in.cc +++ b/runtime/bin/snapshot_in.cc @@ -13,6 +13,10 @@ typedef unsigned __int8 uint8_t; #endif #include + +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 diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc index c1d3ff9e961..259323849c2 100644 --- a/runtime/bin/socket.cc +++ b/runtime/bin/socket.cc @@ -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 diff --git a/runtime/bin/socket.h b/runtime/bin/socket.h index b4134aa81db..aa8d19822fc 100644 --- a/runtime/bin/socket.h +++ b/runtime/bin/socket.h @@ -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_ diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc index 70eef7a885d..e4b99bd7172 100644 --- a/runtime/bin/socket_android.cc +++ b/runtime/bin/socket_android.cc @@ -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(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) diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc index 618c7621a02..e881f5d7b20 100644 --- a/runtime/bin/socket_linux.cc +++ b/runtime/bin/socket_linux.cc @@ -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(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) diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc index d086c0bbd25..bf170567a34 100644 --- a/runtime/bin/socket_macos.cc +++ b/runtime/bin/socket_macos.cc @@ -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(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) diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc index c58b63a80ec..12b76d8a1ee 100644 --- a/runtime/bin/socket_win.cc +++ b/runtime/bin/socket_win.cc @@ -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(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) diff --git a/runtime/bin/test_extension.cc b/runtime/bin/test_extension.cc index c1da730c885..327f01526a0 100644 --- a/runtime/bin/test_extension.cc +++ b/runtime/bin/test_extension.cc @@ -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 diff --git a/runtime/bin/thread.h b/runtime/bin/thread.h index a3c5a92e9c5..23091f0e4e1 100644 --- a/runtime/bin/thread.h +++ b/runtime/bin/thread.h @@ -8,6 +8,10 @@ #include "platform/assert.h" #include "platform/thread.h" + +namespace dart { +namespace bin { + class MutexLocker { public: explicit MutexLocker(dart::Mutex* mutex) : mutex_(mutex) { @@ -55,4 +59,7 @@ class MonitorLocker { DISALLOW_COPY_AND_ASSIGN(MonitorLocker); }; +} // namespace bin +} // namespace dart + #endif // BIN_THREAD_H_ diff --git a/runtime/bin/utils.h b/runtime/bin/utils.h index c0aab6b1546..60beef1ade1 100644 --- a/runtime/bin/utils.h +++ b/runtime/bin/utils.h @@ -11,6 +11,10 @@ #include "include/dart_api.h" #include "platform/globals.h" + +namespace dart { +namespace bin { + class OSError { public: enum SubSystem { @@ -85,4 +89,7 @@ class TimerUtils { static void Sleep(int64_t millis); }; +} // namespace bin +} // namespace dart + #endif // BIN_UTILS_H_ diff --git a/runtime/bin/utils_android.cc b/runtime/bin/utils_android.cc index 180dc39ebe5..25022b5072c 100644 --- a/runtime/bin/utils_android.cc +++ b/runtime/bin/utils_android.cc @@ -12,6 +12,10 @@ #include "bin/utils.h" #include "platform/assert.h" + +namespace dart { +namespace bin { + OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { set_sub_system(kSystem); set_code(errno); @@ -91,4 +95,7 @@ void TimerUtils::Sleep(int64_t millis) { usleep(millis * 1000); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_ANDROID) diff --git a/runtime/bin/utils_linux.cc b/runtime/bin/utils_linux.cc index 3defd39c0f4..e8230c89b4d 100644 --- a/runtime/bin/utils_linux.cc +++ b/runtime/bin/utils_linux.cc @@ -12,6 +12,10 @@ #include "bin/utils.h" #include "platform/assert.h" + +namespace dart { +namespace bin { + OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { set_sub_system(kSystem); set_code(errno); @@ -91,4 +95,7 @@ void TimerUtils::Sleep(int64_t millis) { usleep(millis * 1000); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_LINUX) diff --git a/runtime/bin/utils_macos.cc b/runtime/bin/utils_macos.cc index f717eddc92e..69c738e1890 100644 --- a/runtime/bin/utils_macos.cc +++ b/runtime/bin/utils_macos.cc @@ -12,6 +12,10 @@ #include "bin/utils.h" #include "platform/assert.h" + +namespace dart { +namespace bin { + OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { set_sub_system(kSystem); set_code(errno); @@ -91,4 +95,7 @@ void TimerUtils::Sleep(int64_t millis) { usleep(millis * 1000); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_MACOS) diff --git a/runtime/bin/utils_win.cc b/runtime/bin/utils_win.cc index 6c25d5b2f6e..b926dd767de 100644 --- a/runtime/bin/utils_win.cc +++ b/runtime/bin/utils_win.cc @@ -11,6 +11,10 @@ #include "bin/utils.h" #include "bin/log.h" + +namespace dart { +namespace bin { + static void FormatMessageIntoBuffer(DWORD code, wchar_t* buffer, int buffer_length) { @@ -145,4 +149,7 @@ void TimerUtils::Sleep(int64_t millis) { ::Sleep(millis); } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_WINDOWS) diff --git a/runtime/bin/vmstats.h b/runtime/bin/vmstats.h index 14716e8b5ac..6143b953923 100644 --- a/runtime/bin/vmstats.h +++ b/runtime/bin/vmstats.h @@ -7,6 +7,10 @@ #include "include/dart_api.h" + +namespace dart { +namespace bin { + /** * A VM status callback. Status plug-ins implement and register this * function using Dart_RegisterStatusPlugin. When Dart_GetVMStatus is @@ -34,4 +38,7 @@ typedef char* (*Dart_VmStatusCallback)(const char* request); */ DART_EXPORT int Dart_RegisterVmStatusPlugin(Dart_VmStatusCallback callback); +} // namespace bin +} // namespace dart + #endif // BIN_VMSTATS_H_ diff --git a/runtime/bin/vmstats_impl.cc b/runtime/bin/vmstats_impl.cc index 0468a5144ba..b73fe64ddf8 100644 --- a/runtime/bin/vmstats_impl.cc +++ b/runtime/bin/vmstats_impl.cc @@ -14,6 +14,10 @@ #include "include/dart_debugger_api.h" #include "platform/json.h" + +namespace dart { +namespace bin { + #define BUFSIZE 8192 #define RETRY_PAUSE 100 // milliseconds @@ -472,3 +476,6 @@ char* VmStatusService::GetVmStatus(const char* request) { } return NULL; } + +} // namespace bin +} // namespace dart diff --git a/runtime/bin/vmstats_impl.h b/runtime/bin/vmstats_impl.h index a348a7ae05e..ed92e870e8b 100644 --- a/runtime/bin/vmstats_impl.h +++ b/runtime/bin/vmstats_impl.h @@ -12,6 +12,10 @@ #include "bin/isolate_data.h" #include "platform/thread.h" + +namespace dart { +namespace bin { + // VmStats is a HTTP singleton service that reports status information // of the running VM. @@ -105,4 +109,8 @@ class VmStatusService { DISALLOW_COPY_AND_ASSIGN(VmStatusService); }; + +} // namespace bin +} // namespace dart + #endif // BIN_VMSTATS_IMPL_H_ diff --git a/runtime/bin/vmstats_impl_android.cc b/runtime/bin/vmstats_impl_android.cc index e460e703f42..5baa0d4c3ea 100644 --- a/runtime/bin/vmstats_impl_android.cc +++ b/runtime/bin/vmstats_impl_android.cc @@ -10,6 +10,9 @@ #include // NOLINT +namespace dart { +namespace bin { + static void sig_handler(int sig, siginfo_t* siginfo, void*) { if (sig == SIGQUIT) { VmStats::DumpStack(); @@ -29,5 +32,8 @@ void VmStats::Initialize() { } } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_ANDROID) diff --git a/runtime/bin/vmstats_impl_linux.cc b/runtime/bin/vmstats_impl_linux.cc index ae2277a9f03..93efbf2bd96 100644 --- a/runtime/bin/vmstats_impl_linux.cc +++ b/runtime/bin/vmstats_impl_linux.cc @@ -10,6 +10,9 @@ #include // NOLINT +namespace dart { +namespace bin { + static void sig_handler(int sig, siginfo_t* siginfo, void*) { if (sig == SIGQUIT) { VmStats::DumpStack(); @@ -29,5 +32,7 @@ void VmStats::Initialize() { } } -#endif // defined(TARGET_OS_LINUX) +} // namespace bin +} // namespace dart +#endif // defined(TARGET_OS_LINUX) diff --git a/runtime/bin/vmstats_impl_macos.cc b/runtime/bin/vmstats_impl_macos.cc index 29686a1ca81..23cf17985dd 100644 --- a/runtime/bin/vmstats_impl_macos.cc +++ b/runtime/bin/vmstats_impl_macos.cc @@ -10,6 +10,9 @@ #include // NOLINT +namespace dart { +namespace bin { + static void sig_handler(int sig, siginfo_t* siginfo, void*) { if (sig == SIGQUIT) { VmStats::DumpStack(); @@ -29,5 +32,7 @@ void VmStats::Initialize() { } } -#endif // defined(TARGET_OS_MACOS) +} // namespace bin +} // namespace dart +#endif // defined(TARGET_OS_MACOS) diff --git a/runtime/bin/vmstats_impl_win.cc b/runtime/bin/vmstats_impl_win.cc index 7ff384cd784..31578010af3 100644 --- a/runtime/bin/vmstats_impl_win.cc +++ b/runtime/bin/vmstats_impl_win.cc @@ -10,6 +10,9 @@ #include // NOLINT +namespace dart { +namespace bin { + static void sig_handler(int sig) { if (sig == SIGBREAK) { VmStats::DumpStack(); @@ -23,4 +26,7 @@ void VmStats::Initialize() { } } +} // namespace bin +} // namespace dart + #endif // defined(TARGET_OS_WINDOWS) diff --git a/runtime/tools/create_resources.py b/runtime/tools/create_resources.py index f657ea17b3f..d2c0cead2a9 100644 --- a/runtime/tools/create_resources.py +++ b/runtime/tools/create_resources.py @@ -62,7 +62,10 @@ def makeFile(output_file, root_dir, input_files): ''' % date.today().year cc_text += '#include "bin/resources.h"\n\n' + cc_text += 'namespace dart {\n' + cc_text += 'namespace bin {\n' cc_text += makeResources(root_dir, input_files) + cc_text += '} // namespace bin\n} // namespace dart\n' open(output_file, 'w').write(cc_text) return True diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc index 177110735c6..837e74bd034 100644 --- a/runtime/vm/benchmark_test.cc +++ b/runtime/vm/benchmark_test.cc @@ -12,6 +12,8 @@ #include "vm/stack_frame.h" #include "vm/unit_test.h" +using dart::bin::File; + namespace dart { Benchmark* Benchmark::first_ = NULL; diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc index 831a72b086a..09f3df6c484 100644 --- a/runtime/vm/unit_test.cc +++ b/runtime/vm/unit_test.cc @@ -18,6 +18,8 @@ #include "vm/symbols.h" #include "vm/virtual_memory.h" +using dart::bin::Builtin; +using dart::bin::DartUtils; namespace dart {