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}
This commit is contained in:
domenic 2015-08-06 16:52:47 -07:00 committed by Commit bot
parent 722ad69238
commit 2dff84e66f
6 changed files with 23 additions and 21 deletions

View File

@ -6606,10 +6606,12 @@ class V8_EXPORT Context {
V8_INLINE Local<Value> GetEmbedderData(int index);
/**
* Gets the exports object used by V8 extras. Extra natives get a reference
* to this object and can use it to export functionality.
* Gets the binding object used by V8 extras. Extra natives get a reference
* 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

View File

@ -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::Isolate* isolate = context->GetIsolate();
i::Handle<i::JSObject> exports(context->extras_exports_object(), isolate);
return Utils::ToLocal(exports);
i::Handle<i::JSObject> binding(context->extras_binding_object(), isolate);
return Utils::ToLocal(binding);
}

View File

@ -1550,8 +1550,8 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) {
Handle<String> source_code =
isolate->bootstrapper()->SourceLookup<ExtraNatives>(index);
Handle<Object> global = isolate->global_object();
Handle<Object> exports = isolate->extras_exports_object();
Handle<Object> args[] = {global, exports};
Handle<Object> binding = isolate->extras_binding_object();
Handle<Object> args[] = {global, binding};
return Bootstrapper::CompileNative(
isolate, name, Handle<JSObject>(isolate->native_context()->builtins()),
source_code, arraysize(args), args);
@ -2099,11 +2099,11 @@ bool Genesis::InstallNatives(ContextType context_type) {
"utils container for native scripts");
native_context()->set_natives_utils_object(*utils);
Handle<JSObject> extras_exports =
Handle<JSObject> extras_binding =
factory()->NewJSObject(isolate()->object_function());
JSObject::NormalizeProperties(extras_exports, CLEAR_INOBJECT_PROPERTIES, 2,
"container to export to extra natives");
native_context()->set_extras_exports_object(*extras_exports);
JSObject::NormalizeProperties(extras_binding, CLEAR_INOBJECT_PROPERTIES, 2,
"container for binding to/from extra natives");
native_context()->set_extras_binding_object(*extras_binding);
if (FLAG_expose_natives_as != NULL) {
Handle<String> utils_key = factory()->NewStringFromAsciiChecked("utils");

View File

@ -201,7 +201,7 @@ enum BindingFlags {
V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \
V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \
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

View File

@ -21632,19 +21632,19 @@ TEST(ExtrasExportsObject) {
// standalone.gypi ensures we include the test-extra.js file, which should
// export the tested functions.
v8::Local<v8::Object> exports = env->GetExtrasExportsObject();
v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
auto func =
exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
binding->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
auto undefined = v8::Undefined(isolate);
auto result = func->Call(undefined, 0, {}).As<v8::Number>();
CHECK_EQ(5, result->Int32Value());
v8::Handle<v8::FunctionTemplate> runtimeFunction =
v8::FunctionTemplate::New(isolate, ExtrasExportsTestRuntimeFunction);
exports->Set(v8_str("runtime"), runtimeFunction->GetFunction());
binding->Set(v8_str("runtime"), runtimeFunction->GetFunction());
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>();
CHECK_EQ(7, result->Int32Value());
}

View File

@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function (global, exports) {
(function (global, binding) {
'use strict';
exports.testExtraShouldReturnFive = function () {
binding.testExtraShouldReturnFive = function () {
return 5;
};
exports.testExtraShouldCallToRuntime = function() {
return exports.runtime(3);
binding.testExtraShouldCallToRuntime = function() {
return binding.runtime(3);
};
})