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

Side by Side Diff: Source/bindings/v8/DOMWrapperMap.h

Issue 23444025: Remove calls to to-be-deprecated Persistent functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | « no previous file | Source/bindings/v8/ScriptWrappable.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 typename MapType::iterator it = m_map.find(key); 73 typename MapType::iterator it = m_map.find(key);
74 if (it == m_map.end()) 74 if (it == m_map.end())
75 return false; 75 return false;
76 return *(it->value.persistent()) == value; 76 return *(it->value.persistent()) == value;
77 } 77 }
78 78
79 void set(KeyType* key, v8::Handle<v8::Object> wrapper, const WrapperConfigur ation& configuration) 79 void set(KeyType* key, v8::Handle<v8::Object> wrapper, const WrapperConfigur ation& configuration)
80 { 80 {
81 ASSERT(static_cast<KeyType*>(toNative(wrapper)) == key); 81 ASSERT(static_cast<KeyType*>(toNative(wrapper)) == key);
82 v8::Persistent<v8::Object> persistent(m_isolate, wrapper); 82 v8::Persistent<v8::Object> persistent(m_isolate, wrapper);
83 configuration.configureWrapper(&persistent, m_isolate); 83 configuration.configureWrapper(&persistent);
84 persistent.MakeWeak(this, &makeWeakCallback); 84 persistent.MakeWeak(this, &makeWeakCallback);
85 typename MapType::AddResult result = m_map.add(key, UnsafePersistent<v8: :Object>()); 85 typename MapType::AddResult result = m_map.add(key, UnsafePersistent<v8: :Object>());
86 ASSERT(result.isNewEntry); 86 ASSERT(result.isNewEntry);
87 // FIXME: Stop handling this case once duplicate wrappers are guaranteed not to be created. 87 // FIXME: Stop handling this case once duplicate wrappers are guaranteed not to be created.
88 if (!result.isNewEntry) 88 if (!result.isNewEntry)
89 result.iterator->value.dispose(); 89 result.iterator->value.dispose();
90 result.iterator->value = UnsafePersistent<v8::Object>(persistent); 90 result.iterator->value = UnsafePersistent<v8::Object>(persistent);
91 } 91 }
92 92
93 void clear() 93 void clear()
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ASSERT(type->derefObjectFunction); 125 ASSERT(type->derefObjectFunction);
126 void* key = static_cast<void*>(toNative(*wrapper)); 126 void* key = static_cast<void*>(toNative(*wrapper));
127 ASSERT(*(map->m_map.get(key).persistent()) == *wrapper); 127 ASSERT(*(map->m_map.get(key).persistent()) == *wrapper);
128 map->removeAndDispose(key); 128 map->removeAndDispose(key);
129 type->derefObject(key); 129 type->derefObject(key);
130 } 130 }
131 131
132 } // namespace WebCore 132 } // namespace WebCore
133 133
134 #endif // DOMWrapperMap_h 134 #endif // DOMWrapperMap_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/ScriptWrappable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698