OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 const WrapperTypeInfo* wrapperTypeInfo, | 87 const WrapperTypeInfo* wrapperTypeInfo, |
88 ScriptWrappable* scriptWrappable) { | 88 ScriptWrappable* scriptWrappable) { |
89 ASSERT(wrapper->InternalFieldCount() >= 2); | 89 ASSERT(wrapper->InternalFieldCount() >= 2); |
90 ASSERT(scriptWrappable); | 90 ASSERT(scriptWrappable); |
91 ASSERT(wrapperTypeInfo); | 91 ASSERT(wrapperTypeInfo); |
92 int indices[] = {v8DOMWrapperObjectIndex, v8DOMWrapperTypeIndex}; | 92 int indices[] = {v8DOMWrapperObjectIndex, v8DOMWrapperTypeIndex}; |
93 void* values[] = {scriptWrappable, | 93 void* values[] = {scriptWrappable, |
94 const_cast<WrapperTypeInfo*>(wrapperTypeInfo)}; | 94 const_cast<WrapperTypeInfo*>(wrapperTypeInfo)}; |
95 wrapper->SetAlignedPointerInInternalFields(WTF_ARRAY_LENGTH(indices), indices, | 95 wrapper->SetAlignedPointerInInternalFields(WTF_ARRAY_LENGTH(indices), indices, |
96 values); | 96 values); |
97 if (RuntimeEnabledFeatures::traceWrappablesEnabled()) { | 97 auto perIsolateData = V8PerIsolateData::from(isolate); |
98 auto perIsolateData = V8PerIsolateData::from(isolate); | 98 // We notify ScriptWrappableVisitor about the new wrapper association, |
99 // We notify ScriptWrappableVisitor about the new wrapper association, | 99 // so the visitor can make sure to trace the association (in case it is |
100 // so the visitor can make sure to trace the association (in case it is | 100 // currently tracing). Because of some optimizations, V8 will not |
101 // currently tracing). Because of some optimizations, V8 will not | 101 // necessarily detect wrappers created during its incremental marking. |
102 // necessarily detect wrappers created during its incremental marking. | 102 perIsolateData->scriptWrappableVisitor()->RegisterV8Reference(std::make_pair( |
103 perIsolateData->scriptWrappableVisitor()->RegisterV8Reference( | 103 const_cast<WrapperTypeInfo*>(wrapperTypeInfo), scriptWrappable)); |
104 std::make_pair(const_cast<WrapperTypeInfo*>(wrapperTypeInfo), | |
105 scriptWrappable)); | |
106 } | |
107 } | 104 } |
108 | 105 |
109 inline void V8DOMWrapper::clearNativeInfo(v8::Isolate* isolate, | 106 inline void V8DOMWrapper::clearNativeInfo(v8::Isolate* isolate, |
110 v8::Local<v8::Object> wrapper) { | 107 v8::Local<v8::Object> wrapper) { |
111 int indices[] = {v8DOMWrapperObjectIndex, v8DOMWrapperTypeIndex}; | 108 int indices[] = {v8DOMWrapperObjectIndex, v8DOMWrapperTypeIndex}; |
112 void* values[] = {nullptr, nullptr}; | 109 void* values[] = {nullptr, nullptr}; |
113 wrapper->SetAlignedPointerInInternalFields(WTF_ARRAY_LENGTH(indices), indices, | 110 wrapper->SetAlignedPointerInInternalFields(WTF_ARRAY_LENGTH(indices), indices, |
114 values); | 111 values); |
115 } | 112 } |
116 | 113 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 196 |
200 bool m_didEnterContext; | 197 bool m_didEnterContext; |
201 v8::Local<v8::Context> m_context; | 198 v8::Local<v8::Context> m_context; |
202 v8::TryCatch m_tryCatch; | 199 v8::TryCatch m_tryCatch; |
203 bool m_convertExceptions; | 200 bool m_convertExceptions; |
204 }; | 201 }; |
205 | 202 |
206 } // namespace blink | 203 } // namespace blink |
207 | 204 |
208 #endif // V8DOMWrapper_h | 205 #endif // V8DOMWrapper_h |
OLD | NEW |