Commit 2dff84e6 authored by domenic's avatar domenic Committed by Commit bot

Rename "extras exports" to "extras binding"

R=yangguo@chromium.org, jochen@chromium.org
BUG=507133
LOG=Y

Review URL: https://codereview.chromium.org/1275683002

Cr-Commit-Position: refs/heads/master@{#30053}
parent 722ad692
...@@ -6606,10 +6606,12 @@ class V8_EXPORT Context { ...@@ -6606,10 +6606,12 @@ class V8_EXPORT Context {
V8_INLINE Local<Value> GetEmbedderData(int index); V8_INLINE Local<Value> GetEmbedderData(int index);
/** /**
* Gets the exports object used by V8 extras. Extra natives get a reference * Gets the binding object used by V8 extras. Extra natives get a reference
* to this object and can use it to export functionality. * to this object and can use it to "export" functionality by adding
* properties. Extra natives can also "import" functionality by accessing
* properties added by the embedder using the V8 API.
*/ */
Local<Object> GetExtrasExportsObject(); Local<Object> GetExtrasBindingObject();
/** /**
* Sets the embedder data with the given index, growing the data as * Sets the embedder data with the given index, growing the data as
......
...@@ -5545,11 +5545,11 @@ void Context::DetachGlobal() { ...@@ -5545,11 +5545,11 @@ void Context::DetachGlobal() {
} }
Local<v8::Object> Context::GetExtrasExportsObject() { Local<v8::Object> Context::GetExtrasBindingObject() {
i::Handle<i::Context> context = Utils::OpenHandle(this); i::Handle<i::Context> context = Utils::OpenHandle(this);
i::Isolate* isolate = context->GetIsolate(); i::Isolate* isolate = context->GetIsolate();
i::Handle<i::JSObject> exports(context->extras_exports_object(), isolate); i::Handle<i::JSObject> binding(context->extras_binding_object(), isolate);
return Utils::ToLocal(exports); return Utils::ToLocal(binding);
} }
......
...@@ -1550,8 +1550,8 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { ...@@ -1550,8 +1550,8 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) {
Handle<String> source_code = Handle<String> source_code =
isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); isolate->bootstrapper()->SourceLookup<ExtraNatives>(index);
Handle<Object> global = isolate->global_object(); Handle<Object> global = isolate->global_object();
Handle<Object> exports = isolate->extras_exports_object(); Handle<Object> binding = isolate->extras_binding_object();
Handle<Object> args[] = {global, exports}; Handle<Object> args[] = {global, binding};
return Bootstrapper::CompileNative( return Bootstrapper::CompileNative(
isolate, name, Handle<JSObject>(isolate->native_context()->builtins()), isolate, name, Handle<JSObject>(isolate->native_context()->builtins()),
source_code, arraysize(args), args); source_code, arraysize(args), args);
...@@ -2099,11 +2099,11 @@ bool Genesis::InstallNatives(ContextType context_type) { ...@@ -2099,11 +2099,11 @@ bool Genesis::InstallNatives(ContextType context_type) {
"utils container for native scripts"); "utils container for native scripts");
native_context()->set_natives_utils_object(*utils); native_context()->set_natives_utils_object(*utils);
Handle<JSObject> extras_exports = Handle<JSObject> extras_binding =
factory()->NewJSObject(isolate()->object_function()); factory()->NewJSObject(isolate()->object_function());
JSObject::NormalizeProperties(extras_exports, CLEAR_INOBJECT_PROPERTIES, 2, JSObject::NormalizeProperties(extras_binding, CLEAR_INOBJECT_PROPERTIES, 2,
"container to export to extra natives"); "container for binding to/from extra natives");
native_context()->set_extras_exports_object(*extras_exports); native_context()->set_extras_binding_object(*extras_binding);
if (FLAG_expose_natives_as != NULL) { if (FLAG_expose_natives_as != NULL) {
Handle<String> utils_key = factory()->NewStringFromAsciiChecked("utils"); Handle<String> utils_key = factory()->NewStringFromAsciiChecked("utils");
......
...@@ -201,7 +201,7 @@ enum BindingFlags { ...@@ -201,7 +201,7 @@ enum BindingFlags {
V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \ V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \
V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \ V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \
V(NATIVES_UTILS_OBJECT_INDEX, Object, natives_utils_object) \ V(NATIVES_UTILS_OBJECT_INDEX, Object, natives_utils_object) \
V(EXTRAS_EXPORTS_OBJECT_INDEX, JSObject, extras_exports_object) V(EXTRAS_EXPORTS_OBJECT_INDEX, JSObject, extras_binding_object)
// A table of all script contexts. Every loaded top-level script with top-level // A table of all script contexts. Every loaded top-level script with top-level
......
...@@ -21632,19 +21632,19 @@ TEST(ExtrasExportsObject) { ...@@ -21632,19 +21632,19 @@ TEST(ExtrasExportsObject) {
// standalone.gypi ensures we include the test-extra.js file, which should // standalone.gypi ensures we include the test-extra.js file, which should
// export the tested functions. // export the tested functions.
v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
auto func = auto func =
exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); binding->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
auto undefined = v8::Undefined(isolate); auto undefined = v8::Undefined(isolate);
auto result = func->Call(undefined, 0, {}).As<v8::Number>(); auto result = func->Call(undefined, 0, {}).As<v8::Number>();
CHECK_EQ(5, result->Int32Value()); CHECK_EQ(5, result->Int32Value());
v8::Handle<v8::FunctionTemplate> runtimeFunction = v8::Handle<v8::FunctionTemplate> runtimeFunction =
v8::FunctionTemplate::New(isolate, ExtrasExportsTestRuntimeFunction); v8::FunctionTemplate::New(isolate, ExtrasExportsTestRuntimeFunction);
exports->Set(v8_str("runtime"), runtimeFunction->GetFunction()); binding->Set(v8_str("runtime"), runtimeFunction->GetFunction());
func = func =
exports->Get(v8_str("testExtraShouldCallToRuntime")).As<v8::Function>(); binding->Get(v8_str("testExtraShouldCallToRuntime")).As<v8::Function>();
result = func->Call(undefined, 0, {}).As<v8::Number>(); result = func->Call(undefined, 0, {}).As<v8::Number>();
CHECK_EQ(7, result->Int32Value()); CHECK_EQ(7, result->Int32Value());
} }
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
(function (global, exports) { (function (global, binding) {
'use strict'; 'use strict';
exports.testExtraShouldReturnFive = function () { binding.testExtraShouldReturnFive = function () {
return 5; return 5;
}; };
exports.testExtraShouldCallToRuntime = function() { binding.testExtraShouldCallToRuntime = function() {
return exports.runtime(3); return binding.runtime(3);
}; };
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment