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

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

Issue 2617733004: binding: Changes the association among global-proxy/global/window-instance. (Closed)
Patch Set: Addressed review comments. Created 3 years, 10 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (UNLIKELY(containsKey(key))) { 72 if (UNLIKELY(containsKey(key))) {
73 wrapper = newLocal(m_isolate, key); 73 wrapper = newLocal(m_isolate, key);
74 return false; 74 return false;
75 } 75 }
76 v8::Global<v8::Object> global(m_isolate, wrapper); 76 v8::Global<v8::Object> global(m_isolate, wrapper);
77 wrapperTypeInfo->configureWrapper(&global); 77 wrapperTypeInfo->configureWrapper(&global);
78 m_map.Set(key, std::move(global)); 78 m_map.Set(key, std::move(global));
79 return true; 79 return true;
80 } 80 }
81 81
82 void removeIfAny(KeyType* key) {
83 m_map.Remove(key);
84 }
85
82 void clear() { m_map.Clear(); } 86 void clear() { m_map.Clear(); }
83 87
84 void removeAndDispose(KeyType* key) {
85 ASSERT(containsKey(key));
86 m_map.Remove(key);
87 }
88
89 void markWrapper(KeyType* object) { 88 void markWrapper(KeyType* object) {
90 m_map.RegisterExternallyReferencedObject(object); 89 m_map.RegisterExternallyReferencedObject(object);
91 } 90 }
92 91
93 private: 92 private:
94 class PersistentValueMapTraits { 93 class PersistentValueMapTraits {
95 STATIC_ONLY(PersistentValueMapTraits); 94 STATIC_ONLY(PersistentValueMapTraits);
96 95
97 public: 96 public:
98 // Map traits: 97 // Map traits:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>&); 155 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>&);
157 }; 156 };
158 157
159 v8::Isolate* m_isolate; 158 v8::Isolate* m_isolate;
160 typename PersistentValueMapTraits::MapType m_map; 159 typename PersistentValueMapTraits::MapType m_map;
161 }; 160 };
162 161
163 } // namespace blink 162 } // namespace blink
164 163
165 #endif // DOMWrapperMap_h 164 #endif // DOMWrapperMap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698