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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 if (listener->type() != EventListener::JSEventListenerType) | 66 if (listener->type() != EventListener::JSEventListenerType) |
67 continue; | 67 continue; |
68 V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListene
r*>(listener); | 68 V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListene
r*>(listener); |
69 if (!v8listener->hasExistingListenerObject()) | 69 if (!v8listener->hasExistingListenerObject()) |
70 continue; | 70 continue; |
71 | 71 |
72 isolate->SetReference(wrapper, v8::Persistent<v8::Value>::Cast(v8listene
r->existingListenerObjectPersistentHandle())); | 72 isolate->SetReference(wrapper, v8::Persistent<v8::Value>::Cast(v8listene
r->existingListenerObjectPersistentHandle())); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 Node* V8GCController::opaqueRootForGC(Node* node, v8::Isolate*) | 76 Node* V8GCController::opaqueRootForGC(v8::Isolate*, Node* node) |
77 { | 77 { |
78 ASSERT(node); | 78 ASSERT(node); |
79 // FIXME: Remove the special handling for image elements. | 79 // FIXME: Remove the special handling for image elements. |
80 // The same special handling is in V8GCController::gcTree(). | 80 // The same special handling is in V8GCController::gcTree(). |
81 // Maybe should image elements be active DOM nodes? | 81 // Maybe should image elements be active DOM nodes? |
82 // See https://code.google.com/p/chromium/issues/detail?id=164882 | 82 // See https://code.google.com/p/chromium/issues/detail?id=164882 |
83 if (node->inDocument() || (isHTMLImageElement(*node) && toHTMLImageElement(*
node).hasPendingActivity())) { | 83 if (node->inDocument() || (isHTMLImageElement(*node) && toHTMLImageElement(*
node).hasPendingActivity())) { |
84 Document& document = node->document(); | 84 Document& document = node->document(); |
85 if (HTMLImportsController* controller = document.importsController()) | 85 if (HTMLImportsController* controller = document.importsController()) |
86 return controller->master(); | 86 return controller->master(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper); | 271 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper); |
272 if (activeDOMObject && activeDOMObject->hasPendingActivity()) | 272 if (activeDOMObject && activeDOMObject->hasPendingActivity()) |
273 m_isolate->SetObjectGroupId(*value, liveRootId()); | 273 m_isolate->SetObjectGroupId(*value, liveRootId()); |
274 | 274 |
275 if (classId == WrapperTypeInfo::NodeClassId) { | 275 if (classId == WrapperTypeInfo::NodeClassId) { |
276 ASSERT(V8Node::hasInstance(*wrapper, m_isolate)); | 276 ASSERT(V8Node::hasInstance(*wrapper, m_isolate)); |
277 Node* node = V8Node::toImpl(*wrapper); | 277 Node* node = V8Node::toImpl(*wrapper); |
278 if (node->hasEventListeners()) | 278 if (node->hasEventListeners()) |
279 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers
istent<v8::Object>::Cast(*value)); | 279 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers
istent<v8::Object>::Cast(*value)); |
280 Node* root = V8GCController::opaqueRootForGC(node, m_isolate); | 280 Node* root = V8GCController::opaqueRootForGC(m_isolate, node); |
281 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in
tptr_t>(root))); | 281 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in
tptr_t>(root))); |
282 if (m_constructRetainedObjectInfos) | 282 if (m_constructRetainedObjectInfos) |
283 m_groupsWhichNeedRetainerInfo.append(root); | 283 m_groupsWhichNeedRetainerInfo.append(root); |
284 } else if (classId == WrapperTypeInfo::ObjectClassId) { | 284 } else if (classId == WrapperTypeInfo::ObjectClassId) { |
285 type->visitDOMWrapper(toScriptWrappableBase(*wrapper), v8::Persisten
t<v8::Object>::Cast(*value), m_isolate); | 285 type->visitDOMWrapper(toScriptWrappableBase(*wrapper), v8::Persisten
t<v8::Object>::Cast(*value), m_isolate); |
286 } else { | 286 } else { |
287 ASSERT_NOT_REACHED(); | 287 ASSERT_NOT_REACHED(); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 static size_t lastUsageReportedToV8 = 0; | 464 static size_t lastUsageReportedToV8 = 0; |
465 | 465 |
466 size_t currentUsage = Partitions::currentDOMMemoryUsage(); | 466 size_t currentUsage = Partitions::currentDOMMemoryUsage(); |
467 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las
tUsageReportedToV8); | 467 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las
tUsageReportedToV8); |
468 isolate->AdjustAmountOfExternalAllocatedMemory(diff); | 468 isolate->AdjustAmountOfExternalAllocatedMemory(diff); |
469 | 469 |
470 lastUsageReportedToV8 = currentUsage; | 470 lastUsageReportedToV8 = currentUsage; |
471 } | 471 } |
472 | 472 |
473 } // namespace blink | 473 } // namespace blink |
OLD | NEW |