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

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

Issue 2516473002: Cross-origin iframes: collect data under hypothetical loading strategies (Closed)
Patch Set: Do arithmetic instead of intersects Created 4 years 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
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 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 Document* document = toDocument(context); 389 Document* document = toDocument(context);
390 if (Element* element = document->autofocusElement()) { 390 if (Element* element = document->autofocusElement()) {
391 document->setAutofocusElement(0); 391 document->setAutofocusElement(0);
392 element->focus(); 392 element->focus();
393 } 393 }
394 } 394 }
395 395
396 static void recordLoadReasonToHistogram(WouldLoadReason reason) { 396 static void recordLoadReasonToHistogram(WouldLoadReason reason) {
397 DEFINE_STATIC_LOCAL( 397 DEFINE_STATIC_LOCAL(
398 EnumerationHistogram, unseenFrameHistogram, 398 EnumerationHistogram, unseenFrameHistogram,
399 ("Navigation.DeferredDocumentLoading.StatesV3", WouldLoadReasonEnd)); 399 ("Navigation.DeferredDocumentLoading.StatesV4", WouldLoadReasonEnd));
400 unseenFrameHistogram.count(reason); 400 unseenFrameHistogram.count(reason);
401 } 401 }
402 402
403 Document::Document(const DocumentInit& initializer, 403 Document::Document(const DocumentInit& initializer,
404 DocumentClassFlags documentClasses) 404 DocumentClassFlags documentClasses)
405 : ContainerNode(0, CreateDocument), 405 : ContainerNode(0, CreateDocument),
406 TreeScope(*this), 406 TreeScope(*this),
407 m_hasNodesWithPlaceholderStyle(false), 407 m_hasNodesWithPlaceholderStyle(false),
408 m_evaluateMediaQueriesOnStyleRecalc(false), 408 m_evaluateMediaQueriesOnStyleRecalc(false),
409 m_pendingSheetLayout(NoLayoutWithPendingSheets), 409 m_pendingSheetLayout(NoLayoutWithPendingSheets),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 m_compositorPendingAnimations(new CompositorPendingAnimations()), 485 m_compositorPendingAnimations(new CompositorPendingAnimations()),
486 m_templateDocumentHost(nullptr), 486 m_templateDocumentHost(nullptr),
487 m_didAssociateFormControlsTimer( 487 m_didAssociateFormControlsTimer(
488 TaskRunnerHelper::get(TaskType::UnspecedLoading, this), 488 TaskRunnerHelper::get(TaskType::UnspecedLoading, this),
489 this, 489 this,
490 &Document::didAssociateFormControlsTimerFired), 490 &Document::didAssociateFormControlsTimerFired),
491 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()), 491 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()),
492 m_hasViewportUnits(false), 492 m_hasViewportUnits(false),
493 m_parserSyncPolicy(AllowAsynchronousParsing), 493 m_parserSyncPolicy(AllowAsynchronousParsing),
494 m_nodeCount(0), 494 m_nodeCount(0),
495 m_wouldLoadReason(Created), 495 m_wouldLoadReason(Invalid),
496 m_passwordCount(0), 496 m_passwordCount(0),
497 m_engagementLevel(mojom::blink::EngagementLevel::NONE) { 497 m_engagementLevel(mojom::blink::EngagementLevel::NONE) {
498 if (m_frame) { 498 if (m_frame) {
499 DCHECK(m_frame->page()); 499 DCHECK(m_frame->page());
500 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 500 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
501 501
502 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 502 m_fetcher = m_frame->loader().documentLoader()->fetcher();
503 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 503 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
504 504
505 // TODO(dcheng): Why does this need to check that DOMWindow is non-null? 505 // TODO(dcheng): Why does this need to check that DOMWindow is non-null?
(...skipping 6026 matching lines...) Expand 10 before | Expand all | Expand 10 after
6532 visitor->trace(m_propertyRegistry); 6532 visitor->trace(m_propertyRegistry);
6533 visitor->trace(m_styleReattachDataMap); 6533 visitor->trace(m_styleReattachDataMap);
6534 Supplementable<Document>::trace(visitor); 6534 Supplementable<Document>::trace(visitor);
6535 TreeScope::trace(visitor); 6535 TreeScope::trace(visitor);
6536 ContainerNode::trace(visitor); 6536 ContainerNode::trace(visitor);
6537 ExecutionContext::trace(visitor); 6537 ExecutionContext::trace(visitor);
6538 SecurityContext::trace(visitor); 6538 SecurityContext::trace(visitor);
6539 SynchronousMutationNotifier::trace(visitor); 6539 SynchronousMutationNotifier::trace(visitor);
6540 } 6540 }
6541 6541
6542 void Document::maybeRecordLoadReason(WouldLoadReason reason) { 6542 void Document::recordDeferredLoadReason(WouldLoadReason reason) {
6543 DCHECK(m_wouldLoadReason == Created || reason != Created); 6543 DCHECK(m_wouldLoadReason == Invalid || reason != Created);
6544 DCHECK(reason != Invalid);
6544 DCHECK(frame()); 6545 DCHECK(frame());
6545 if (m_wouldLoadReason == Created && frame()->isCrossOriginSubframe() && 6546 DCHECK(frame()->isCrossOriginSubframe());
6546 frame()->loader().stateMachine()->committedFirstRealDocumentLoad()) { 6547 if (reason <= m_wouldLoadReason ||
6547 recordLoadReasonToHistogram(reason); 6548 !frame()->loader().stateMachine()->committedFirstRealDocumentLoad())
6548 } 6549 return;
6550 for (int i = m_wouldLoadReason + 1; i <= reason; ++i)
6551 recordLoadReasonToHistogram(static_cast<WouldLoadReason>(i));
6549 m_wouldLoadReason = reason; 6552 m_wouldLoadReason = reason;
6550 } 6553 }
6551 6554
6552 DEFINE_TRACE_WRAPPERS(Document) { 6555 DEFINE_TRACE_WRAPPERS(Document) {
6553 visitor->traceWrappers(m_importsController); 6556 visitor->traceWrappers(m_importsController);
6554 visitor->traceWrappers(m_implementation); 6557 visitor->traceWrappers(m_implementation);
6555 visitor->traceWrappers(m_styleSheetList); 6558 visitor->traceWrappers(m_styleSheetList);
6556 visitor->traceWrappers(m_styleEngine); 6559 visitor->traceWrappers(m_styleEngine);
6557 for (int i = 0; i < numNodeListInvalidationTypes; ++i) { 6560 for (int i = 0; i < numNodeListInvalidationTypes; ++i) {
6558 for (auto list : m_nodeLists[i]) { 6561 for (auto list : m_nodeLists[i]) {
(...skipping 27 matching lines...) Expand all
6586 } 6589 }
6587 6590
6588 void showLiveDocumentInstances() { 6591 void showLiveDocumentInstances() {
6589 WeakDocumentSet& set = liveDocumentSet(); 6592 WeakDocumentSet& set = liveDocumentSet();
6590 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6593 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6591 for (Document* document : set) 6594 for (Document* document : set)
6592 fprintf(stderr, "- Document %p URL: %s\n", document, 6595 fprintf(stderr, "- Document %p URL: %s\n", document,
6593 document->url().getString().utf8().data()); 6596 document->url().getString().utf8().data());
6594 } 6597 }
6595 #endif 6598 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698