1
0
Fork 0

Add environment variable to V8 wrapping.

This commit is contained in:
Willi Goesgens 2015-03-20 11:55:32 +01:00
parent 1298bd40a8
commit 108fccdbf7
6 changed files with 29 additions and 2 deletions

View File

@ -19,7 +19,7 @@
REQUEST_TIME_DISTRIBUTION, THREAD_NUMBER, LOGFILE_PATH,
SYS_PLATFORM, SYS_EXECUTE_EXTERNAL, SYS_STATUS_EXTERNAL, SYS_EXECUTE_EXTERNAL_AND_WAIT,
SYS_KILL_EXTERNAL, SYS_REGISTER_TASK, SYS_UNREGISTER_TASK, SYS_GET_TASK, SYS_TEST_PORT,
SYS_IS_IP */
SYS_IS_IP, ENV */
////////////////////////////////////////////////////////////////////////////////
/// @brief module "internal"
@ -1867,6 +1867,16 @@
return Math.floor(Math.random() * (n + 1)) * i;
};
////////////////////////////////////////////////////////////////////////////////
/// @brief exponentialBackoff
////////////////////////////////////////////////////////////////////////////////
if (typeof(ENV) !== 'undefined') {
exports.env = new ENV();
delete ENV;
}
}());
// -----------------------------------------------------------------------------

View File

@ -1,4 +1,6 @@
exports.env = {};
/*jshint esnext: true, strict: false, unused: false, -W051: true */
/*global require */
exports.env = require("internal").env;
exports.stdout = {
isTTY: false
};

View File

@ -205,6 +205,7 @@ add_library(
V8/v8-json.cpp
V8/v8-shell.cpp
V8/v8-utils.cpp
V8/v8-environment.cpp
SimpleHttpClient/GeneralClientConnection.cpp
SimpleHttpClient/ClientConnection.cpp
SimpleHttpClient/ConnectionManager.cpp

View File

@ -188,6 +188,7 @@ lib_libarango_v8_a_SOURCES = \
lib/V8/v8-json.cpp \
lib/V8/v8-shell.cpp \
lib/V8/v8-utils.cpp \
lib/V8/v8-environment.cpp \
lib/SimpleHttpClient/GeneralClientConnection.cpp \
lib/SimpleHttpClient/ClientConnection.cpp \
lib/SimpleHttpClient/SslClientConnection.cpp \

View File

@ -517,6 +517,12 @@ typedef struct TRI_v8_global_s {
v8::Persistent<v8::ObjectTemplate> VocbaseTempl;
////////////////////////////////////////////////////////////////////////////////
/// @brief TRI_vocbase_t template
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::ObjectTemplate> EnvTempl;
// -----------------------------------------------------------------------------
// --SECTION-- JAVASCRIPT FUNCTION TEMPLATES
// -----------------------------------------------------------------------------

View File

@ -4128,6 +4128,11 @@ void TRI_RunGarbageCollectionV8 (v8::Isolate* isolate,
/// @brief stores the V8 utils functions inside the global variable
////////////////////////////////////////////////////////////////////////////////
extern void TRI_InitV8Env (v8::Isolate* isolate,
v8::Handle<v8::Context> context,
string const& startupPath,
string const& modules);
void TRI_InitV8Utils (v8::Isolate* isolate,
v8::Handle<v8::Context> context,
string const& startupPath,
@ -4278,6 +4283,8 @@ void TRI_InitV8Utils (v8::Isolate* isolate,
TRI_AddGlobalVariableVocbase(isolate, context, TRI_V8_ASCII_STRING("BYTES_RECEIVED_DISTRIBUTION"), DistributionList(isolate, TRI_BytesReceivedDistributionVectorStatistics));
TRI_AddGlobalVariableVocbase(isolate, context, TRI_V8_ASCII_STRING("SYS_PLATFORM"), TRI_V8_ASCII_STRING(TRI_PLATFORM));
TRI_InitV8Env(isolate, context, startupPath, modules);
}
// -----------------------------------------------------------------------------