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

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

Issue 146523002: Limit the usage of SharedPersistent to ScriptValue only (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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate(), curre ntWorldType) || V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate() , currentWorldType) 75 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate(), curre ntWorldType) || V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate() , currentWorldType)
76 || V8HTMLObjectElement::hasInstance(info.Holder(), info.GetIsolate(), cu rrentWorldType)) { 76 || V8HTMLObjectElement::hasInstance(info.Holder(), info.GetIsolate(), cu rrentWorldType)) {
77 // The holder object is a subtype of HTMLPlugInElement. 77 // The holder object is a subtype of HTMLPlugInElement.
78 HTMLPlugInElement* element; 78 HTMLPlugInElement* element;
79 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate(), c urrentWorldType)) 79 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate(), c urrentWorldType))
80 element = V8HTMLAppletElement::toNative(info.Holder()); 80 element = V8HTMLAppletElement::toNative(info.Holder());
81 else if (V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate( ), currentWorldType)) 81 else if (V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate( ), currentWorldType))
82 element = V8HTMLEmbedElement::toNative(info.Holder()); 82 element = V8HTMLEmbedElement::toNative(info.Holder());
83 else 83 else
84 element = V8HTMLObjectElement::toNative(info.Holder()); 84 element = V8HTMLObjectElement::toNative(info.Holder());
85 if (RefPtr<SharedPersistent<v8::Object> > wrapper = element->pluginWrapp er()) { 85 ScriptValue wrapper = element->pluginWrapper();
86 if (!wrapper.hasNoValue()) {
86 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 87 v8::Isolate* isolate = v8::Isolate::GetCurrent();
87 v8::HandleScope handleScope(isolate); 88 v8::HandleScope handleScope(isolate);
88 npObject = v8ObjectToNPObject(wrapper->newLocal(isolate)); 89 npObject = v8ObjectToNPObject(v8::Handle<v8::Object>::Cast(wrapper.v 8Value()));
89 } else 90 } else
90 npObject = 0; 91 npObject = 0;
91 } else { 92 } else {
92 // The holder object is not a subtype of HTMLPlugInElement, it must be a n NPObject which has three 93 // The holder object is not a subtype of HTMLPlugInElement, it must be a n NPObject which has three
93 // internal fields. 94 // internal fields.
94 if (info.Holder()->InternalFieldCount() != npObjectInternalFieldCount) { 95 if (info.Holder()->InternalFieldCount() != npObjectInternalFieldCount) {
95 throwError(v8ReferenceError, "NPMethod called on non-NPObject", info .GetIsolate()); 96 throwError(v8ReferenceError, "NPMethod called on non-NPObject", info .GetIsolate());
96 return; 97 return;
97 } 98 }
98 99
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 v8::HandleScope scope(isolate); 479 v8::HandleScope scope(isolate);
479 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e); 480 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e);
480 if (!wrapper.IsEmpty()) { 481 if (!wrapper.IsEmpty()) {
481 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); 482 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo());
482 staticNPObjectMap().removeAndDispose(object); 483 staticNPObjectMap().removeAndDispose(object);
483 _NPN_ReleaseObject(object); 484 _NPN_ReleaseObject(object);
484 } 485 }
485 } 486 }
486 487
487 } // namespace WebCore 488 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698