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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, DOMTemplateMap& domTemplateMap) | 199 bool V8PerIsolateData::hasInstance(const WrapperTypeInfo* info, v8::Handle<v8::V
alue> value, DOMTemplateMap& domTemplateMap) |
200 { | 200 { |
201 DOMTemplateMap::iterator result = domTemplateMap.find(info); | 201 DOMTemplateMap::iterator result = domTemplateMap.find(info); |
202 if (result == domTemplateMap.end()) | 202 if (result == domTemplateMap.end()) |
203 return false; | 203 return false; |
204 v8::Handle<v8::FunctionTemplate> templ = result->value.Get(isolate()); | 204 v8::Handle<v8::FunctionTemplate> templ = result->value.Get(isolate()); |
205 return templ->HasInstance(value); | 205 return templ->HasInstance(value); |
206 } | 206 } |
207 | 207 |
208 v8::Handle<v8::Object> V8PerIsolateData::findInstanceInPrototypeChain(const Wrap
perTypeInfo* info, v8::Handle<v8::Value> value) | 208 v8::Local<v8::Object> V8PerIsolateData::findInstanceInPrototypeChain(const Wrapp
erTypeInfo* info, v8::Local<v8::Value> value) |
209 { | 209 { |
210 v8::Handle<v8::Object> wrapper = findInstanceInPrototypeChain(info, value, m
_domTemplateMapForMainWorld); | 210 v8::Local<v8::Object> wrapper = findInstanceInPrototypeChain(info, value, m_
domTemplateMapForMainWorld); |
211 if (!wrapper.IsEmpty()) | 211 if (!wrapper.IsEmpty()) |
212 return wrapper; | 212 return wrapper; |
213 return findInstanceInPrototypeChain(info, value, m_domTemplateMapForNonMainW
orld); | 213 return findInstanceInPrototypeChain(info, value, m_domTemplateMapForNonMainW
orld); |
214 } | 214 } |
215 | 215 |
216 v8::Handle<v8::Object> V8PerIsolateData::findInstanceInPrototypeChain(const Wrap
perTypeInfo* info, v8::Handle<v8::Value> value, DOMTemplateMap& domTemplateMap) | 216 v8::Local<v8::Object> V8PerIsolateData::findInstanceInPrototypeChain(const Wrapp
erTypeInfo* info, v8::Local<v8::Value> value, DOMTemplateMap& domTemplateMap) |
217 { | 217 { |
218 if (value.IsEmpty() || !value->IsObject()) | 218 if (value.IsEmpty() || !value->IsObject()) |
219 return v8::Handle<v8::Object>(); | 219 return v8::Local<v8::Object>(); |
220 DOMTemplateMap::iterator result = domTemplateMap.find(info); | 220 DOMTemplateMap::iterator result = domTemplateMap.find(info); |
221 if (result == domTemplateMap.end()) | 221 if (result == domTemplateMap.end()) |
222 return v8::Handle<v8::Object>(); | 222 return v8::Local<v8::Object>(); |
223 v8::Handle<v8::FunctionTemplate> templ = result->value.Get(isolate()); | 223 v8::Local<v8::FunctionTemplate> templ = result->value.Get(isolate()); |
224 return v8::Handle<v8::Object>::Cast(value)->FindInstanceInPrototypeChain(tem
pl); | 224 return v8::Local<v8::Object>::Cast(value)->FindInstanceInPrototypeChain(temp
l); |
225 } | 225 } |
226 | 226 |
227 static void constructorOfToString(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | 227 static void constructorOfToString(const v8::FunctionCallbackInfo<v8::Value>& inf
o) |
228 { | 228 { |
229 // The DOM constructors' toString functions grab the current toString | 229 // The DOM constructors' toString functions grab the current toString |
230 // for Functions by taking the toString function of itself and then | 230 // for Functions by taking the toString function of itself and then |
231 // calling it with the constructor as its receiver. This means that | 231 // calling it with the constructor as its receiver. This means that |
232 // changes to the Function prototype chain or toString function are | 232 // changes to the Function prototype chain or toString function are |
233 // reflected when printing DOM constructors. The only wart is that | 233 // reflected when printing DOM constructors. The only wart is that |
234 // changes to a DOM constructor's toString's toString will cause the | 234 // changes to a DOM constructor's toString's toString will cause the |
(...skipping 27 matching lines...) Expand all Loading... |
262 task->run(); | 262 task->run(); |
263 ASSERT(m_endOfScopeTasks.isEmpty()); | 263 ASSERT(m_endOfScopeTasks.isEmpty()); |
264 } | 264 } |
265 | 265 |
266 void V8PerIsolateData::clearEndOfScopeTasks() | 266 void V8PerIsolateData::clearEndOfScopeTasks() |
267 { | 267 { |
268 m_endOfScopeTasks.clear(); | 268 m_endOfScopeTasks.clear(); |
269 } | 269 } |
270 | 270 |
271 } // namespace blink | 271 } // namespace blink |
OLD | NEW |