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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 1210083004: bindings: Supports reentrance to ScriptWrappable::wrap through V8DOMWrapper::createWrapper. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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
OLDNEW
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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 5638 matching lines...) Expand 10 before | Expand all | Expand 10 after
5649 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); 5649 const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
5650 5650
5651 if (frame() && frame()->script().initializeMainWorld()) { 5651 if (frame() && frame()->script().initializeMainWorld()) {
5652 // initializeMainWorld may have created a wrapper for the object, retry from the start. 5652 // initializeMainWorld may have created a wrapper for the object, retry from the start.
5653 v8::Local<v8::Object> wrapper = DOMDataStore::getWrapper(this, isolate); 5653 v8::Local<v8::Object> wrapper = DOMDataStore::getWrapper(this, isolate);
5654 if (!wrapper.IsEmpty()) 5654 if (!wrapper.IsEmpty())
5655 return wrapper; 5655 return wrapper;
5656 } 5656 }
5657 5657
5658 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, wrapperType, this); 5658 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, wrapperType, this);
5659 // V8DOMWrapper::createWrapper may run an arbitrary script and it may result
5660 // in creating a new wrapper and associating it with |this|. If so, the
5661 // wrapper already created and associated must be used.
5662 v8::Local<v8::Object> associatedWrapper = DOMDataStore::getWrapper(this, iso late);
5663 if (UNLIKELY(!associatedWrapper.IsEmpty()))
5664 return associatedWrapper;
5659 if (UNLIKELY(wrapper.IsEmpty())) 5665 if (UNLIKELY(wrapper.IsEmpty()))
5660 return wrapper; 5666 return wrapper;
5661 5667
5662 wrapperType->installConditionallyEnabledProperties(wrapper, isolate); 5668 wrapperType->installConditionallyEnabledProperties(wrapper, isolate);
5663 return associateWithWrapper(isolate, wrapperType, wrapper); 5669 return associateWithWrapper(isolate, wrapperType, wrapper);
5664 } 5670 }
5665 5671
5666 v8::Local<v8::Object> Document::associateWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper) 5672 v8::Local<v8::Object> Document::associateWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper)
5667 { 5673 {
5668 V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper ); 5674 V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType, wrapper );
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
5770 #ifndef NDEBUG 5776 #ifndef NDEBUG
5771 using namespace blink; 5777 using namespace blink;
5772 void showLiveDocumentInstances() 5778 void showLiveDocumentInstances()
5773 { 5779 {
5774 WeakDocumentSet& set = liveDocumentSet(); 5780 WeakDocumentSet& set = liveDocumentSet();
5775 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5781 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5776 for (Document* document : set) 5782 for (Document* document : set)
5777 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5783 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5778 } 5784 }
5779 #endif 5785 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698