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

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

Issue 806693004: Use new phantom handles for ScriptWrappable. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Start using V8 phantom handles in Blink Created 5 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
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 typedef PrivateIdentifier WeakCallbackDataType; 173 typedef PrivateIdentifier WeakCallbackDataType;
174 174
175 static WeakCallbackDataType* WeakCallbackParameter(MapType* map, PrivateIden tifier* key, const v8::Local<v8::FunctionTemplate>& value) 175 static WeakCallbackDataType* WeakCallbackParameter(MapType* map, PrivateIden tifier* key, const v8::Local<v8::FunctionTemplate>& value)
176 { 176 {
177 return key; 177 return key;
178 } 178 }
179 179
180 static void DisposeCallbackData(WeakCallbackDataType* callbackData) { } 180 static void DisposeCallbackData(WeakCallbackDataType* callbackData) { }
181 181
182 static MapType* MapFromWeakCallbackData( 182 static MapType* MapFromWeakCallbackData(
183 const v8::WeakCallbackData<v8::FunctionTemplate, WeakCallbackDataType>&) ; 183 const v8::PhantomCallbackData<WeakCallbackDataType>&);
184 184
185 static PrivateIdentifier* KeyFromWeakCallbackData( 185 static PrivateIdentifier* KeyFromWeakCallbackData(
186 const v8::WeakCallbackData<v8::FunctionTemplate, WeakCallbackDataType>& data) 186 const v8::PhantomCallbackData<WeakCallbackDataType>& data)
187 { 187 {
188 return data.GetParameter(); 188 return data.GetParameter();
189 } 189 }
190 190
191 // Dispose traits: 191 // Dispose traits:
192 static void Dispose(v8::Isolate* isolate, v8::UniquePersistent<v8::FunctionT emplate> value, PrivateIdentifier* key) { } 192 static void Dispose(v8::Isolate* isolate, v8::UniquePersistent<v8::FunctionT emplate> value, PrivateIdentifier* key) { }
193 }; 193 };
194 194
195 195
196 class V8NPTemplateMap { 196 class V8NPTemplateMap {
(...skipping 23 matching lines...) Expand all
220 220
221 private: 221 private:
222 explicit V8NPTemplateMap(v8::Isolate* isolate) 222 explicit V8NPTemplateMap(v8::Isolate* isolate)
223 : m_map(isolate) 223 : m_map(isolate)
224 { 224 {
225 } 225 }
226 226
227 MapType m_map; 227 MapType m_map;
228 }; 228 };
229 229
230 V8TemplateMapTraits::MapType* V8TemplateMapTraits::MapFromWeakCallbackData(const v8::WeakCallbackData<v8::FunctionTemplate, WeakCallbackDataType>& data) 230 V8TemplateMapTraits::MapType* V8TemplateMapTraits::MapFromWeakCallbackData(const v8::PhantomCallbackData<WeakCallbackDataType>& data)
231 { 231 {
232 return &V8NPTemplateMap::sharedInstance(data.GetIsolate()).m_map; 232 return &V8NPTemplateMap::sharedInstance(data.GetIsolate()).m_map;
233 } 233 }
234 234
235 235
236 static v8::Handle<v8::Value> npObjectGetProperty(v8::Local<v8::Object> self, NPI dentifier identifier, v8::Local<v8::Value> key, v8::Isolate* isolate) 236 static v8::Handle<v8::Value> npObjectGetProperty(v8::Local<v8::Object> self, NPI dentifier identifier, v8::Local<v8::Value> key, v8::Isolate* isolate)
237 { 237 {
238 NPObject* npObject = v8ObjectToNPObject(self); 238 NPObject* npObject = v8ObjectToNPObject(self);
239 239
240 // Verify that our wrapper wasn't using a NPObject which 240 // Verify that our wrapper wasn't using a NPObject which
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 v8::HandleScope scope(isolate); 487 v8::HandleScope scope(isolate);
488 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e); 488 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e);
489 if (!wrapper.IsEmpty()) { 489 if (!wrapper.IsEmpty()) {
490 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); 490 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo());
491 staticNPObjectMap().removeAndDispose(object); 491 staticNPObjectMap().removeAndDispose(object);
492 _NPN_ReleaseObject(object); 492 _NPN_ReleaseObject(object);
493 } 493 }
494 } 494 }
495 495
496 } // namespace blink 496 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698