1
0
Fork 0

Merge branches 'devel' and 'devel' of ssh://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
James 2014-10-17 10:22:33 +01:00
commit 15e2c87823
13 changed files with 202 additions and 152 deletions

View File

@ -1,221 +1,221 @@
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary { article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary {
display: block display: block
} }
audio,canvas,video { audio,canvas,video {
display: inline-block display: inline-block
} }
audio:not([controls]) { audio:not([controls]) {
display: none; display: none;
height: 0 height: 0
} }
[hidden] { [hidden] {
display: none display: none
} }
html { html {
font-family: sans-serif; font-family: sans-serif;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100% -ms-text-size-adjust: 100%
} }
body { body {
margin: 0 margin: 0
} }
a:focus { a:focus {
outline: thin dotted outline: thin dotted
} }
a:active,a:hover { a:active,a:hover {
outline: 0 outline: 0
} }
h1 { h1 {
font-size: 2em; font-size: 2em;
margin: .67em 0 margin: .67em 0
} }
abbr[title] { abbr[title] {
border-bottom: 1px dotted border-bottom: 1px dotted
} }
b,strong { b,strong {
font-weight: bold font-weight: bold
} }
dfn { dfn {
font-style: italic font-style: italic
} }
hr { hr {
-moz-box-sizing: content-box; -moz-box-sizing: content-box;
box-sizing: content-box; box-sizing: content-box;
height: 0 height: 0
} }
mark { mark {
background: #ff0; background: #ff0;
color: #000 color: #000
} }
code,kbd,pre,samp { code,kbd,pre,samp {
font-family: monospace,serif; font-family: monospace,serif;
font-size: 1em font-size: 1em
} }
pre { pre {
white-space: pre-wrap white-space: pre-wrap
} }
q { q {
quotes: "\201C" "\201D" "\2018" "\2019" quotes: "\201C" "\201D" "\2018" "\2019"
} }
small { small {
font-size: 80% font-size: 80%
} }
sub,sup { sub,sup {
font-size: 75%; font-size: 75%;
line-height: 0; line-height: 0;
position: relative; position: relative;
vertical-align: baseline vertical-align: baseline
} }
sup { sup {
top: -0.5em top: -0.5em
} }
sub { sub {
bottom: -0.25em bottom: -0.25em
} }
img { img {
border: 0 border: 0
} }
svg:not(:root) { svg:not(:root) {
overflow: hidden overflow: hidden
} }
figure { figure {
margin: 0 margin: 0
} }
fieldset { fieldset {
border: 1px solid #c0c0c0; border: 1px solid #c0c0c0;
margin: 0 2px; margin: 0 2px;
padding: .35em .625em .75em padding: .35em .625em .75em
} }
legend { legend {
border: 0; border: 0;
padding: 0 padding: 0
} }
button,input,select,textarea { button,input,select,textarea {
font-family: inherit; font-family: inherit;
font-size: 100%; font-size: 100%;
margin: 0 margin: 0
} }
button,input { button,input {
line-height: normal line-height: normal
} }
button,select { button,select {
text-transform: none text-transform: none
} }
button,html input[type="button"],input[type="reset"],input[type="submit"] { button,html input[type="button"],input[type="reset"],input[type="submit"] {
-webkit-appearance: button; -webkit-appearance: button;
cursor: pointer cursor: pointer
} }
button[disabled],html input[disabled] { button[disabled],html input[disabled] {
cursor: default cursor: default
} }
input[type="checkbox"],input[type="radio"] { input[type="checkbox"],input[type="radio"] {
box-sizing: border-box; box-sizing: border-box;
padding: 0 padding: 0
} }
input[type="search"] { input[type="search"] {
-webkit-appearance: textfield; -webkit-appearance: textfield;
-moz-box-sizing: content-box; -moz-box-sizing: content-box;
-webkit-box-sizing: content-box; -webkit-box-sizing: content-box;
box-sizing: content-box box-sizing: content-box
} }
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration { input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none -webkit-appearance: none
} }
button::-moz-focus-inner,input::-moz-focus-inner { button::-moz-focus-inner,input::-moz-focus-inner {
border: 0; border: 0;
padding: 0 padding: 0
} }
textarea { textarea {
overflow: auto; overflow: auto;
vertical-align: top vertical-align: top
} }
table { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0 border-spacing: 0
} }
@font-face { @font-face {
font-family: 'FontAwesome'; font-family: 'FontAwesome';
src: url('.//fonts/fontawesome/fontawesome-webfont.eot?v=4.1.0'); src: url('.//fonts/fontawesome/fontawesome-webfont.eot?v=4.1.0');
src: url('.//fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('.//fonts/fontawesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('.//fonts/fontawesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('.//fonts/fontawesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg'); src: url('.//fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('.//fonts/fontawesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('.//fonts/fontawesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('.//fonts/fontawesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal font-style: normal
} }
.fa { .fa {
display: inline-block; display: inline-block;
font-family: FontAwesome; font-family: FontAwesome;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
line-height: 1; line-height: 1;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale -moz-osx-font-smoothing: grayscale
} }
.fa-lg { .fa-lg {
font-size: 1.3333333333333333em; font-size: 1.3333333333333333em;
line-height: .75em; line-height: .75em;
vertical-align: -15% vertical-align: -15%
} }
.fa-2x { .fa-2x {
font-size: 2em font-size: 2em
} }
.fa-3x { .fa-3x {
font-size: 3em font-size: 3em
} }
.fa-4x { .fa-4x {
font-size: 4em font-size: 4em
} }
.fa-5x { .fa-5x {
font-size: 5em font-size: 5em
} }
.fa-fw { .fa-fw {
width: 1.2857142857142858em; width: 1.2857142857142858em;
text-align: center text-align: center
} }
.fa-ul { .fa-ul {
padding-left: 0; padding-left: 0;
margin-left: 2.142857142857143em; margin-left: 2.142857142857143em;
list-style-type: none list-style-type: none
} }
.fa-ul>li { .fa-ul>li {
position: relative position: relative
} }
.fa-li { .fa-li {
position: absolute; position: absolute;
left: -2.142857142857143em; left: -2.142857142857143em;
width: 2.142857142857143em; width: 2.142857142857143em;
top: .14285714285714285em; top: .14285714285714285em;
text-align: center text-align: center
} }
.fa-li.fa-lg { .fa-li.fa-lg {
left: -1.8571428571428572em left: -1.8571428571428572em
} }
.fa-border { .fa-border {
padding: .2em .25em .15em; padding: .2em .25em .15em;
border: solid .08em #eee; border: solid .08em #eee;
border-radius: .1em border-radius: .1em
} }
.pull-right { .pull-right {
float: right float: right
} }
.pull-left { .pull-left {
float: left float: left
} }
.fa.pull-left { .fa.pull-left {
margin-right: .3em margin-right: .3em
} }
.fa.pull-right { .fa.pull-right {
margin-left: .3em margin-left: .3em
} }
.fa-spin { .fa-spin {
-webkit-animation: spin 2s infinite linear; -webkit-animation: spin 2s infinite linear;
-moz-animation: spin 2s infinite linear; -moz-animation: spin 2s infinite linear;
-o-animation: spin 2s infinite linear; -o-animation: spin 2s infinite linear;
animation: spin 2s infinite linear animation: spin 2s infinite linear
} }
@-moz-keyframes spin {0% { @-moz-keyframes spin {0% {
-moz-transform: rotate(0deg) -moz-transform: rotate(0deg)
} }
100% { 100% {
-moz-transform: rotate(359deg) -moz-transform: rotate(359deg)
} }
} }
@ -1634,6 +1634,9 @@ color: inherit
.hidden { .hidden {
display: none display: none
} }
.lets-see-who-copies-this: {
font-family: 'proven!';
}
@font-face { @font-face {
font-family: 'Merriweather'; font-family: 'Merriweather';
font-style: normal; font-style: normal;
@ -2904,10 +2907,10 @@ font-family: "Open Sans","Clear Sans","Helvetica Neue",Helvetica,Arial,sans-seri
font-size: 14px font-size: 14px
} }
div.example_show_button { div.example_show_button {
border: medium solid lightgray; border: medium solid lightgray;
text-align: center; text-align: center;
position: relative; position: relative;
top: -10px; top: -10px;
} }
.book .book-body .page-wrapper .page-inner section.normal .deprecated{ .book .book-body .page-wrapper .page-inner section.normal .deprecated{
@ -2919,26 +2922,26 @@ background-color: rgba(240,240,0,0.4);
} }
#clear-search { #clear-search {
display: inline; display: inline;
position: absolute; position: absolute;
top: 12px; top: 12px;
right: 9px; right: 9px;
font-size: 18pt; font-size: 18pt;
line-height: 18pt; line-height: 18pt;
color: #364149; // needs to be updated on theme change color: #364149; // needs to be updated on theme change
} }
#clear-search:hover { #clear-search:hover {
color: #008cff; // needs to be updated on theme change color: #008cff; // needs to be updated on theme change
text-decoration: none; text-decoration: none;
} }
.book .book-summary .book-search input{ .book .book-summary .book-search input{
padding-right: 20px !important; padding-right: 20px !important;
} }
.book .book-header { .book .book-header {
background-color: #FFFFFF !important; background-color: #FFFFFF !important;
width: 84%; width: 84%;
position:fixed !important; position:fixed !important;
} }

