Chromium Code Reviews| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 222 |
| 223 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { | 223 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { |
| 224 public: | 224 public: |
| 225 explicit MajorGCWrapperVisitor(v8::Isolate* isolate, bool constructRetainedO bjectInfos) | 225 explicit MajorGCWrapperVisitor(v8::Isolate* isolate, bool constructRetainedO bjectInfos) |
| 226 : m_isolate(isolate) | 226 : m_isolate(isolate) |
| 227 , m_liveRootGroupIdSet(false) | 227 , m_liveRootGroupIdSet(false) |
| 228 , m_constructRetainedObjectInfos(constructRetainedObjectInfos) | 228 , m_constructRetainedObjectInfos(constructRetainedObjectInfos) |
| 229 { | 229 { |
| 230 } | 230 } |
| 231 | 231 |
| 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 |
|
haraken
2013/10/17 03:28:22
Not related to your CL, I think the type of |value
| |
| 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 | 242 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 Node* node = static_cast<Node*>(object); | 277 Node* node = static_cast<Node*>(object); |
| 278 | 278 |
| 279 if (node->hasEventListeners()) | 279 if (node->hasEventListeners()) |
| 280 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers istent<v8::Object>::Cast(*value)); | 280 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers istent<v8::Object>::Cast(*value)); |
| 281 Node* root = V8GCController::opaqueRootForGC(node, m_isolate); | 281 Node* root = V8GCController::opaqueRootForGC(node, m_isolate); |
| 282 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); | 282 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); |
| 283 if (m_constructRetainedObjectInfos) | 283 if (m_constructRetainedObjectInfos) |
| 284 m_groupsWhichNeedRetainerInfo.append(root); | 284 m_groupsWhichNeedRetainerInfo.append(root); |
| 285 } else if (classId == v8DOMObjectClassId) { | 285 } else if (classId == v8DOMObjectClassId) { |
| 286 ASSERT(!value->IsIndependent()); | 286 ASSERT(!value->IsIndependent()); |
| 287 void* root = type->opaqueRootForGC(object, m_isolate); | 287 v8::Persistent<v8::Object>* wrapperPersistent = reinterpret_cast<v8: :Persistent<v8::Object>*>(value); |
| 288 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); | 288 type->resolveWrapperReachability(object, *wrapperPersistent, m_isola te); |
| 289 } else { | 289 } else { |
| 290 ASSERT_NOT_REACHED(); | 290 ASSERT_NOT_REACHED(); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 void notifyFinished() | 294 void notifyFinished() |
| 295 { | 295 { |
| 296 if (!m_constructRetainedObjectInfos) | 296 if (!m_constructRetainedObjectInfos) |
| 297 return; | 297 return; |
| 298 std::sort(m_groupsWhichNeedRetainerInfo.begin(), m_groupsWhichNeedRetain erInfo.end()); | 298 std::sort(m_groupsWhichNeedRetainerInfo.begin(), m_groupsWhichNeedRetain erInfo.end()); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 { | 414 { |
| 415 v8::HandleScope handleScope(isolate); | 415 v8::HandleScope handleScope(isolate); |
| 416 v8::Local<v8::Context> context = v8::Context::New(isolate); | 416 v8::Local<v8::Context> context = v8::Context::New(isolate); |
| 417 if (context.IsEmpty()) | 417 if (context.IsEmpty()) |
| 418 return; | 418 return; |
| 419 v8::Context::Scope contextScope(context); | 419 v8::Context::Scope contextScope(context); |
| 420 V8ScriptRunner::compileAndRunInternalScript(v8String("if (gc) gc();", isolat e), isolate); | 420 V8ScriptRunner::compileAndRunInternalScript(v8String("if (gc) gc();", isolat e), isolate); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace WebCore | 423 } // namespace WebCore |
| OLD | NEW |