| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2013 Google Inc. All rights reserved. |    2  * Copyright (C) 2013 Google Inc. All rights reserved. | 
|    3  * |    3  * | 
|    4  * Redistribution and use in source and binary forms, with or without |    4  * Redistribution and use in source and binary forms, with or without | 
|    5  * modification, are permitted provided that the following conditions are |    5  * modification, are permitted provided that the following conditions are | 
|    6  * met: |    6  * met: | 
|    7  * |    7  * | 
|    8  *     * Redistributions of source code must retain the above copyright |    8  *     * Redistributions of source code must retain the above copyright | 
|    9  * notice, this list of conditions and the following disclaimer. |    9  * notice, this list of conditions and the following disclaimer. | 
|   10  *     * Redistributions in binary form must reproduce the above |   10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  233 } |  233 } | 
|  234  |  234  | 
|  235 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
     nfo) |  235 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
     nfo) | 
|  236 { |  236 { | 
|  237     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |  237     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 
|  238     TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |  238     TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 
|  239     Vector<String> names; |  239     Vector<String> names; | 
|  240     collection->namedPropertyEnumerator(names, exceptionState); |  240     collection->namedPropertyEnumerator(names, exceptionState); | 
|  241     if (exceptionState.throwIfNeeded()) |  241     if (exceptionState.throwIfNeeded()) | 
|  242         return; |  242         return; | 
|  243     v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); |  243     v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
     ()); | 
|  244     for (size_t i = 0; i < names.size(); ++i) |  244     for (size_t i = 0; i < names.size(); ++i) | 
|  245         v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i], 
     info.GetIsolate())); |  245         v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(names[i], 
     info.GetIsolate())); | 
|  246     v8SetReturnValue(info, v8names); |  246     v8SetReturnValue(info, v8names); | 
|  247 } |  247 } | 
|  248  |  248  | 
|  249 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
     lbackInfo<v8::Integer>& info) |  249 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
     lbackInfo<v8::Integer>& info) | 
|  250 { |  250 { | 
|  251     TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |  251     TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 
|  252     AtomicString propertyName = toWebCoreAtomicString(name); |  252     AtomicString propertyName = toWebCoreAtomicString(name); | 
|  253     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |  253     ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 
|  254     bool result = collection->namedPropertyQuery(propertyName, exceptionState); |  254     bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 
|  255     if (exceptionState.throwIfNeeded()) |  255     if (exceptionState.throwIfNeeded()) | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  293     UNUSED_PARAM(defaultSignature); |  293     UNUSED_PARAM(defaultSignature); | 
|  294     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); |  294     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
     emplate(); | 
|  295     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); |  295     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
     eTemplate(); | 
|  296     UNUSED_PARAM(instanceTemplate); |  296     UNUSED_PARAM(instanceTemplate); | 
|  297     UNUSED_PARAM(prototypeTemplate); |  297     UNUSED_PARAM(prototypeTemplate); | 
|  298     functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestEventTar
     getV8Internal::indexedPropertyGetterCallback, TestEventTargetV8Internal::indexed
     PropertySetterCallback, 0, TestEventTargetV8Internal::indexedPropertyDeleterCall
     back, indexedPropertyEnumerator<TestEventTarget>); |  298     functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestEventTar
     getV8Internal::indexedPropertyGetterCallback, TestEventTargetV8Internal::indexed
     PropertySetterCallback, 0, TestEventTargetV8Internal::indexedPropertyDeleterCall
     back, indexedPropertyEnumerator<TestEventTarget>); | 
|  299     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestEventTarge
     tV8Internal::namedPropertyGetterCallback, TestEventTargetV8Internal::namedProper
     tySetterCallback, TestEventTargetV8Internal::namedPropertyQueryCallback, TestEve
     ntTargetV8Internal::namedPropertyDeleterCallback, TestEventTargetV8Internal::nam
     edPropertyEnumeratorCallback); |  299     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestEventTarge
     tV8Internal::namedPropertyGetterCallback, TestEventTargetV8Internal::namedProper
     tySetterCallback, TestEventTargetV8Internal::namedPropertyQueryCallback, TestEve
     ntTargetV8Internal::namedPropertyDeleterCallback, TestEventTargetV8Internal::nam
     edPropertyEnumeratorCallback); | 
|  300     functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |  300     functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 
|  301  |  301  | 
|  302     // Custom toString template |  302     // Custom toString template | 
|  303     functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
     urrent()->toStringTemplate()); |  303     functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
     g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 
|  304     return functionTemplate; |  304     return functionTemplate; | 
|  305 } |  305 } | 
|  306  |  306  | 
|  307 v8::Handle<v8::FunctionTemplate> V8TestEventTarget::GetTemplate(v8::Isolate* iso
     late, WrapperWorldType currentWorldType) |  307 v8::Handle<v8::FunctionTemplate> V8TestEventTarget::GetTemplate(v8::Isolate* iso
     late, WrapperWorldType currentWorldType) | 
|  308 { |  308 { | 
|  309     V8PerIsolateData* data = V8PerIsolateData::from(isolate); |  309     V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 
|  310     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); |  310     V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
     rldType).find(&wrapperTypeInfo); | 
|  311     if (result != data->templateMap(currentWorldType).end()) |  311     if (result != data->templateMap(currentWorldType).end()) | 
|  312         return result->value.newLocal(isolate); |  312         return result->value.newLocal(isolate); | 
|  313  |  313  | 
|  314     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |  314     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 
|  315     v8::HandleScope handleScope(isolate); |  315     v8::EscapableHandleScope handleScope(isolate); | 
|  316     v8::Handle<v8::FunctionTemplate> templ = |  316     v8::Local<v8::FunctionTemplate> templ = | 
|  317         ConfigureV8TestEventTargetTemplate(data->rawTemplate(&wrapperTypeInfo, c
     urrentWorldType), isolate, currentWorldType); |  317         ConfigureV8TestEventTargetTemplate(data->rawTemplate(&wrapperTypeInfo, c
     urrentWorldType), isolate, currentWorldType); | 
|  318     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
     8::FunctionTemplate>(isolate, templ)); |  318     data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
     8::FunctionTemplate>(isolate, templ)); | 
|  319     return handleScope.Close(templ); |  319     return handleScope.Escape(templ); | 
|  320 } |  320 } | 
|  321  |  321  | 
|  322 bool V8TestEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* 
     isolate, WrapperWorldType currentWorldType) |  322 bool V8TestEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* 
     isolate, WrapperWorldType currentWorldType) | 
|  323 { |  323 { | 
|  324     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, currentWorldType); |  324     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, currentWorldType); | 
|  325 } |  325 } | 
|  326  |  326  | 
|  327 bool V8TestEventTarget::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8:
     :Isolate* isolate) |  327 bool V8TestEventTarget::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8:
     :Isolate* isolate) | 
|  328 { |  328 { | 
|  329     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, MainWorld) |  329     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
     e, MainWorld) | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  361     fromInternalPointer(object)->deref(); |  361     fromInternalPointer(object)->deref(); | 
|  362 } |  362 } | 
|  363  |  363  | 
|  364 template<> |  364 template<> | 
|  365 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
      creationContext, v8::Isolate* isolate) |  365 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
      creationContext, v8::Isolate* isolate) | 
|  366 { |  366 { | 
|  367     return toV8(impl, creationContext, isolate); |  367     return toV8(impl, creationContext, isolate); | 
|  368 } |  368 } | 
|  369  |  369  | 
|  370 } // namespace WebCore |  370 } // namespace WebCore | 
| OLD | NEW |