View File

@ -40,6 +40,7 @@
#include "Utils/AqlTransaction.h" #include "Utils/AqlTransaction.h"
#include "Utils/Exception.h" #include "Utils/Exception.h"
#include "Utils/V8TransactionContext.h" #include "Utils/V8TransactionContext.h"
#include "V8Server/ApplicationV8.h"
#include "VocBase/vocbase.h" #include "VocBase/vocbase.h"
using namespace triagens::aql; using namespace triagens::aql;
@ -115,13 +116,15 @@ TRI_json_t* Profile::toJson (TRI_memory_zone_t*) {
/// @brief creates a query /// @brief creates a query
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Query::Query (TRI_vocbase_t* vocbase, Query::Query (triagens::arango::ApplicationV8* applicationV8,
TRI_vocbase_t* vocbase,
char const* queryString, char const* queryString,
size_t queryLength, size_t queryLength,
TRI_json_t* bindParameters, TRI_json_t* bindParameters,
TRI_json_t* options, TRI_json_t* options,
QueryPart part) QueryPart part)
: _vocbase(vocbase), : _applicationV8(applicationV8),
_vocbase(vocbase),
_executor(nullptr), _executor(nullptr),
_queryString(queryString), _queryString(queryString),
_queryLength(queryLength), _queryLength(queryLength),
@ -156,11 +159,13 @@ Query::Query (TRI_vocbase_t* vocbase,
/// @brief creates a query from Json /// @brief creates a query from Json
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Query::Query (TRI_vocbase_t* vocbase, Query::Query (triagens::arango::ApplicationV8* applicationV8,
TRI_vocbase_t* vocbase,
triagens::basics::Json queryStruct, triagens::basics::Json queryStruct,
TRI_json_t* options, TRI_json_t* options,
QueryPart part) QueryPart part)
: _vocbase(vocbase), : _applicationV8(applicationV8),
_vocbase(vocbase),
_executor(nullptr), _executor(nullptr),
_queryString(nullptr), _queryString(nullptr),
_queryLength(0), _queryLength(0),
@ -242,7 +247,8 @@ Query* Query::clone (QueryPart part) {
std::unique_ptr<Query> clone; std::unique_ptr<Query> clone;
try { try {
clone.reset(new Query(_vocbase, clone.reset(new Query(_applicationV8,
_vocbase,
_queryString, _queryString,
_queryLength, _queryLength,
nullptr, nullptr,

View File

@ -43,6 +43,10 @@ struct TRI_json_t;
struct TRI_vocbase_s; struct TRI_vocbase_s;
namespace triagens { namespace triagens {
namespace arango {
class ApplicationV8;
}
namespace aql { namespace aql {
struct AstNode; struct AstNode;
@ -127,14 +131,16 @@ namespace triagens {
public: public:
Query (struct TRI_vocbase_s*, Query (triagens::arango::ApplicationV8*,
struct TRI_vocbase_s*,
char const*, char const*,
size_t, size_t,
struct TRI_json_t*, struct TRI_json_t*,
struct TRI_json_t*, struct TRI_json_t*,
QueryPart); QueryPart);
Query (struct TRI_vocbase_s*, Query (triagens::arango::ApplicationV8*,
struct TRI_vocbase_s*,
triagens::basics::Json queryStruct, triagens::basics::Json queryStruct,
struct TRI_json_t*, struct TRI_json_t*,
QueryPart); QueryPart);
@ -416,6 +422,12 @@ namespace triagens {
private: private:
////////////////////////////////////////////////////////////////////////////////
/// @brief application v8 used in the query, we need this for V8 context access
////////////////////////////////////////////////////////////////////////////////
triagens::arango::ApplicationV8* _applicationV8;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief all nodes created in the AST - will be used for freeing them later /// @brief all nodes created in the AST - will be used for freeing them later
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -127,7 +127,7 @@ void RestAqlHandler::createQueryFromJson () {
std::string const part = JsonHelper::getStringValue(queryJson.json(), "part", ""); std::string const part = JsonHelper::getStringValue(queryJson.json(), "part", "");
auto query = new Query(_vocbase, plan, options.steal(), (part == "main" ? PART_MAIN : PART_DEPENDENT)); auto query = new Query(_applicationV8, _vocbase, plan, options.steal(), (part == "main" ? PART_MAIN : PART_DEPENDENT));
QueryResult res = query->prepare(_queryRegistry); QueryResult res = query->prepare(_queryRegistry);
if (res.code != TRI_ERROR_NO_ERROR) { if (res.code != TRI_ERROR_NO_ERROR) {
generateError(HttpResponse::BAD, TRI_ERROR_QUERY_BAD_JSON_PLAN, generateError(HttpResponse::BAD, TRI_ERROR_QUERY_BAD_JSON_PLAN,
@ -188,7 +188,7 @@ void RestAqlHandler::parseQuery () {
return; return;
} }
auto query = new Query(_vocbase, queryString.c_str(), queryString.size(), auto query = new Query(_applicationV8, _vocbase, queryString.c_str(), queryString.size(),
nullptr, nullptr, PART_MAIN); nullptr, nullptr, PART_MAIN);
QueryResult res = query->parse(); QueryResult res = query->parse();
if (res.code != TRI_ERROR_NO_ERROR) { if (res.code != TRI_ERROR_NO_ERROR) {
@ -244,7 +244,7 @@ void RestAqlHandler::explainQuery () {
Json options; Json options;
options = queryJson.get("options").copy(); // cannot throw options = queryJson.get("options").copy(); // cannot throw
auto query = new Query(_vocbase, queryString.c_str(), queryString.size(), auto query = new Query(_applicationV8, _vocbase, queryString.c_str(), queryString.size(),
parameters.steal(), options.steal(), PART_MAIN); parameters.steal(), options.steal(), PART_MAIN);
QueryResult res = query->explain(); QueryResult res = query->explain();
if (res.code != TRI_ERROR_NO_ERROR) { if (res.code != TRI_ERROR_NO_ERROR) {
@ -304,7 +304,7 @@ void RestAqlHandler::createQueryFromString () {
Json options; Json options;
options = queryJson.get("options").copy(); // cannot throw options = queryJson.get("options").copy(); // cannot throw
auto query = new Query(_vocbase, queryString.c_str(), queryString.size(), auto query = new Query(_applicationV8, _vocbase, queryString.c_str(), queryString.size(),
parameters.steal(), options.steal(), (part == "main" ? PART_MAIN : PART_DEPENDENT)); parameters.steal(), options.steal(), (part == "main" ? PART_MAIN : PART_DEPENDENT));
QueryResult res = query->prepare(_queryRegistry); QueryResult res = query->prepare(_queryRegistry);
if (res.code != TRI_ERROR_NO_ERROR) { if (res.code != TRI_ERROR_NO_ERROR) {

View File

@ -1224,7 +1224,7 @@ bool ApplicationV8::prepareV8Instance (const string& name, size_t i, bool useAct
context->_context->Enter(); context->_context->Enter();
TRI_InitV8VocBridge(context->_context, _queryRegistry, _server, _vocbase, &_startupLoader, i); TRI_InitV8VocBridge(this, context->_context, _queryRegistry, _server, _vocbase, &_startupLoader, i);
TRI_InitV8Queries(context->_context); TRI_InitV8Queries(context->_context);
TRI_InitV8UserStructures(context->_context); TRI_InitV8UserStructures(context->_context);

View File

@ -1343,8 +1343,7 @@ void TRI_InitV8Actions (v8::Handle<v8::Context> context,
GlobalV8Dealer = applicationV8; GlobalV8Dealer = applicationV8;
// check the isolate // check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate::GetCurrent();
/* TRI_v8_global_t* v8g = */ TRI_CreateV8Globals(isolate);
// ............................................................................. // .............................................................................
// create the global functions // create the global functions

View File

@ -462,8 +462,7 @@ void TRI_InitV8Dispatcher (v8::Handle<v8::Context> context,
GlobalV8Dealer = applicationV8; GlobalV8Dealer = applicationV8;
// check the isolate // check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate::GetCurrent();
/* TRI_v8_global_t* v8g = */ TRI_CreateV8Globals(isolate);
// ............................................................................. // .............................................................................
// create the global functions // create the global functions

View File

@ -819,9 +819,10 @@ static v8::Handle<v8::Value> JS_ParseAql (v8::Arguments const& argv) {
TRI_V8_TYPE_ERROR(scope, "expecting string for <querystring>"); TRI_V8_TYPE_ERROR(scope, "expecting string for <querystring>");
} }
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
string const&& queryString = TRI_ObjectToString(argv[0]); string const&& queryString = TRI_ObjectToString(argv[0]);
triagens::aql::Query query(vocbase, queryString.c_str(), queryString.size(), nullptr, nullptr, triagens::aql::PART_MAIN); triagens::aql::Query query(v8g->_applicationV8, vocbase, queryString.c_str(), queryString.size(), nullptr, nullptr, triagens::aql::PART_MAIN);
auto parseResult = query.parse(); auto parseResult = query.parse();
@ -906,7 +907,8 @@ static v8::Handle<v8::Value> JS_ExplainAql (v8::Arguments const& argv) {
} }
// bind parameters will be freed by the query later // bind parameters will be freed by the query later
triagens::aql::Query query(vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN); TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
triagens::aql::Query query(v8g->_applicationV8, vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN);
auto queryResult = query.explain(); auto queryResult = query.explain();
@ -999,7 +1001,7 @@ static v8::Handle<v8::Value> JS_ExecuteAqlJson (v8::Arguments const& argv) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData()); TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
triagens::aql::Query query(vocbase, Json(TRI_UNKNOWN_MEM_ZONE, queryjson), options, triagens::aql::PART_MAIN); triagens::aql::Query query(v8g->_applicationV8, vocbase, Json(TRI_UNKNOWN_MEM_ZONE, queryjson), options, triagens::aql::PART_MAIN);
auto queryResult = query.execute(static_cast<triagens::aql::QueryRegistry*>(v8g->_queryRegistry)); auto queryResult = query.execute(static_cast<triagens::aql::QueryRegistry*>(v8g->_queryRegistry));
if (queryResult.code != TRI_ERROR_NO_ERROR) { if (queryResult.code != TRI_ERROR_NO_ERROR) {
@ -1136,7 +1138,7 @@ static v8::Handle<v8::Value> JS_ExecuteAql (v8::Arguments const& argv) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData()); TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
// bind parameters will be freed by the query later // bind parameters will be freed by the query later
triagens::aql::Query query(vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN); triagens::aql::Query query(v8g->_applicationV8, vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN);
auto queryResult = query.execute(static_cast<triagens::aql::QueryRegistry*>(v8g->_queryRegistry)); auto queryResult = query.execute(static_cast<triagens::aql::QueryRegistry*>(v8g->_queryRegistry));
if (queryResult.code != TRI_ERROR_NO_ERROR) { if (queryResult.code != TRI_ERROR_NO_ERROR) {
@ -2489,7 +2491,8 @@ void TRI_V8ReloadRouting (v8::Handle<v8::Context> context) {
/// @brief creates a TRI_vocbase_t global context /// @brief creates a TRI_vocbase_t global context
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8VocBridge (v8::Handle<v8::Context> context, void TRI_InitV8VocBridge (triagens::arango::ApplicationV8* applicationV8,
v8::Handle<v8::Context> context,
triagens::aql::QueryRegistry* queryRegistry, triagens::aql::QueryRegistry* queryRegistry,
TRI_server_t* server, TRI_server_t* server,
TRI_vocbase_t* vocbase, TRI_vocbase_t* vocbase,
@ -2502,7 +2505,6 @@ void TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
TRI_v8_global_t* v8g = TRI_CreateV8Globals(isolate); TRI_v8_global_t* v8g = TRI_CreateV8Globals(isolate);
TRI_ASSERT(v8g->_transactionContext == nullptr); TRI_ASSERT(v8g->_transactionContext == nullptr);
v8g->_transactionContext = new V8TransactionContext(true); v8g->_transactionContext = new V8TransactionContext(true);
static_cast<V8TransactionContext*>(v8g->_transactionContext)->makeGlobal(); static_cast<V8TransactionContext*>(v8g->_transactionContext)->makeGlobal();
@ -2517,6 +2519,9 @@ void TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
// register the startup loader // register the startup loader
v8g->_loader = loader; v8g->_loader = loader;
// register the context dealer
v8g->_applicationV8 = applicationV8;
v8::Handle<v8::ObjectTemplate> ArangoNS; v8::Handle<v8::ObjectTemplate> ArangoNS;
v8::Handle<v8::ObjectTemplate> rt; v8::Handle<v8::ObjectTemplate> rt;

View File

@ -45,6 +45,7 @@ namespace triagens {
} }
namespace arango { namespace arango {
class ApplicationV8;
class CollectionNameResolver; class CollectionNameResolver;
class JSLoader; class JSLoader;
} }
@ -95,7 +96,8 @@ void TRI_V8ReloadRouting (v8::Handle<v8::Context>);
/// @brief creates a TRI_vocbase_t global context /// @brief creates a TRI_vocbase_t global context
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8VocBridge (v8::Handle<v8::Context>, void TRI_InitV8VocBridge (triagens::arango::ApplicationV8*,
v8::Handle<v8::Context>,
triagens::aql::QueryRegistry*, triagens::aql::QueryRegistry*,
struct TRI_server_s*, struct TRI_server_s*,
struct TRI_vocbase_s*, struct TRI_vocbase_s*,

View File

@ -1625,7 +1625,7 @@ void TRI_InitV8Buffer (v8::Handle<v8::Context> context) {
// check the isolate // check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();
TRI_v8_global_t* v8g = TRI_CreateV8Globals(isolate); TRI_v8_global_t* v8g = TRI_GetV8Globals(isolate);
// ............................................................................. // .............................................................................
// generate the general SlowBuffer template // generate the general SlowBuffer template

View File

@ -134,6 +134,7 @@ TRI_v8_global_s::TRI_v8_global_s (v8::Isolate* isolate)
_vocbase(nullptr), _vocbase(nullptr),
_allowUseDatabase(true), _allowUseDatabase(true),
_hasDeadObjects(false), _hasDeadObjects(false),
_applicationV8(nullptr),
_loader(nullptr), _loader(nullptr),
_canceled(false) { _canceled(false) {
v8::HandleScope scope; v8::HandleScope scope;
@ -228,14 +229,24 @@ TRI_v8_global_s::~TRI_v8_global_s () {
TRI_v8_global_t* TRI_CreateV8Globals (v8::Isolate* isolate) { TRI_v8_global_t* TRI_CreateV8Globals (v8::Isolate* isolate) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(isolate->GetData()); TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(isolate->GetData());
if (v8g == nullptr) { TRI_ASSERT(v8g == nullptr);
v8g = new TRI_v8_global_t(isolate); v8g = new TRI_v8_global_t(isolate);
isolate->SetData(v8g); isolate->SetData(v8g);
}
return v8g; return v8g;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief returns a global context
////////////////////////////////////////////////////////////////////////////////
TRI_v8_global_t* TRI_GetV8Globals (v8::Isolate* isolate) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(isolate->GetData());
TRI_ASSERT(v8g != nullptr);
return v8g;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief adds a method to an object /// @brief adds a method to an object
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -42,6 +42,7 @@ struct TRI_vocbase_s;
namespace triagens { namespace triagens {
namespace arango { namespace arango {
class ApplicationV8;
class JSLoader; class JSLoader;
} }
} }
@ -809,6 +810,12 @@ typedef struct TRI_v8_global_s {
// --SECTION-- GENERAL // --SECTION-- GENERAL
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief pointer to the context dealer (ApplicationV8*)
////////////////////////////////////////////////////////////////////////////////
triagens::arango::ApplicationV8* _applicationV8;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief pointer to the startup loader (JSLoader*) /// @brief pointer to the startup loader (JSLoader*)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -833,6 +840,12 @@ TRI_v8_global_t;
TRI_v8_global_t* TRI_CreateV8Globals(v8::Isolate*); TRI_v8_global_t* TRI_CreateV8Globals(v8::Isolate*);
////////////////////////////////////////////////////////////////////////////////
/// @brief gets the global context
////////////////////////////////////////////////////////////////////////////////
TRI_v8_global_t* TRI_GetV8Globals(v8::Isolate*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief adds a method to the prototype of an object /// @brief adds a method to the prototype of an object
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -3792,7 +3792,7 @@ void TRI_InitV8Utils (v8::Handle<v8::Context> context,
// check the isolate // check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();
TRI_v8_global_t* v8g = TRI_CreateV8Globals(isolate); TRI_v8_global_t* v8g = TRI_GetV8Globals(isolate);
v8::Handle<v8::FunctionTemplate> ft; v8::Handle<v8::FunctionTemplate> ft;
v8::Handle<v8::ObjectTemplate> rt; v8::Handle<v8::ObjectTemplate> rt;