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

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: just look below 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 m_compositorPendingAnimations(new CompositorPendingAnimations()), 483 m_compositorPendingAnimations(new CompositorPendingAnimations()),
484 m_templateDocumentHost(nullptr), 484 m_templateDocumentHost(nullptr),
485 m_didAssociateFormControlsTimer( 485 m_didAssociateFormControlsTimer(
486 TaskRunnerHelper::get(TaskType::Internal, this), 486 TaskRunnerHelper::get(TaskType::Internal, this),
487 this, 487 this,
488 &Document::didAssociateFormControlsTimerFired), 488 &Document::didAssociateFormControlsTimerFired),
489 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()), 489 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()),
490 m_hasViewportUnits(false), 490 m_hasViewportUnits(false),
491 m_parserSyncPolicy(AllowAsynchronousParsing), 491 m_parserSyncPolicy(AllowAsynchronousParsing),
492 m_nodeCount(0), 492 m_nodeCount(0),
493 m_wouldLoadReason(Created), 493 m_wouldLoadReason(Invalid),
494 m_passwordCount(0) { 494 m_passwordCount(0) {
495 if (m_frame) { 495 if (m_frame) {
496 DCHECK(m_frame->page()); 496 DCHECK(m_frame->page());
497 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 497 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
498 498
499 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 499 m_fetcher = m_frame->loader().documentLoader()->fetcher();
500 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 500 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
501 501
502 CustomElementRegistry* registry = 502 CustomElementRegistry* registry =
503 m_frame->localDOMWindow() 503 m_frame->localDOMWindow()
(...skipping 6025 matching lines...) Expand 10 before | Expand all | Expand 10 after
6529 visitor->trace(m_propertyRegistry); 6529 visitor->trace(m_propertyRegistry);
6530 visitor->trace(m_styleReattachDataMap); 6530 visitor->trace(m_styleReattachDataMap);
6531 Supplementable<Document>::trace(visitor); 6531 Supplementable<Document>::trace(visitor);
6532 TreeScope::trace(visitor); 6532 TreeScope::trace(visitor);
6533 ContainerNode::trace(visitor); 6533 ContainerNode::trace(visitor);
6534 ExecutionContext::trace(visitor); 6534 ExecutionContext::trace(visitor);
6535 SecurityContext::trace(visitor); 6535 SecurityContext::trace(visitor);
6536 SynchronousMutationNotifier::trace(visitor); 6536 SynchronousMutationNotifier::trace(visitor);
6537 } 6537 }
6538 6538
6539 void Document::maybeRecordLoadReason(WouldLoadReason reason) { 6539 void Document::recordDeferredLoadReason(WouldLoadReason reason) {
6540 DCHECK(m_wouldLoadReason == Created || reason != Created); 6540 DCHECK(m_wouldLoadReason == Invalid || reason != Created);
6541 DCHECK(reason != Invalid);
6541 DCHECK(frame()); 6542 DCHECK(frame());
6542 if (m_wouldLoadReason == Created && frame()->isCrossOriginSubframe() && 6543 DCHECK(frame()->isCrossOriginSubframe());
6543 frame()->loader().stateMachine()->committedFirstRealDocumentLoad()) { 6544 if (reason <= m_wouldLoadReason ||
6544 recordLoadReasonToHistogram(reason); 6545 !frame()->loader().stateMachine()->committedFirstRealDocumentLoad())
6545 } 6546 return;
6547 for (int i = m_wouldLoadReason + 1; i <= reason; ++i)
6548 recordLoadReasonToHistogram(static_cast<WouldLoadReason>(i));
6546 m_wouldLoadReason = reason; 6549 m_wouldLoadReason = reason;
6547 } 6550 }
6548 6551
6549 DEFINE_TRACE_WRAPPERS(Document) { 6552 DEFINE_TRACE_WRAPPERS(Document) {
6550 visitor->traceWrappers(m_importsController); 6553 visitor->traceWrappers(m_importsController);
6551 visitor->traceWrappers(m_implementation); 6554 visitor->traceWrappers(m_implementation);
6552 visitor->traceWrappers(m_styleSheetList); 6555 visitor->traceWrappers(m_styleSheetList);
6553 visitor->traceWrappers(m_styleEngine); 6556 visitor->traceWrappers(m_styleEngine);
6554 for (int i = 0; i < numNodeListInvalidationTypes; ++i) { 6557 for (int i = 0; i < numNodeListInvalidationTypes; ++i) {
6555 for (auto list : m_nodeLists[i]) { 6558 for (auto list : m_nodeLists[i]) {
(...skipping 20 matching lines...) Expand all
6576 } 6579 }
6577 6580
6578 void showLiveDocumentInstances() { 6581 void showLiveDocumentInstances() {
6579 WeakDocumentSet& set = liveDocumentSet(); 6582 WeakDocumentSet& set = liveDocumentSet();
6580 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6583 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6581 for (Document* document : set) 6584 for (Document* document : set)
6582 fprintf(stderr, "- Document %p URL: %s\n", document, 6585 fprintf(stderr, "- Document %p URL: %s\n", document,
6583 document->url().getString().utf8().data()); 6586 document->url().getString().utf8().data());
6584 } 6587 }
6585 #endif 6588 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698