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

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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate()) || V8 HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate()) 74 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate()) || V8 HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate())
75 || V8HTMLObjectElement::hasInstance(info.Holder(), info.GetIsolate())) { 75 || V8HTMLObjectElement::hasInstance(info.Holder(), info.GetIsolate())) {
76 // The holder object is a subtype of HTMLPlugInElement. 76 // The holder object is a subtype of HTMLPlugInElement.
77 HTMLPlugInElement* element; 77 HTMLPlugInElement* element;
78 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate())) 78 if (V8HTMLAppletElement::hasInstance(info.Holder(), info.GetIsolate()))
79 element = V8HTMLAppletElement::toNative(info.Holder()); 79 element = V8HTMLAppletElement::toNative(info.Holder());
80 else if (V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate( ))) 80 else if (V8HTMLEmbedElement::hasInstance(info.Holder(), info.GetIsolate( )))
81 element = V8HTMLEmbedElement::toNative(info.Holder()); 81 element = V8HTMLEmbedElement::toNative(info.Holder());
82 else 82 else
83 element = V8HTMLObjectElement::toNative(info.Holder()); 83 element = V8HTMLObjectElement::toNative(info.Holder());
84 if (RefPtr<SharedPersistent<v8::Object> > wrapper = element->pluginWrapp er()) { 84 ScriptValue wrapper = element->pluginWrapper();
85 if (!wrapper.hasNoValue()) {
85 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 86 v8::Isolate* isolate = v8::Isolate::GetCurrent();
86 v8::HandleScope handleScope(isolate); 87 v8::HandleScope handleScope(isolate);
87 npObject = v8ObjectToNPObject(wrapper->newLocal(isolate)); 88 npObject = v8ObjectToNPObject(v8::Handle<v8::Object>::Cast(wrapper.v 8Value()));
88 } else 89 } else
89 npObject = 0; 90 npObject = 0;
90 } else { 91 } else {
91 // The holder object is not a subtype of HTMLPlugInElement, it must be a n NPObject which has three 92 // The holder object is not a subtype of HTMLPlugInElement, it must be a n NPObject which has three
92 // internal fields. 93 // internal fields.
93 if (info.Holder()->InternalFieldCount() != npObjectInternalFieldCount) { 94 if (info.Holder()->InternalFieldCount() != npObjectInternalFieldCount) {
94 throwError(v8ReferenceError, "NPMethod called on non-NPObject", info .GetIsolate()); 95 throwError(v8ReferenceError, "NPMethod called on non-NPObject", info .GetIsolate());
95 return; 96 return;
96 } 97 }
97 98
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 v8::HandleScope scope(isolate); 478 v8::HandleScope scope(isolate);
478 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e); 479 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e);
479 if (!wrapper.IsEmpty()) { 480 if (!wrapper.IsEmpty()) {
480 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); 481 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo());
481 staticNPObjectMap().removeAndDispose(object); 482 staticNPObjectMap().removeAndDispose(object);
482 _NPN_ReleaseObject(object); 483 _NPN_ReleaseObject(object);
483 } 484 }
484 } 485 }
485 486
486 } // namespace WebCore 487 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/SharedPersistent.h ('k') | Source/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698