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

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

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) 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void removeAndDispose(KeyType* key) 85 void removeAndDispose(KeyType* key)
86 { 86 {
87 ASSERT(containsKey(key)); 87 ASSERT(containsKey(key));
88 m_map.Remove(key); 88 m_map.Remove(key);
89 } 89 }
90 90
91 private: 91 private:
92 class PersistentValueMapTraits { 92 class PersistentValueMapTraits {
93 public: 93 public:
94 // Map traits: 94 // Map traits:
95 static const bool kUseSetWeak = true;
Erik Corry Chromium.org 2015/01/07 16:07:56 This is in preparation for planned changes in V8.
95 typedef HashMap<KeyType*, v8::PersistentContainerValue> Impl; 96 typedef HashMap<KeyType*, v8::PersistentContainerValue> Impl;
96 typedef typename Impl::iterator Iterator; 97 typedef typename Impl::iterator Iterator;
97 static size_t Size(const Impl* impl) { return impl->size(); } 98 static size_t Size(const Impl* impl) { return impl->size(); }
98 static bool Empty(Impl* impl) { return impl->isEmpty(); } 99 static bool Empty(Impl* impl) { return impl->isEmpty(); }
99 static void Swap(Impl& impl, Impl& other) { impl.swap(other); } 100 static void Swap(Impl& impl, Impl& other) { impl.swap(other); }
100 static Iterator Begin(Impl* impl) { return impl->begin(); } 101 static Iterator Begin(Impl* impl) { return impl->begin(); }
101 static Iterator End(Impl* impl) { return impl->end(); } 102 static Iterator End(Impl* impl) { return impl->end(); }
102 static v8::PersistentContainerValue Value(Iterator& iter) 103 static v8::PersistentContainerValue Value(Iterator& iter)
103 { 104 {
104 return iter->value; 105 return iter->value;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 static void Dispose(v8::Isolate* isolate, v8::UniquePersistent<v8::Objec t> value, KeyType* key) { } 149 static void Dispose(v8::Isolate* isolate, v8::UniquePersistent<v8::Objec t> value, KeyType* key) { }
149 }; 150 };
150 151
151 v8::Isolate* m_isolate; 152 v8::Isolate* m_isolate;
152 typename PersistentValueMapTraits::MapType m_map; 153 typename PersistentValueMapTraits::MapType m_map;
153 }; 154 };
154 155
155 } // namespace blink 156 } // namespace blink
156 157
157 #endif // DOMWrapperMap_h 158 #endif // DOMWrapperMap_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/DOMWrapperWorld.h » ('j') | Source/bindings/core/v8/ScriptWrappable.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698