| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_UTIL_H_ | 5 #ifndef V8_UTIL_H_ |
| 6 #define V8_UTIL_H_ | 6 #define V8_UTIL_H_ |
| 7 | 7 |
| 8 #include "v8.h" | 8 #include "v8.h" |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 private: | 470 private: |
| 471 static void WeakCallback( | 471 static void WeakCallback( |
| 472 const WeakCallbackInfo<typename Traits::WeakCallbackDataType>& data) { | 472 const WeakCallbackInfo<typename Traits::WeakCallbackDataType>& data) { |
| 473 if (Traits::kCallbackType != kNotWeak) { | 473 if (Traits::kCallbackType != kNotWeak) { |
| 474 GlobalValueMap<K, V, Traits>* persistentValueMap = | 474 GlobalValueMap<K, V, Traits>* persistentValueMap = |
| 475 Traits::MapFromWeakCallbackInfo(data); | 475 Traits::MapFromWeakCallbackInfo(data); |
| 476 K key = Traits::KeyFromWeakCallbackInfo(data); | 476 K key = Traits::KeyFromWeakCallbackInfo(data); |
| 477 persistentValueMap->RemoveWeak(key); | 477 persistentValueMap->RemoveWeak(key); |
| 478 Traits::DisposeWeak(data.GetIsolate(), data, key); | 478 Traits::DisposeWeak(data.GetIsolate(), data, key); |
| 479 Traits::DisposeCallbackData(data.GetParameter()); | |
| 480 } | 479 } |
| 481 } | 480 } |
| 482 }; | 481 }; |
| 483 | 482 |
| 484 | 483 |
| 485 /** | 484 /** |
| 486 * A map that uses Global as value and std::map as the backing | 485 * A map that uses Global as value and std::map as the backing |
| 487 * implementation. Persistents are held non-weak. | 486 * implementation. Persistents are held non-weak. |
| 488 * | 487 * |
| 489 * C++11 embedders don't need this class, as they can use | 488 * C++11 embedders don't need this class, as they can use |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 return reinterpret_cast<V*>(v); | 608 return reinterpret_cast<V*>(v); |
| 610 } | 609 } |
| 611 | 610 |
| 612 Isolate* isolate_; | 611 Isolate* isolate_; |
| 613 typename Traits::Impl impl_; | 612 typename Traits::Impl impl_; |
| 614 }; | 613 }; |
| 615 | 614 |
| 616 } // namespace v8 | 615 } // namespace v8 |
| 617 | 616 |
| 618 #endif // V8_UTIL_H | 617 #endif // V8_UTIL_H |
| OLD | NEW |