Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: Source/bindings/v8/V8NPObject.cpp

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8GCController.cpp ('k') | Source/bindings/v8/V8PerIsolateData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } m_value; 63 } m_value;
64 bool m_isString; 64 bool m_isString;
65 }; 65 };
66 66
67 // FIXME: need comments. 67 // FIXME: need comments.
68 // Params: holder could be HTMLEmbedElement or NPObject 68 // Params: holder could be HTMLEmbedElement or NPObject
69 static void npObjectInvokeImpl(const v8::FunctionCallbackInfo<v8::Value>& info, InvokeFunctionType functionId) 69 static void npObjectInvokeImpl(const v8::FunctionCallbackInfo<v8::Value>& info, InvokeFunctionType functionId)
70 { 70 {
71 NPObject* npObject; 71 NPObject* npObject;
72 72
73 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
74 // These three types are subtypes of HTMLPlugInElement. 73 // These three types are subtypes of HTMLPlugInElement.
75 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate(), curre ntWorldType) || V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate() , currentWorldType) 74 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate()) || V8 HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate())
76 || V8HTMLObjectElement::hasInstance(info.Holder(), info.GetIsolate(), cu rrentWorldType)) { 75 || V8HTMLObjectElement::hasInstance(info.Holder(), info.GetIsolate())) {
77 // The holder object is a subtype of HTMLPlugInElement. 76 // The holder object is a subtype of HTMLPlugInElement.
78 HTMLPlugInElement* element; 77 HTMLPlugInElement* element;
79 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate(), c urrentWorldType)) 78 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate()))
80 element = V8HTMLAppletElement::toNative(info.Holder()); 79 element = V8HTMLAppletElement::toNative(info.Holder());
81 else if (V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate( ), currentWorldType)) 80 else if (V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate( )))
82 element = V8HTMLEmbedElement::toNative(info.Holder()); 81 element = V8HTMLEmbedElement::toNative(info.Holder());
83 else 82 else
84 element = V8HTMLObjectElement::toNative(info.Holder()); 83 element = V8HTMLObjectElement::toNative(info.Holder());
85 if (RefPtr<SharedPersistent<v8::Object> > wrapper = element->pluginWrapp er()) { 84 if (RefPtr<SharedPersistent<v8::Object> > wrapper = element->pluginWrapp er()) {
86 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 85 v8::Isolate* isolate = v8::Isolate::GetCurrent();
87 v8::HandleScope handleScope(isolate); 86 v8::HandleScope handleScope(isolate);
88 npObject = v8ObjectToNPObject(wrapper->newLocal(isolate)); 87 npObject = v8ObjectToNPObject(wrapper->newLocal(isolate));
89 } else 88 } else
90 npObject = 0; 89 npObject = 0;
91 } else { 90 } else {
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 v8::HandleScope scope(isolate); 477 v8::HandleScope scope(isolate);
479 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e); 478 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e);
480 if (!wrapper.IsEmpty()) { 479 if (!wrapper.IsEmpty()) {
481 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); 480 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo());
482 staticNPObjectMap().removeAndDispose(object); 481 staticNPObjectMap().removeAndDispose(object);
483 _NPN_ReleaseObject(object); 482 _NPN_ReleaseObject(object);
484 } 483 }
485 } 484 }
486 485
487 } // namespace WebCore 486 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8GCController.cpp ('k') | Source/bindings/v8/V8PerIsolateData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698