| Index: Source/bindings/tests/results/V8TestSpecialOperations.cpp
|
| diff --git a/Source/bindings/tests/results/V8TestInterfaceDocument.cpp b/Source/bindings/tests/results/V8TestSpecialOperations.cpp
|
| similarity index 66%
|
| copy from Source/bindings/tests/results/V8TestInterfaceDocument.cpp
|
| copy to Source/bindings/tests/results/V8TestSpecialOperations.cpp
|
| index 8e4e1c24bada923096779291bfe15094d29817f9..5527f7d64a62d675ab0994e85134d33a413277f8 100644
|
| --- a/Source/bindings/tests/results/V8TestInterfaceDocument.cpp
|
| +++ b/Source/bindings/tests/results/V8TestSpecialOperations.cpp
|
| @@ -31,25 +31,22 @@
|
| // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
|
|
|
| #include "config.h"
|
| -#include "V8TestInterfaceDocument.h"
|
| +#include "V8TestSpecialOperations.h"
|
|
|
| #include "RuntimeEnabledFeatures.h"
|
| #include "bindings/v8/ExceptionState.h"
|
| -#include "bindings/v8/ScriptController.h"
|
| #include "bindings/v8/V8DOMConfiguration.h"
|
| #include "bindings/v8/V8ObjectConstructor.h"
|
| -#include "bindings/v8/V8WindowShell.h"
|
| #include "core/dom/ContextFeatures.h"
|
| #include "core/dom/Document.h"
|
| -#include "core/frame/Frame.h"
|
| #include "platform/TraceEvent.h"
|
|
|
| namespace WebCore {
|
|
|
| -static void initializeScriptWrappableForInterface(TestInterfaceDocument* object)
|
| +static void initializeScriptWrappableForInterface(TestSpecialOperations* object)
|
| {
|
| if (ScriptWrappable::wrapperCanBeStoredInObject(object))
|
| - ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceDocument::wrapperTypeInfo);
|
| + ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperations::wrapperTypeInfo);
|
| else
|
| ASSERT_NOT_REACHED();
|
| }
|
| @@ -60,38 +57,55 @@ static void initializeScriptWrappableForInterface(TestInterfaceDocument* object)
|
| // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
|
| // in the global namespace.
|
| // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c)
|
| -void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceDocument* object)
|
| +void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations* object)
|
| {
|
| WebCore::initializeScriptWrappableForInterface(object);
|
| }
|
|
|
| namespace WebCore {
|
| -const WrapperTypeInfo V8TestInterfaceDocument::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceDocument::domTemplate, V8TestInterfaceDocument::derefObject, 0, V8TestInterfaceDocument::toEventTarget, 0, V8TestInterfaceDocument::installPerContextEnabledMethods, &V8Document::wrapperTypeInfo, WrapperTypeObjectPrototype };
|
| +const WrapperTypeInfo V8TestSpecialOperations::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperations::domTemplate, V8TestSpecialOperations::derefObject, 0, 0, 0, V8TestSpecialOperations::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype };
|
|
|
| -namespace TestInterfaceDocumentV8Internal {
|
| +namespace TestSpecialOperationsV8Internal {
|
|
|
| template <typename T> void V8_USE(T) { }
|
|
|
| -} // namespace TestInterfaceDocumentV8Internal
|
| +static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| +{
|
| + TestSpecialOperations* collection = V8TestSpecialOperations::toNative(info.Holder());
|
| + String element = collection->anonymousIndexedGetter(index);
|
| + if (element.isNull())
|
| + return;
|
| + v8SetReturnValueString(info, element, info.GetIsolate());
|
| +}
|
|
|
| -static void configureV8TestInterfaceDocumentTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| +{
|
| + TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
|
| + TestSpecialOperationsV8Internal::indexedPropertyGetter(index, info);
|
| + TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
|
| +}
|
| +
|
| +} // namespace TestSpecialOperationsV8Internal
|
| +
|
| +static void configureV8TestSpecialOperationsTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| functionTemplate->ReadOnlyPrototype();
|
|
|
| v8::Local<v8::Signature> defaultSignature;
|
| - defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceDocument", V8Document::domTemplate(isolate, currentWorldType), V8TestInterfaceDocument::internalFieldCount,
|
| + defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestSpecialOperations", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOperations::internalFieldCount,
|
| 0, 0,
|
| 0, 0,
|
| 0, 0,
|
| isolate, currentWorldType);
|
| v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();
|
| v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();
|
| + functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialOperationsV8Internal::indexedPropertyGetterCallback, 0, 0, 0, indexedPropertyEnumerator<TestSpecialOperations>);
|
|
|
| // Custom toString template
|
| functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::current()->toStringTemplate());
|
| }
|
|
|
| -v8::Handle<v8::FunctionTemplate> V8TestInterfaceDocument::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +v8::Handle<v8::FunctionTemplate> V8TestSpecialOperations::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| V8PerIsolateData* data = V8PerIsolateData::from(isolate);
|
| V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&wrapperTypeInfo);
|
| @@ -101,39 +115,21 @@ v8::Handle<v8::FunctionTemplate> V8TestInterfaceDocument::domTemplate(v8::Isolat
|
| TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
|
| v8::EscapableHandleScope handleScope(isolate);
|
| v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
|
| - configureV8TestInterfaceDocumentTemplate(templ, isolate, currentWorldType);
|
| + configureV8TestSpecialOperationsTemplate(templ, isolate, currentWorldType);
|
| data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTemplate>(isolate, templ));
|
| return handleScope.Escape(templ);
|
| }
|
|
|
| -bool V8TestInterfaceDocument::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
|
| +bool V8TestSpecialOperations::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
|
| {
|
| return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeInfo, jsValue)
|
| || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTypeInfo, jsValue);
|
| }
|
|
|
| -EventTarget* V8TestInterfaceDocument::toEventTarget(v8::Handle<v8::Object> object)
|
| -{
|
| - return toNative(object);
|
| -}
|
| -
|
| -v8::Handle<v8::Object> wrap(TestInterfaceDocument* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Object> V8TestSpecialOperations::createWrapper(PassRefPtr<TestSpecialOperations> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| ASSERT(impl);
|
| - v8::Handle<v8::Object> wrapper = V8TestInterfaceDocument::createWrapper(impl, creationContext, isolate);
|
| - if (wrapper.IsEmpty())
|
| - return wrapper;
|
| - if (!isolatedWorldForEnteredContext(isolate)) {
|
| - if (Frame* frame = impl->frame())
|
| - frame->script().windowShell(mainThreadNormalWorld())->updateDocumentWrapper(wrapper);
|
| - }
|
| - return wrapper;
|
| -}
|
| -
|
| -v8::Handle<v8::Object> V8TestInterfaceDocument::createWrapper(PassRefPtr<TestInterfaceDocument> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - ASSERT(impl);
|
| - ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDocument>(impl.get(), isolate));
|
| + ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperations>(impl.get(), isolate));
|
| if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
|
| const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get());
|
| // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
|
| @@ -141,30 +137,22 @@ v8::Handle<v8::Object> V8TestInterfaceDocument::createWrapper(PassRefPtr<TestInt
|
| RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
|
| }
|
|
|
| - if (Frame* frame = impl->frame()) {
|
| - if (frame->script().initializeMainWorld()) {
|
| - // initializeMainWorld may have created a wrapper for the object, retry from the start.
|
| - v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<V8TestInterfaceDocument>(impl.get(), isolate);
|
| - if (!wrapper.IsEmpty())
|
| - return wrapper;
|
| - }
|
| - }
|
| v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
|
| if (UNLIKELY(wrapper.IsEmpty()))
|
| return wrapper;
|
|
|
| installPerContextEnabledProperties(wrapper, impl.get(), isolate);
|
| - V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceDocument>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
|
| + V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperations>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
|
| return wrapper;
|
| }
|
|
|
| -void V8TestInterfaceDocument::derefObject(void* object)
|
| +void V8TestSpecialOperations::derefObject(void* object)
|
| {
|
| fromInternalPointer(object)->deref();
|
| }
|
|
|
| template<>
|
| -v8::Handle<v8::Value> toV8NoInline(TestInterfaceDocument* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Value> toV8NoInline(TestSpecialOperations* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| return toV8(impl, creationContext, isolate);
|
| }
|
|
|