Chromium Code Reviews| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 Document* document = toDocument(context); | 400 Document* document = toDocument(context); |
| 401 if (Element* element = document->autofocusElement()) { | 401 if (Element* element = document->autofocusElement()) { |
| 402 document->setAutofocusElement(0); | 402 document->setAutofocusElement(0); |
| 403 element->focus(); | 403 element->focus(); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 static void recordLoadReasonToHistogram(WouldLoadReason reason) { | 407 static void recordLoadReasonToHistogram(WouldLoadReason reason) { |
| 408 DEFINE_STATIC_LOCAL( | 408 DEFINE_STATIC_LOCAL( |
| 409 EnumerationHistogram, unseenFrameHistogram, | 409 EnumerationHistogram, unseenFrameHistogram, |
| 410 ("Navigation.DeferredDocumentLoading.StatesV3", WouldLoadReasonEnd)); | 410 ("Navigation.DeferredDocumentLoading.StatesV4", WouldLoadReasonEnd)); |
| 411 unseenFrameHistogram.count(reason); | 411 unseenFrameHistogram.count(reason); |
| 412 } | 412 } |
| 413 | 413 |
| 414 Document::Document(const DocumentInit& initializer, | 414 Document::Document(const DocumentInit& initializer, |
| 415 DocumentClassFlags documentClasses) | 415 DocumentClassFlags documentClasses) |
| 416 : ContainerNode(0, CreateDocument), | 416 : ContainerNode(0, CreateDocument), |
| 417 TreeScope(*this), | 417 TreeScope(*this), |
| 418 m_hasNodesWithPlaceholderStyle(false), | 418 m_hasNodesWithPlaceholderStyle(false), |
| 419 m_evaluateMediaQueriesOnStyleRecalc(false), | 419 m_evaluateMediaQueriesOnStyleRecalc(false), |
| 420 m_pendingSheetLayout(NoLayoutWithPendingSheets), | 420 m_pendingSheetLayout(NoLayoutWithPendingSheets), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 m_compositorPendingAnimations(new CompositorPendingAnimations()), | 497 m_compositorPendingAnimations(new CompositorPendingAnimations()), |
| 498 m_templateDocumentHost(nullptr), | 498 m_templateDocumentHost(nullptr), |
| 499 m_didAssociateFormControlsTimer( | 499 m_didAssociateFormControlsTimer( |
| 500 TaskRunnerHelper::get(TaskType::Internal, this), | 500 TaskRunnerHelper::get(TaskType::Internal, this), |
| 501 this, | 501 this, |
| 502 &Document::didAssociateFormControlsTimerFired), | 502 &Document::didAssociateFormControlsTimerFired), |
| 503 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()), | 503 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()), |
| 504 m_hasViewportUnits(false), | 504 m_hasViewportUnits(false), |
| 505 m_parserSyncPolicy(AllowAsynchronousParsing), | 505 m_parserSyncPolicy(AllowAsynchronousParsing), |
| 506 m_nodeCount(0), | 506 m_nodeCount(0), |
| 507 m_wouldLoadReason(Created), | 507 m_wouldLoadReason(Invalid), |
| 508 m_passwordCount(0) { | 508 m_passwordCount(0) { |
| 509 if (m_frame) { | 509 if (m_frame) { |
| 510 DCHECK(m_frame->page()); | 510 DCHECK(m_frame->page()); |
| 511 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); | 511 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); |
| 512 | 512 |
| 513 m_fetcher = m_frame->loader().documentLoader()->fetcher(); | 513 m_fetcher = m_frame->loader().documentLoader()->fetcher(); |
| 514 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); | 514 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); |
| 515 | 515 |
| 516 CustomElementRegistry* registry = | 516 CustomElementRegistry* registry = |
| 517 m_frame->localDOMWindow() | 517 m_frame->localDOMWindow() |
| (...skipping 5877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6395 visitor->trace(m_propertyRegistry); | 6395 visitor->trace(m_propertyRegistry); |
| 6396 visitor->trace(m_styleReattachDataMap); | 6396 visitor->trace(m_styleReattachDataMap); |
| 6397 Supplementable<Document>::trace(visitor); | 6397 Supplementable<Document>::trace(visitor); |
| 6398 TreeScope::trace(visitor); | 6398 TreeScope::trace(visitor); |
| 6399 ContainerNode::trace(visitor); | 6399 ContainerNode::trace(visitor); |
| 6400 ExecutionContext::trace(visitor); | 6400 ExecutionContext::trace(visitor); |
| 6401 SecurityContext::trace(visitor); | 6401 SecurityContext::trace(visitor); |
| 6402 SynchronousMutationNotifier::trace(visitor); | 6402 SynchronousMutationNotifier::trace(visitor); |
| 6403 } | 6403 } |
| 6404 | 6404 |
| 6405 void Document::maybeRecordLoadReason(WouldLoadReason reason) { | 6405 void Document::recordDeferredLoadReason(WouldLoadReason reason) { |
| 6406 DCHECK(m_wouldLoadReason == Created || reason != Created); | 6406 DCHECK(m_wouldLoadReason == Invalid || reason != Created); |
| 6407 DCHECK(reason != Invalid); | |
| 6407 DCHECK(frame()); | 6408 DCHECK(frame()); |
| 6408 if (m_wouldLoadReason == Created && frame()->isCrossOriginSubframe() && | 6409 DCHECK(frame()->isCrossOriginSubframe()); |
| 6409 frame()->loader().stateMachine()->committedFirstRealDocumentLoad()) { | 6410 if (reason <= m_wouldLoadReason || |
| 6410 recordLoadReasonToHistogram(reason); | 6411 !frame()->loader().stateMachine()->committedFirstRealDocumentLoad()) |
| 6411 } | 6412 return; |
| 6413 for (int i = m_wouldLoadReason + 1; i <= reason; ++i) | |
|
ojan
2016/11/22 00:41:59
I think this means that passing WouldLoadNoParent
dgrogan
2016/11/29 00:57:32
Intentional; it's simpler to subtract in the postp
| |
| 6414 recordLoadReasonToHistogram(static_cast<WouldLoadReason>(i)); | |
| 6412 m_wouldLoadReason = reason; | 6415 m_wouldLoadReason = reason; |
| 6413 } | 6416 } |
| 6414 | 6417 |
| 6415 DEFINE_TRACE_WRAPPERS(Document) { | 6418 DEFINE_TRACE_WRAPPERS(Document) { |
| 6416 visitor->traceWrappers(m_importsController); | 6419 visitor->traceWrappers(m_importsController); |
| 6417 visitor->traceWrappers(m_implementation); | 6420 visitor->traceWrappers(m_implementation); |
| 6418 visitor->traceWrappers(m_styleSheetList); | 6421 visitor->traceWrappers(m_styleSheetList); |
| 6419 visitor->traceWrappers(m_styleEngine); | 6422 visitor->traceWrappers(m_styleEngine); |
| 6420 for (int i = 0; i < numNodeListInvalidationTypes; ++i) { | 6423 for (int i = 0; i < numNodeListInvalidationTypes; ++i) { |
| 6421 for (auto list : m_nodeLists[i]) { | 6424 for (auto list : m_nodeLists[i]) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 6442 } | 6445 } |
| 6443 | 6446 |
| 6444 void showLiveDocumentInstances() { | 6447 void showLiveDocumentInstances() { |
| 6445 WeakDocumentSet& set = liveDocumentSet(); | 6448 WeakDocumentSet& set = liveDocumentSet(); |
| 6446 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6449 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6447 for (Document* document : set) | 6450 for (Document* document : set) |
| 6448 fprintf(stderr, "- Document %p URL: %s\n", document, | 6451 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6449 document->url().getString().utf8().data()); | 6452 document->url().getString().utf8().data()); |
| 6450 } | 6453 } |
| 6451 #endif | 6454 #endif |
| OLD | NEW |