OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2406 case Node::DOCUMENT_FRAGMENT_NODE: | 2406 case Node::DOCUMENT_FRAGMENT_NODE: |
2407 return toContainerNode(this)->countChildren(); | 2407 return toContainerNode(this)->countChildren(); |
2408 case Node::ATTRIBUTE_NODE: | 2408 case Node::ATTRIBUTE_NODE: |
2409 case Node::DOCUMENT_TYPE_NODE: | 2409 case Node::DOCUMENT_TYPE_NODE: |
2410 return 0; | 2410 return 0; |
2411 } | 2411 } |
2412 ASSERT_NOT_REACHED(); | 2412 ASSERT_NOT_REACHED(); |
2413 return 0; | 2413 return 0; |
2414 } | 2414 } |
2415 | 2415 |
2416 v8::Local<v8::Object> Node::wrap(v8::Isolate* isolate, v8::Local<v8::Object> cre ationContext) | 2416 v8::Local<v8::Object> Node::wrap(v8::Isolate* isolate, v8::Local<v8::Object> cre ationContext) |
haraken
2015/06/29 12:00:30
Not related to this CL, but why do we need the cus
Yuki
2015/06/29 12:42:41
The code looks completely the same, but we have tw
| |
2417 { | 2417 { |
2418 // It's possible that no one except for the new wrapper owns this object at | 2418 // It's possible that no one except for the new wrapper owns this object at |
2419 // this moment, so we have to prevent GC to collect this object until the | 2419 // this moment, so we have to prevent GC to collect this object until the |
2420 // object gets associated with the wrapper. | 2420 // object gets associated with the wrapper. |
2421 RefPtrWillBeRawPtr<Node> protect(this); | 2421 RefPtrWillBeRawPtr<Node> protect(this); |
2422 | 2422 |
2423 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); | 2423 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); |
2424 | 2424 |
2425 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); | 2425 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); |
2426 | 2426 |
2427 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, wrapperType, this); | 2427 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, wrapperType, this); |
2428 // V8DOMWrapper::createWrapper may run an arbitrary script and it may result | |
2429 // in creating a new wrapper and associating it with |this|. If so, the | |
2430 // wrapper already created and associated must be used. | |
2431 v8::Local<v8::Object> associatedWrapper = DOMDataStore::getWrapper(this, iso late); | |
2432 if (UNLIKELY(!associatedWrapper.IsEmpty())) | |
2433 return associatedWrapper; | |
2428 if (UNLIKELY(wrapper.IsEmpty())) | 2434 if (UNLIKELY(wrapper.IsEmpty())) |
2429 return wrapper; | 2435 return wrapper; |
2430 | 2436 |
2431 wrapperType->installConditionallyEnabledProperties(wrapper, isolate); | 2437 wrapperType->installConditionallyEnabledProperties(wrapper, isolate); |
2432 return associateWithWrapper(isolate, wrapperType, wrapper); | 2438 return associateWithWrapper(isolate, wrapperType, wrapper); |
2433 } | 2439 } |
2434 | 2440 |
2435 v8::Local<v8::Object> Node::associateWithWrapper(v8::Isolate* isolate, const Wra pperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper) | 2441 v8::Local<v8::Object> Node::associateWithWrapper(v8::Isolate* isolate, const Wra pperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper) |
2436 { | 2442 { |
2437 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper); | 2443 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper); |
(...skipping 21 matching lines...) Expand all Loading... | |
2459 | 2465 |
2460 void showNodePath(const blink::Node* node) | 2466 void showNodePath(const blink::Node* node) |
2461 { | 2467 { |
2462 if (node) | 2468 if (node) |
2463 node->showNodePathForThis(); | 2469 node->showNodePathForThis(); |
2464 else | 2470 else |
2465 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2471 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
2466 } | 2472 } |
2467 | 2473 |
2468 #endif | 2474 #endif |
OLD | NEW |