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