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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 : m_isolate(isolate) | 105 : m_isolate(isolate) |
106 { } | 106 { } |
107 | 107 |
108 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t classI
d) override | 108 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t classI
d) override |
109 { | 109 { |
110 | 110 |
111 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf
o::ObjectClassId) { | 111 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf
o::ObjectClassId) { |
112 return; | 112 return; |
113 } | 113 } |
114 | 114 |
| 115 // MinorGC does not collect objects because it may be expensive to |
| 116 // update references during minorGC |
| 117 if (classId == WrapperTypeInfo::ObjectClassId) { |
| 118 v8::Persistent<v8::Object>::Cast(*value).MarkActive(); |
| 119 return; |
| 120 } |
| 121 |
115 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8
::Persistent<v8::Object>::Cast(*value)); | 122 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8
::Persistent<v8::Object>::Cast(*value)); |
116 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); | 123 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); |
117 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper); | 124 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper); |
118 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(wrapper); | 125 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(wrapper); |
119 if (activeDOMObject && activeDOMObject->hasPendingActivity()) { | 126 if (activeDOMObject && activeDOMObject->hasPendingActivity()) { |
120 v8::Persistent<v8::Object>::Cast(*value).MarkActive(); | 127 v8::Persistent<v8::Object>::Cast(*value).MarkActive(); |
121 return; | 128 return; |
122 } | 129 } |
123 | 130 |
124 if (classId == WrapperTypeInfo::NodeClassId) { | 131 if (classId == WrapperTypeInfo::NodeClassId) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 Visitor* m_visitor; | 446 Visitor* m_visitor; |
440 }; | 447 }; |
441 | 448 |
442 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 449 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
443 { | 450 { |
444 DOMWrapperTracer tracer(visitor); | 451 DOMWrapperTracer tracer(visitor); |
445 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 452 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
446 } | 453 } |
447 | 454 |
448 } // namespace blink | 455 } // namespace blink |
OLD | NEW |