OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 v8::Local<v8::Function> shadowConstructor = shadowTemplate->GetFunction(); | 97 v8::Local<v8::Function> shadowConstructor = shadowTemplate->GetFunction(); |
98 if (shadowConstructor.IsEmpty()) | 98 if (shadowConstructor.IsEmpty()) |
99 return v8::Local<v8::Object>(); | 99 return v8::Local<v8::Object>(); |
100 | 100 |
101 v8::Local<v8::Object> shadow = V8ScriptRunner::instantiateObject(shadowConst
ructor); | 101 v8::Local<v8::Object> shadow = V8ScriptRunner::instantiateObject(shadowConst
ructor); |
102 if (shadow.IsEmpty()) | 102 if (shadow.IsEmpty()) |
103 return v8::Local<v8::Object>(); | 103 return v8::Local<v8::Object>(); |
104 shadow->SetPrototype(wrapper); | 104 shadow->SetPrototype(wrapper); |
105 V8DOMWrapper::setNativeInfo(wrapper, &V8HTMLDocument::info, impl); | 105 V8DOMWrapper::setNativeInfo(wrapper, &V8HTMLDocument::wrapperTypeInfo, impl)
; |
106 return shadow; | 106 return shadow; |
107 } | 107 } |
108 | 108 |
109 v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Handle<v8::Object> creatio
nContext, WrapperTypeInfo* type, void* impl, v8::Isolate* isolate) | 109 v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Handle<v8::Object> creatio
nContext, WrapperTypeInfo* type, void* impl, v8::Isolate* isolate) |
110 { | 110 { |
111 V8WrapperInstantiationScope scope(creationContext, isolate); | 111 V8WrapperInstantiationScope scope(creationContext, isolate); |
112 | 112 |
113 V8PerContextData* perContextData = V8PerContextData::from(scope.context()); | 113 V8PerContextData* perContextData = V8PerContextData::from(scope.context()); |
114 v8::Local<v8::Object> wrapper = perContextData ? perContextData->createWrapp
erFromCache(type) : V8ObjectConstructor::newInstance(type->getTemplate(isolate,
worldTypeInMainThread(isolate))->GetFunction()); | 114 v8::Local<v8::Object> wrapper = perContextData ? perContextData->createWrapp
erFromCache(type) : V8ObjectConstructor::newInstance(type->getTemplate(isolate,
worldTypeInMainThread(isolate))->GetFunction()); |
115 | 115 |
116 if (type == &V8HTMLDocument::info && !wrapper.IsEmpty()) | 116 if (type == &V8HTMLDocument::wrapperTypeInfo && !wrapper.IsEmpty()) |
117 wrapper = wrapInShadowTemplate(wrapper, static_cast<Node*>(impl), isolat
e); | 117 wrapper = wrapInShadowTemplate(wrapper, static_cast<Node*>(impl), isolat
e); |
118 | 118 |
119 return wrapper; | 119 return wrapper; |
120 } | 120 } |
121 | 121 |
122 static bool hasInternalField(v8::Handle<v8::Value> value) | 122 static bool hasInternalField(v8::Handle<v8::Value> value) |
123 { | 123 { |
124 if (value.IsEmpty() || !value->IsObject()) | 124 if (value.IsEmpty() || !value->IsObject()) |
125 return false; | 125 return false; |
126 return v8::Handle<v8::Object>::Cast(value)->InternalFieldCount(); | 126 return v8::Handle<v8::Object>::Cast(value)->InternalFieldCount(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(value); | 165 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(value); |
166 ASSERT(wrapper->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount); | 166 ASSERT(wrapper->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount); |
167 ASSERT(wrapper->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex))
; | 167 ASSERT(wrapper->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex))
; |
168 | 168 |
169 WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(wrapper->GetAligne
dPointerFromInternalField(v8DOMWrapperTypeIndex)); | 169 WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(wrapper->GetAligne
dPointerFromInternalField(v8DOMWrapperTypeIndex)); |
170 return typeInfo == type; | 170 return typeInfo == type; |
171 } | 171 } |
172 | 172 |
173 } // namespace WebCore | 173 } // namespace WebCore |
OLD | NEW |