Changeset 77053 in webkit
- Timestamp:
- Jan 29, 2011 12:23:45 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/Parser/ChangeLog
r77050 r77053 1 2011-01-29 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r77050. 4 http://trac.webkit.org/changeset/77050 5 https://bugs.webkit.org/show_bug.cgi?id=53371 6 7 Caused a crash in Chromium's test_shell_tests (Requested by 8 rniwa on #webkit). 9 10 * resources/performance-test.js: Removed. 11 * tiny-innerHTML.html: Removed. 12 1 13 2011-01-28 Eric Seidel <eric@webkit.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r77050 r77053 1 2011-01-29 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r77050. 4 http://trac.webkit.org/changeset/77050 5 https://bugs.webkit.org/show_bug.cgi?id=53371 6 7 Caused a crash in Chromium's test_shell_tests (Requested by 8 rniwa on #webkit). 9 10 * html/parser/HTMLTreeBuilder.cpp: 11 (WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext): 12 (WebCore::HTMLTreeBuilder::FragmentParsingContext::document): 13 (WebCore::HTMLTreeBuilder::FragmentParsingContext::finished): 14 * html/parser/HTMLTreeBuilder.h: 15 1 16 2011-01-28 Eric Seidel <eric@webkit.org> 2 17 -
trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
r77050 r77053 396 396 } 397 397 398 // NOTE: HTML5 requires that we use a dummy document when parsing399 // document fragments. However, creating a new Document element400 // for each fragment is very slow (Document() does too much work, and401 // innerHTML is a common call). So we use a shared dummy document.402 // This sharing works because there can only ever be one fragment403 // parser at any time. Fragment parsing is synchronous and done404 // only from the main thread. It should be impossible for javascript405 // (or anything else) to ever hold a reference to the dummy document.406 // See https://bugs.webkit.org/show_bug.cgi?id=48719407 class DummyDocumentFactory {408 WTF_MAKE_NONCOPYABLE(DummyDocumentFactory); WTF_MAKE_FAST_ALLOCATED;409 public:410 // Use an explicit create/release here to ASSERT this sharing is safe.411 static HTMLDocument* createDummyDocument();412 static void releaseDocument(HTMLDocument*);413 414 private:415 static HTMLDocument* s_sharedDummyDocument;416 static int s_sharedDummyDocumentMutex;417 };418 419 HTMLDocument* DummyDocumentFactory::createDummyDocument()420 {421 if (!s_sharedDummyDocument) {422 s_sharedDummyDocument = HTMLDocument::create(0, KURL()).releaseRef();423 s_sharedDummyDocumentMutex = 0;424 }425 ASSERT(!s_sharedDummyDocumentMutex);426 ASSERT(!s_sharedDummyDocument->hasChildNodes());427 s_sharedDummyDocumentMutex++;428 return s_sharedDummyDocument;429 }430 431 void DummyDocumentFactory::releaseDocument(HTMLDocument* dummyDocument)432 {433 ASSERT(s_sharedDummyDocument == dummyDocument);434 s_sharedDummyDocumentMutex--;435 ASSERT(!s_sharedDummyDocumentMutex);436 dummyDocument->removeAllChildren();437 }438 439 HTMLDocument* DummyDocumentFactory::s_sharedDummyDocument = 0;440 int DummyDocumentFactory::s_sharedDummyDocumentMutex = 0;441 442 398 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext() 443 399 : m_fragment(0) … … 448 404 449 405 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext(DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission) 450 : m_dummyDocumentForFragmentParsing( DummyDocumentFactory::createDummyDocument())406 : m_dummyDocumentForFragmentParsing(HTMLDocument::create(0, KURL(), fragment->document()->baseURI())) 451 407 , m_fragment(fragment) 452 408 , m_contextElement(contextElement) … … 454 410 { 455 411 m_dummyDocumentForFragmentParsing->setCompatibilityMode(fragment->document()->compatibilityMode()); 456 // Setting the baseURL should work the same as it would have had we passed457 // it during HTMLDocument() construction, since the new document is empty.458 m_dummyDocumentForFragmentParsing->setURL(fragment->document()->baseURI());459 412 } 460 413 … … 462 415 { 463 416 ASSERT(m_fragment); 464 return m_dummyDocumentForFragmentParsing ;417 return m_dummyDocumentForFragmentParsing.get(); 465 418 } 466 419 … … 468 421 { 469 422 // Populate the DocumentFragment with the parsed content now that we're done. 470 ContainerNode* root = m_dummyDocumentForFragmentParsing ;423 ContainerNode* root = m_dummyDocumentForFragmentParsing.get(); 471 424 if (m_contextElement) 472 425 root = m_dummyDocumentForFragmentParsing->documentElement(); 473 426 m_fragment->takeAllChildrenFrom(root); 474 ASSERT(!m_dummyDocumentForFragmentParsing->hasChildNodes());475 DummyDocumentFactory::releaseDocument(m_dummyDocumentForFragmentParsing);476 m_dummyDocumentForFragmentParsing = 0;477 427 } 478 428 -
trunk/Source/WebCore/html/parser/HTMLTreeBuilder.h
r77050 r77053 221 221 222 222 private: 223 // Use a shared dummy document to avoid expensive Document creation. 224 // Hold a raw pointer to the document since there is no need to ref it. 225 HTMLDocument* m_dummyDocumentForFragmentParsing; 223 RefPtr<Document> m_dummyDocumentForFragmentParsing; 226 224 DocumentFragment* m_fragment; 227 225 Element* m_contextElement;
Note: See TracChangeset
for help on using the changeset viewer.