OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 MapType m_map; | 227 MapType m_map; |
228 }; | 228 }; |
229 | 229 |
230 V8TemplateMapTraits::MapType* V8TemplateMapTraits::MapFromWeakCallbackData(const
v8::WeakCallbackData<v8::FunctionTemplate, WeakCallbackDataType>& data) | 230 V8TemplateMapTraits::MapType* V8TemplateMapTraits::MapFromWeakCallbackData(const
v8::WeakCallbackData<v8::FunctionTemplate, WeakCallbackDataType>& data) |
231 { | 231 { |
232 return &V8NPTemplateMap::sharedInstance(data.GetIsolate()).m_map; | 232 return &V8NPTemplateMap::sharedInstance(data.GetIsolate()).m_map; |
233 } | 233 } |
234 | 234 |
235 | 235 |
236 static v8::Local<v8::Value> npObjectGetProperty(v8::Local<v8::Object> self, NPId
entifier identifier, v8::Local<v8::Value> key, v8::Isolate* isolate) | 236 static v8::Local<v8::Value> npObjectGetProperty(v8::Isolate* isolate, v8::Local<
v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> key) |
237 { | 237 { |
238 NPObject* npObject = v8ObjectToNPObject(self); | 238 NPObject* npObject = v8ObjectToNPObject(self); |
239 | 239 |
240 // Verify that our wrapper wasn't using a NPObject which | 240 // Verify that our wrapper wasn't using a NPObject which |
241 // has already been deleted. | 241 // has already been deleted. |
242 if (!npObject || !_NPN_IsAlive(npObject)) | 242 if (!npObject || !_NPN_IsAlive(npObject)) |
243 return V8ThrowException::throwReferenceError(isolate, "NPObject deleted"
); | 243 return V8ThrowException::throwReferenceError(isolate, "NPObject deleted"
); |
244 | 244 |
245 | 245 |
246 if (npObject->_class->hasProperty && npObject->_class->getProperty && npObje
ct->_class->hasProperty(npObject, identifier)) { | 246 if (npObject->_class->hasProperty && npObject->_class->getProperty && npObje
ct->_class->hasProperty(npObject, identifier)) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 v8Function->SetName(v8::Local<v8::String>::Cast(key)); | 282 v8Function->SetName(v8::Local<v8::String>::Cast(key)); |
283 return v8Function; | 283 return v8Function; |
284 } | 284 } |
285 | 285 |
286 return v8Undefined(); | 286 return v8Undefined(); |
287 } | 287 } |
288 | 288 |
289 void npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Value>& info) | 289 void npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Value>& info) |
290 { | 290 { |
291 NPIdentifier identifier = getStringIdentifier(name); | 291 NPIdentifier identifier = getStringIdentifier(name); |
292 v8SetReturnValue(info, npObjectGetProperty(info.Holder(), identifier, name,
info.GetIsolate())); | 292 v8SetReturnValue(info, npObjectGetProperty(info.GetIsolate(), info.Holder(),
identifier, name)); |
293 } | 293 } |
294 | 294 |
295 void npObjectIndexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Value>& info) | 295 void npObjectIndexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Value>& info) |
296 { | 296 { |
297 NPIdentifier identifier = _NPN_GetIntIdentifier(index); | 297 NPIdentifier identifier = _NPN_GetIntIdentifier(index); |
298 v8SetReturnValue(info, npObjectGetProperty(info.Holder(), identifier, v8::Nu
mber::New(info.GetIsolate(), index), info.GetIsolate())); | 298 v8SetReturnValue(info, npObjectGetProperty(info.GetIsolate(), info.Holder(),
identifier, v8::Number::New(info.GetIsolate(), index))); |
299 } | 299 } |
300 | 300 |
301 void npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String>
name, const v8::PropertyCallbackInfo<v8::Value>& info) | 301 void npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String>
name, const v8::PropertyCallbackInfo<v8::Value>& info) |
302 { | 302 { |
303 NPIdentifier identifier = getStringIdentifier(name); | 303 NPIdentifier identifier = getStringIdentifier(name); |
304 v8SetReturnValue(info, npObjectGetProperty(self, identifier, name, info.GetI
solate())); | 304 v8SetReturnValue(info, npObjectGetProperty(info.GetIsolate(), self, identifi
er, name)); |
305 } | 305 } |
306 | 306 |
307 void npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, cons
t v8::PropertyCallbackInfo<v8::Value>& info) | 307 void npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, cons
t v8::PropertyCallbackInfo<v8::Value>& info) |
308 { | 308 { |
309 NPIdentifier identifier = _NPN_GetIntIdentifier(index); | 309 NPIdentifier identifier = _NPN_GetIntIdentifier(index); |
310 v8SetReturnValue(info, npObjectGetProperty(self, identifier, v8::Number::New
(info.GetIsolate(), index), info.GetIsolate())); | 310 v8SetReturnValue(info, npObjectGetProperty(info.GetIsolate(), self, identifi
er, v8::Number::New(info.GetIsolate(), index))); |
311 } | 311 } |
312 | 312 |
313 void npObjectQueryProperty(v8::Local<v8::String> name, const v8::PropertyCallbac
kInfo<v8::Integer>& info) | 313 void npObjectQueryProperty(v8::Local<v8::String> name, const v8::PropertyCallbac
kInfo<v8::Integer>& info) |
314 { | 314 { |
315 NPIdentifier identifier = getStringIdentifier(name); | 315 NPIdentifier identifier = getStringIdentifier(name); |
316 if (npObjectGetProperty(info.Holder(), identifier, name, info.GetIsolate()).
IsEmpty()) | 316 if (npObjectGetProperty(info.GetIsolate(), info.Holder(), identifier, name).
IsEmpty()) |
317 return; | 317 return; |
318 v8SetReturnValueInt(info, 0); | 318 v8SetReturnValueInt(info, 0); |
319 } | 319 } |
320 | 320 |
321 static v8::Local<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPId
entifier identifier, v8::Local<v8::Value> value, v8::Isolate* isolate) | 321 static v8::Local<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPId
entifier identifier, v8::Local<v8::Value> value, v8::Isolate* isolate) |
322 { | 322 { |
323 NPObject* npObject = v8ObjectToNPObject(self); | 323 NPObject* npObject = v8ObjectToNPObject(self); |
324 | 324 |
325 // Verify that our wrapper wasn't using a NPObject which has already been de
leted. | 325 // Verify that our wrapper wasn't using a NPObject which has already been de
leted. |
326 if (!npObject || !_NPN_IsAlive(npObject)) { | 326 if (!npObject || !_NPN_IsAlive(npObject)) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 v8::HandleScope scope(isolate); | 499 v8::HandleScope scope(isolate); |
500 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolate
); | 500 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolate
); |
501 if (!wrapper.IsEmpty()) { | 501 if (!wrapper.IsEmpty()) { |
502 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); | 502 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); |
503 staticNPObjectMap().removeAndDispose(object); | 503 staticNPObjectMap().removeAndDispose(object); |
504 _NPN_ReleaseObject(object); | 504 _NPN_ReleaseObject(object); |
505 } | 505 } |
506 } | 506 } |
507 | 507 |
508 } // namespace blink | 508 } // namespace blink |
OLD | NEW |