| 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 * (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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 static bool acceptsEditingFocus(const Element& element) | 329 static bool acceptsEditingFocus(const Element& element) |
| 330 { | 330 { |
| 331 ASSERT(element.hasEditableStyle()); | 331 ASSERT(element.hasEditableStyle()); |
| 332 | 332 |
| 333 return element.document().frame() && element.rootEditableElement(); | 333 return element.document().frame() && element.rootEditableElement(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 uint64_t Document::s_globalTreeVersion = 0; | 336 uint64_t Document::s_globalTreeVersion = 0; |
| 337 | 337 |
| 338 #ifndef NDEBUG | 338 Document::WeakDocumentSet& Document::liveDocumentSet() |
| 339 using WeakDocumentSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Document>>; | |
| 340 static WeakDocumentSet& liveDocumentSet() | |
| 341 { | 339 { |
| 342 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrW
illBeNoop(new WeakDocumentSet()))); | 340 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrW
illBeNoop(new WeakDocumentSet()))); |
| 343 return *set; | 341 return *set; |
| 344 } | 342 } |
| 345 #endif | |
| 346 | 343 |
| 347 // This class doesn't work with non-Document ExecutionContext. | 344 // This class doesn't work with non-Document ExecutionContext. |
| 348 class AutofocusTask final : public ExecutionContextTask { | 345 class AutofocusTask final : public ExecutionContextTask { |
| 349 public: | 346 public: |
| 350 static PassOwnPtr<AutofocusTask> create() | 347 static PassOwnPtr<AutofocusTask> create() |
| 351 { | 348 { |
| 352 return adoptPtr(new AutofocusTask()); | 349 return adoptPtr(new AutofocusTask()); |
| 353 } | 350 } |
| 354 ~AutofocusTask() override { } | 351 ~AutofocusTask() override { } |
| 355 | 352 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // CSSFontSelector, need to initialize m_styleEngine after initializing | 470 // CSSFontSelector, need to initialize m_styleEngine after initializing |
| 474 // m_fetcher. | 471 // m_fetcher. |
| 475 m_styleEngine = StyleEngine::create(*this); | 472 m_styleEngine = StyleEngine::create(*this); |
| 476 | 473 |
| 477 // The parent's parser should be suspended together with all the other objec
ts, | 474 // The parent's parser should be suspended together with all the other objec
ts, |
| 478 // else this new Document would have a new ExecutionContext which suspended
state | 475 // else this new Document would have a new ExecutionContext which suspended
state |
| 479 // would not match the one from the parent, and could start loading resource
s | 476 // would not match the one from the parent, and could start loading resource
s |
| 480 // ignoring the defersLoading flag. | 477 // ignoring the defersLoading flag. |
| 481 ASSERT(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended(
)); | 478 ASSERT(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended(
)); |
| 482 | 479 |
| 483 #ifndef NDEBUG | |
| 484 liveDocumentSet().add(this); | 480 liveDocumentSet().add(this); |
| 485 #endif | |
| 486 } | 481 } |
| 487 | 482 |
| 488 Document::~Document() | 483 Document::~Document() |
| 489 { | 484 { |
| 490 ASSERT(!layoutView()); | 485 ASSERT(!layoutView()); |
| 491 ASSERT(!parentTreeScope()); | 486 ASSERT(!parentTreeScope()); |
| 492 // If a top document with a cache, verify that it was comprehensively | 487 // If a top document with a cache, verify that it was comprehensively |
| 493 // cleared during detach. | 488 // cleared during detach. |
| 494 ASSERT(!m_axObjectCache); | 489 ASSERT(!m_axObjectCache); |
| 495 #if !ENABLE(OILPAN) | 490 #if !ENABLE(OILPAN) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 // We must call clearRareData() here since a Document class inherits TreeSco
pe | 531 // We must call clearRareData() here since a Document class inherits TreeSco
pe |
| 537 // as well as Node. See a comment on TreeScope.h for the reason. | 532 // as well as Node. See a comment on TreeScope.h for the reason. |
| 538 if (hasRareData()) | 533 if (hasRareData()) |
| 539 clearRareData(); | 534 clearRareData(); |
| 540 | 535 |
| 541 ASSERT(m_listsInvalidatedAtDocument.isEmpty()); | 536 ASSERT(m_listsInvalidatedAtDocument.isEmpty()); |
| 542 | 537 |
| 543 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i) | 538 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i) |
| 544 ASSERT(!m_nodeListCounts[i]); | 539 ASSERT(!m_nodeListCounts[i]); |
| 545 | 540 |
| 546 #ifndef NDEBUG | |
| 547 liveDocumentSet().remove(this); | 541 liveDocumentSet().remove(this); |
| 548 #endif | 542 #endif |
| 549 #endif | |
| 550 | 543 |
| 551 InstanceCounters::decrementCounter(InstanceCounters::DocumentCounter); | 544 InstanceCounters::decrementCounter(InstanceCounters::DocumentCounter); |
| 552 } | 545 } |
| 553 | 546 |
| 554 #if !ENABLE(OILPAN) | 547 #if !ENABLE(OILPAN) |
| 555 void Document::dispose() | 548 void Document::dispose() |
| 556 { | 549 { |
| 557 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); | 550 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); |
| 558 | 551 |
| 559 // We must make sure not to be retaining any of our children through | 552 // We must make sure not to be retaining any of our children through |
| (...skipping 5214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5774 } | 5767 } |
| 5775 | 5768 |
| 5776 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; | 5769 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; |
| 5777 | 5770 |
| 5778 } // namespace blink | 5771 } // namespace blink |
| 5779 | 5772 |
| 5780 #ifndef NDEBUG | 5773 #ifndef NDEBUG |
| 5781 using namespace blink; | 5774 using namespace blink; |
| 5782 void showLiveDocumentInstances() | 5775 void showLiveDocumentInstances() |
| 5783 { | 5776 { |
| 5784 WeakDocumentSet& set = liveDocumentSet(); | 5777 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5785 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5778 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5786 for (Document* document : set) | 5779 for (Document* document : set) |
| 5787 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5780 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5788 } | 5781 } |
| 5789 #endif | 5782 #endif |
| OLD | NEW |