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

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

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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/v8/V8Binding.cpp ('k') | Source/bindings/v8/V8NPObject.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // So this limit is mainly for pathological micro benchmarks. 115 // So this limit is mainly for pathological micro benchmarks.
116 const unsigned wrappersHandledByEachMinorGC = 10000; 116 const unsigned wrappersHandledByEachMinorGC = 10000;
117 if (m_nodesInNewSpace.size() >= wrappersHandledByEachMinorGC) 117 if (m_nodesInNewSpace.size() >= wrappersHandledByEachMinorGC)
118 return; 118 return;
119 119
120 // Casting to a Handle is safe here, since the Persistent cannot get GCd 120 // Casting to a Handle is safe here, since the Persistent cannot get GCd
121 // during the GC prologue. 121 // during the GC prologue.
122 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject()); 122 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject());
123 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value); 123 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value);
124 ASSERT(V8DOMWrapper::maybeDOMWrapper(*wrapper)); 124 ASSERT(V8DOMWrapper::maybeDOMWrapper(*wrapper));
125 ASSERT(V8Node::hasInstanceInAnyWorld(*wrapper, m_isolate)); 125 ASSERT(V8Node::hasInstance(*wrapper, m_isolate));
126 Node* node = V8Node::toNative(*wrapper); 126 Node* node = V8Node::toNative(*wrapper);
127 // A minor DOM GC can handle only node wrappers in the main world. 127 // A minor DOM GC can handle only node wrappers in the main world.
128 // Note that node->wrapper().IsEmpty() returns true for nodes that 128 // Note that node->wrapper().IsEmpty() returns true for nodes that
129 // do not have wrappers in the main world. 129 // do not have wrappers in the main world.
130 if (node->containsWrapper()) { 130 if (node->containsWrapper()) {
131 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper); 131 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper);
132 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper) ; 132 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper) ;
133 if (activeDOMObject && activeDOMObject->hasPendingActivity()) 133 if (activeDOMObject && activeDOMObject->hasPendingActivity())
134 return; 134 return;
135 // FIXME: Remove the special handling for image elements. 135 // FIXME: Remove the special handling for image elements.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 return; 259 return;
260 260
261 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper); 261 const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper);
262 void* object = toNative(*wrapper); 262 void* object = toNative(*wrapper);
263 263
264 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper); 264 ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper);
265 if (activeDOMObject && activeDOMObject->hasPendingActivity()) 265 if (activeDOMObject && activeDOMObject->hasPendingActivity())
266 m_isolate->SetObjectGroupId(*value, liveRootId()); 266 m_isolate->SetObjectGroupId(*value, liveRootId());
267 267
268 if (classId == v8DOMNodeClassId) { 268 if (classId == v8DOMNodeClassId) {
269 ASSERT(V8Node::hasInstanceInAnyWorld(*wrapper, m_isolate)); 269 ASSERT(V8Node::hasInstance(*wrapper, m_isolate));
270 Node* node = static_cast<Node*>(object); 270 Node* node = static_cast<Node*>(object);
271 if (node->hasEventListeners()) 271 if (node->hasEventListeners())
272 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers istent<v8::Object>::Cast(*value)); 272 addReferencesForNodeWithEventListeners(m_isolate, node, v8::Pers istent<v8::Object>::Cast(*value));
273 Node* root = V8GCController::opaqueRootForGC(node, m_isolate); 273 Node* root = V8GCController::opaqueRootForGC(node, m_isolate);
274 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root))); 274 m_isolate->SetObjectGroupId(*value, v8::UniqueId(reinterpret_cast<in tptr_t>(root)));
275 if (m_constructRetainedObjectInfos) 275 if (m_constructRetainedObjectInfos)
276 m_groupsWhichNeedRetainerInfo.append(root); 276 m_groupsWhichNeedRetainerInfo.append(root);
277 } else if (classId == v8DOMObjectClassId) { 277 } else if (classId == v8DOMObjectClassId) {
278 v8::Persistent<v8::Object>* wrapperPersistent = reinterpret_cast<v8: :Persistent<v8::Object>*>(value); 278 v8::Persistent<v8::Object>* wrapperPersistent = reinterpret_cast<v8: :Persistent<v8::Object>*>(value);
279 type->visitDOMWrapper(object, *wrapperPersistent, m_isolate); 279 type->visitDOMWrapper(object, *wrapperPersistent, m_isolate);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 { 405 {
406 v8::HandleScope handleScope(isolate); 406 v8::HandleScope handleScope(isolate);
407 v8::Local<v8::Context> context = v8::Context::New(isolate); 407 v8::Local<v8::Context> context = v8::Context::New(isolate);
408 if (context.IsEmpty()) 408 if (context.IsEmpty())
409 return; 409 return;
410 v8::Context::Scope contextScope(context); 410 v8::Context::Scope contextScope(context);
411 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc(); "), isolate); 411 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc(); "), isolate);
412 } 412 }
413 413
414 } // namespace WebCore 414 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.cpp ('k') | Source/bindings/v8/V8NPObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698