Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: Source/bindings/core/v8/V8GCController.cpp

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/V8DOMWrapper.h ('k') | Source/bindings/core/v8/V8Initializer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const unsigned wrappersHandledByEachMinorGC = 10000; 124 const unsigned wrappersHandledByEachMinorGC = 10000;
125 if (m_nodesInNewSpace.size() >= wrappersHandledByEachMinorGC) 125 if (m_nodesInNewSpace.size() >= wrappersHandledByEachMinorGC)
126 return; 126 return;
127 127
128 // Casting to a Handle is safe here, since the Persistent doesn't get GC d 128 // Casting to a Handle is safe here, since the Persistent doesn't get GC d
129 // during the GC prologue. 129 // during the GC prologue.
130 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject()); 130 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject());
131 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value); 131 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value);
132 ASSERT(V8DOMWrapper::isDOMWrapper(*wrapper)); 132 ASSERT(V8DOMWrapper::isDOMWrapper(*wrapper));
133 ASSERT(V8Node::hasInstance(*wrapper, m_isolate)); 133 ASSERT(V8Node::hasInstance(*wrapper, m_isolate));
134 Node* node = V8Node::toNative(*wrapper); 134 Node* node = V8Node::toImpl(*wrapper);
135 // A minor DOM GC can handle only node wrappers in the main world. 135 // A minor DOM GC can handle only node wrappers in the main world.
136 // Note that node->wrapper().IsEmpty() returns true for nodes that 136 // Note that node->wrapper().IsEmpty() returns true for nodes that
137 // do not have wrappers in the main world. 137 // do not have wrappers in the main world.
138 if (node->containsWrapper()) { 138 if (node->containsWrapper()) {
139 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper); 139 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper);
140 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper) ; 140 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper) ;
141 if (activeDOMObject && activeDOMObject->hasPendingActivity()) 141 if (activeDOMObject && activeDOMObject->hasPendingActivity())
142 return; 142 return;
143 // FIXME: Remove the special handling for image elements. 143 // FIXME: Remove the special handling for image elements.
144 // The same special handling is in V8GCController::opaqueRootForGC() . 144 // The same special handling is in V8GCController::opaqueRootForGC() .
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return; 267 return;
268 268
269 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper); 269 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper);
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::toNative(*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(node, m_isolate);
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(toInternalPointer(*wrapper), v8::Persistent<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
291 void notifyFinished() 291 void notifyFinished()
292 { 292 {
293 if (!m_constructRetainedObjectInfos) 293 if (!m_constructRetainedObjectInfos)
294 return; 294 return;
295 std::sort(m_groupsWhichNeedRetainerInfo.begin(), m_groupsWhichNeedRetain erInfo.end()); 295 std::sort(m_groupsWhichNeedRetainerInfo.begin(), m_groupsWhichNeedRetain erInfo.end());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 static size_t lastUsageReportedToV8 = 0; 450 static size_t lastUsageReportedToV8 = 0;
451 451
452 size_t currentUsage = Partitions::currentDOMMemoryUsage(); 452 size_t currentUsage = Partitions::currentDOMMemoryUsage();
453 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8); 453 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8);
454 isolate->AdjustAmountOfExternalAllocatedMemory(diff); 454 isolate->AdjustAmountOfExternalAllocatedMemory(diff);
455 455
456 lastUsageReportedToV8 = currentUsage; 456 lastUsageReportedToV8 = currentUsage;
457 } 457 }
458 458
459 } // namespace blink 459 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8DOMWrapper.h ('k') | Source/bindings/core/v8/V8Initializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698