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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 ASSERT(staticNPObjectMap().containsKeyAndValue(npObject, *wrapper)); | 408 ASSERT(staticNPObjectMap().containsKeyAndValue(npObject, *wrapper)); |
409 | 409 |
410 // Must remove from our map before calling _NPN_ReleaseObject(). _NPN_Releas
eObject can | 410 // Must remove from our map before calling _NPN_ReleaseObject(). _NPN_Releas
eObject can |
411 // call forgetV8ObjectForNPObject, which uses the table as well. | 411 // call forgetV8ObjectForNPObject, which uses the table as well. |
412 staticNPObjectMap().removeAndDispose(npObject); | 412 staticNPObjectMap().removeAndDispose(npObject); |
413 | 413 |
414 if (_NPN_IsAlive(npObject)) | 414 if (_NPN_IsAlive(npObject)) |
415 _NPN_ReleaseObject(npObject); | 415 _NPN_ReleaseObject(npObject); |
416 } | 416 } |
417 | 417 |
418 v8::Local<v8::Object> createV8ObjectForNPObject(NPObject* object, NPObject* root
) | 418 v8::Local<v8::Object> createV8ObjectForNPObject(NPObject* object, NPObject* root
, v8::Isolate* isolate) |
419 { | 419 { |
420 static v8::Eternal<v8::FunctionTemplate> npObjectDesc; | 420 static v8::Eternal<v8::FunctionTemplate> npObjectDesc; |
421 | 421 |
422 ASSERT(v8::Context::InContext()); | 422 ASSERT(v8::Context::InContext()); |
423 | 423 |
424 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | |
425 | |
426 // If this is a v8 object, just return it. | 424 // If this is a v8 object, just return it. |
427 V8NPObject* v8NPObject = npObjectToV8NPObject(object); | 425 V8NPObject* v8NPObject = npObjectToV8NPObject(object); |
428 if (v8NPObject) | 426 if (v8NPObject) |
429 return v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); | 427 return v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); |
430 | 428 |
431 // If we've already wrapped this object, just return it. | 429 // If we've already wrapped this object, just return it. |
432 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat
e); | 430 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat
e); |
433 if (!wrapper.IsEmpty()) | 431 if (!wrapper.IsEmpty()) |
434 return wrapper; | 432 return wrapper; |
435 | 433 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 v8::HandleScope scope(isolate); | 470 v8::HandleScope scope(isolate); |
473 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat
e); | 471 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat
e); |
474 if (!wrapper.IsEmpty()) { | 472 if (!wrapper.IsEmpty()) { |
475 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); | 473 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); |
476 staticNPObjectMap().removeAndDispose(object); | 474 staticNPObjectMap().removeAndDispose(object); |
477 _NPN_ReleaseObject(object); | 475 _NPN_ReleaseObject(object); |
478 } | 476 } |
479 } | 477 } |
480 | 478 |
481 } // namespace WebCore | 479 } // namespace WebCore |
OLD | NEW |