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 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 | 32 |
33 #include "bindings/core/v8/V8NPObject.h" | 33 #include "bindings/core/v8/V8NPObject.h" |
34 | 34 |
35 #include "bindings/core/v8/NPV8Object.h" | 35 #include "bindings/core/v8/NPV8Object.h" |
36 #include "bindings/core/v8/V8Binding.h" | 36 #include "bindings/core/v8/V8Binding.h" |
37 #include "bindings/core/v8/V8GlobalValueMap.h" | 37 #include "bindings/core/v8/V8GlobalValueMap.h" |
38 #include "bindings/core/v8/V8HTMLAppletElement.h" | |
39 #include "bindings/core/v8/V8HTMLEmbedElement.h" | 38 #include "bindings/core/v8/V8HTMLEmbedElement.h" |
40 #include "bindings/core/v8/V8HTMLObjectElement.h" | 39 #include "bindings/core/v8/V8HTMLObjectElement.h" |
41 #include "bindings/core/v8/V8NPUtils.h" | 40 #include "bindings/core/v8/V8NPUtils.h" |
42 #include "bindings/core/v8/V8ObjectConstructor.h" | 41 #include "bindings/core/v8/V8ObjectConstructor.h" |
43 #include "bindings/core/v8/npruntime_impl.h" | 42 #include "bindings/core/v8/npruntime_impl.h" |
44 #include "bindings/core/v8/npruntime_priv.h" | 43 #include "bindings/core/v8/npruntime_priv.h" |
45 #include "core/html/HTMLPlugInElement.h" | 44 #include "core/html/HTMLPlugInElement.h" |
46 #include "v8-util.h" | 45 #include "v8-util.h" |
47 #include "wtf/OwnPtr.h" | 46 #include "wtf/OwnPtr.h" |
48 | 47 |
(...skipping 16 matching lines...) Expand all Loading... |
65 bool m_isString; | 64 bool m_isString; |
66 }; | 65 }; |
67 | 66 |
68 // FIXME: need comments. | 67 // FIXME: need comments. |
69 // Params: holder could be HTMLEmbedElement or NPObject | 68 // Params: holder could be HTMLEmbedElement or NPObject |
70 static void npObjectInvokeImpl(const v8::FunctionCallbackInfo<v8::Value>& info,
InvokeFunctionType functionId) | 69 static void npObjectInvokeImpl(const v8::FunctionCallbackInfo<v8::Value>& info,
InvokeFunctionType functionId) |
71 { | 70 { |
72 NPObject* npObject; | 71 NPObject* npObject; |
73 v8::Isolate* isolate = info.GetIsolate(); | 72 v8::Isolate* isolate = info.GetIsolate(); |
74 | 73 |
75 // These three types are subtypes of HTMLPlugInElement. | 74 // These two types are subtypes of HTMLPlugInElement. |
76 HTMLPlugInElement* element = V8HTMLAppletElement::toImplWithTypeCheck(isolat
e, info.Holder()); | 75 HTMLPlugInElement* element = V8HTMLEmbedElement::toImplWithTypeCheck(isolate
, info.Holder()); |
77 if (!element) { | 76 if (!element) |
78 element = V8HTMLEmbedElement::toImplWithTypeCheck(isolate, info.Holder()
); | 77 element = V8HTMLObjectElement::toImplWithTypeCheck(isolate, info.Holder(
)); |
79 if (!element) { | |
80 element = V8HTMLObjectElement::toImplWithTypeCheck(isolate, info.Hol
der()); | |
81 } | |
82 } | |
83 if (element) { | 78 if (element) { |
84 if (RefPtr<SharedPersistent<v8::Object>> wrapper = element->pluginWrappe
r()) { | 79 if (RefPtr<SharedPersistent<v8::Object>> wrapper = element->pluginWrappe
r()) { |
85 v8::HandleScope handleScope(isolate); | 80 v8::HandleScope handleScope(isolate); |
86 npObject = v8ObjectToNPObject(wrapper->newLocal(isolate)); | 81 npObject = v8ObjectToNPObject(wrapper->newLocal(isolate)); |
87 } else { | 82 } else { |
88 npObject = 0; | 83 npObject = 0; |
89 } | 84 } |
90 } else { | 85 } else { |
91 // The holder object is not a subtype of HTMLPlugInElement, it must be a
n NPObject which has three | 86 // The holder object is not a subtype of HTMLPlugInElement, it must be a
n NPObject which has three |
92 // internal fields. | 87 // internal fields. |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 v8::HandleScope scope(isolate); | 501 v8::HandleScope scope(isolate); |
507 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(isolate, object
); | 502 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(isolate, object
); |
508 if (!wrapper.IsEmpty()) { | 503 if (!wrapper.IsEmpty()) { |
509 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); | 504 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); |
510 staticNPObjectMap().removeAndDispose(object); | 505 staticNPObjectMap().removeAndDispose(object); |
511 _NPN_ReleaseObject(object); | 506 _NPN_ReleaseObject(object); |
512 } | 507 } |
513 } | 508 } |
514 | 509 |
515 } // namespace blink | 510 } // namespace blink |
OLD | NEW |