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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) OVERRIDE | 232 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) OVERRIDE |
233 { | 233 { |
234 // Casting to a Handle is safe here, since the Persistent cannot get GCd | 234 // Casting to a Handle is safe here, since the Persistent cannot get GCd |
235 // during the GC prologue. | 235 // during the GC prologue. |
236 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject()); | 236 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject()); |
237 | 237 |
238 if (classId != v8DOMNodeClassId && classId != v8DOMObjectClassId) | 238 if (classId != v8DOMNodeClassId && classId != v8DOMObjectClassId) |
239 return; | 239 return; |
240 | 240 |
241 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value); | 241 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value); |
242 v8::Persistent<v8::Object>* wrapperpers = reinterpret_cast<v8::Persisten t<v8::Object>*>(value); | |
haraken
2013/10/10 06:08:32
You can write this just before you use |wrapperper
| |
242 | 243 |
243 ASSERT(V8DOMWrapper::maybeDOMWrapper(*wrapper)); | 244 ASSERT(V8DOMWrapper::maybeDOMWrapper(*wrapper)); |
244 | 245 |
245 if (value->IsIndependent()) | 246 if (value->IsIndependent()) |
246 return; | 247 return; |
247 | 248 |
248 WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper); | 249 WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper); |
249 void* object = toNative(*wrapper); | 250 void* object = toNative(*wrapper); |
250 | 251 |
251 if (V8MessagePort::info.equals(type)) { | 252 if (V8MessagePort::info.equals(type)) { |
(...skipping 25 matching lines...) Expand all Loading... | |
277 Node* node = static_cast<Node*>(object); | 278 Node* node = static_cast<Node*>(object); |
278 | 279 |
279 if (node->hasEventListeners()) | 280 if (node->hasEventListeners()) |
280 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers istent<v8::Object>::Cast(*value)); | 281 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers istent<v8::Object>::Cast(*value)); |
281 Node* root = V8GCController::opaqueRootForGC(node, m_isolate); | 282 Node* root = V8GCController::opaqueRootForGC(node, m_isolate); |
282 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); | 283 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); |
283 if (m_constructRetainedObjectInfos) | 284 if (m_constructRetainedObjectInfos) |
284 m_groupsWhichNeedRetainerInfo.append(root); | 285 m_groupsWhichNeedRetainerInfo.append(root); |
285 } else if (classId == v8DOMObjectClassId) { | 286 } else if (classId == v8DOMObjectClassId) { |
286 ASSERT(!value->IsIndependent()); | 287 ASSERT(!value->IsIndependent()); |
287 void* root = type->opaqueRootForGC(object, m_isolate); | 288 void* root = type->resolveWrapperReachability(object, *wrapperpers, m_isolate); |
288 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); | 289 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); |
haraken
2013/10/10 06:08:32
This is a bit confusing. resolveWrapperReachabilit
| |
289 } else { | 290 } else { |
290 ASSERT_NOT_REACHED(); | 291 ASSERT_NOT_REACHED(); |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 void notifyFinished() | 295 void notifyFinished() |
295 { | 296 { |
296 if (!m_constructRetainedObjectInfos) | 297 if (!m_constructRetainedObjectInfos) |
297 return; | 298 return; |
298 std::sort(m_groupsWhichNeedRetainerInfo.begin(), m_groupsWhichNeedRetain erInfo.end()); | 299 std::sort(m_groupsWhichNeedRetainerInfo.begin(), m_groupsWhichNeedRetain erInfo.end()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 { | 415 { |
415 v8::HandleScope handleScope(isolate); | 416 v8::HandleScope handleScope(isolate); |
416 v8::Local<v8::Context> context = v8::Context::New(isolate); | 417 v8::Local<v8::Context> context = v8::Context::New(isolate); |
417 if (context.IsEmpty()) | 418 if (context.IsEmpty()) |
418 return; | 419 return; |
419 v8::Context::Scope contextScope(context); | 420 v8::Context::Scope contextScope(context); |
420 V8ScriptRunner::compileAndRunInternalScript(v8String("if (gc) gc();", isolat e), isolate); | 421 V8ScriptRunner::compileAndRunInternalScript(v8String("if (gc) gc();", isolat e), isolate); |
421 } | 422 } |
422 | 423 |
423 } // namespace WebCore | 424 } // namespace WebCore |
OLD | NEW |