OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 template<typename T> | 1057 template<typename T> |
1058 class CrossThreadWeakPersistentThisPointer { | 1058 class CrossThreadWeakPersistentThisPointer { |
1059 STACK_ALLOCATED(); | 1059 STACK_ALLOCATED(); |
1060 public: | 1060 public: |
1061 explicit CrossThreadWeakPersistentThisPointer(T* value) : m_value(value) { } | 1061 explicit CrossThreadWeakPersistentThisPointer(T* value) : m_value(value) { } |
1062 CrossThreadWeakPersistent<T> value() const { return m_value; } | 1062 CrossThreadWeakPersistent<T> value() const { return m_value; } |
1063 private: | 1063 private: |
1064 CrossThreadWeakPersistent<T> m_value; | 1064 CrossThreadWeakPersistent<T> m_value; |
1065 }; | 1065 }; |
1066 | 1066 |
| 1067 template <typename T> |
| 1068 Persistent<T> wrapPersistent(T* value) |
| 1069 { |
| 1070 return Persistent<T>(value); |
| 1071 } |
| 1072 |
| 1073 template <typename T> |
| 1074 CrossThreadPersistent<T> wrapCrossThreadPersistent(T* value) |
| 1075 { |
| 1076 return CrossThreadPersistent<T>(value); |
| 1077 } |
| 1078 |
1067 // LEAK_SANITIZER_DISABLED_SCOPE: all allocations made in the current scope | 1079 // LEAK_SANITIZER_DISABLED_SCOPE: all allocations made in the current scope |
1068 // will be exempted from LSan consideration. | 1080 // will be exempted from LSan consideration. |
1069 // | 1081 // |
1070 // TODO(sof): move this to wtf/LeakAnnotations.h (LeakSanitizer.h?) once | 1082 // TODO(sof): move this to wtf/LeakAnnotations.h (LeakSanitizer.h?) once |
1071 // wtf/ can freely call upon Oilpan functionality. | 1083 // wtf/ can freely call upon Oilpan functionality. |
1072 #if defined(LEAK_SANITIZER) | 1084 #if defined(LEAK_SANITIZER) |
1073 class LeakSanitizerDisableScope { | 1085 class LeakSanitizerDisableScope { |
1074 STACK_ALLOCATED(); | 1086 STACK_ALLOCATED(); |
1075 WTF_MAKE_NONCOPYABLE(LeakSanitizerDisableScope); | 1087 WTF_MAKE_NONCOPYABLE(LeakSanitizerDisableScope); |
1076 public: | 1088 public: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 // into it. | 1225 // into it. |
1214 // | 1226 // |
1215 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like | 1227 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like |
1216 // CrossThreadWeakPersistent<>. | 1228 // CrossThreadWeakPersistent<>. |
1217 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } | 1229 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } |
1218 }; | 1230 }; |
1219 | 1231 |
1220 } // namespace WTF | 1232 } // namespace WTF |
1221 | 1233 |
1222 #endif | 1234 #endif |
OLD | NEW |