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

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: fix histograms.xml Created 3 years, 9 months 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 Document* document = toDocument(context); 394 Document* document = toDocument(context);
395 if (Element* element = document->autofocusElement()) { 395 if (Element* element = document->autofocusElement()) {
396 document->setAutofocusElement(0); 396 document->setAutofocusElement(0);
397 element->focus(); 397 element->focus();
398 } 398 }
399 } 399 }
400 400
401 static void recordLoadReasonToHistogram(WouldLoadReason reason) { 401 static void recordLoadReasonToHistogram(WouldLoadReason reason) {
402 DEFINE_STATIC_LOCAL( 402 DEFINE_STATIC_LOCAL(
403 EnumerationHistogram, unseenFrameHistogram, 403 EnumerationHistogram, unseenFrameHistogram,
404 ("Navigation.DeferredDocumentLoading.StatesV3", WouldLoadReasonEnd)); 404 ("Navigation.DeferredDocumentLoading.StatesV4", WouldLoadReasonEnd));
405 unseenFrameHistogram.count(reason); 405 unseenFrameHistogram.count(reason);
406 } 406 }
407 407
408 class Document::NetworkStateObserver final 408 class Document::NetworkStateObserver final
409 : public GarbageCollectedFinalized<Document::NetworkStateObserver>, 409 : public GarbageCollectedFinalized<Document::NetworkStateObserver>,
410 public NetworkStateNotifier::NetworkStateObserver, 410 public NetworkStateNotifier::NetworkStateObserver,
411 public ContextLifecycleObserver { 411 public ContextLifecycleObserver {
412 USING_GARBAGE_COLLECTED_MIXIN(Document::NetworkStateObserver); 412 USING_GARBAGE_COLLECTED_MIXIN(Document::NetworkStateObserver);
413 413
414 public: 414 public:
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 m_compositorPendingAnimations(new CompositorPendingAnimations(*this)), 525 m_compositorPendingAnimations(new CompositorPendingAnimations(*this)),
526 m_templateDocumentHost(nullptr), 526 m_templateDocumentHost(nullptr),
527 m_didAssociateFormControlsTimer( 527 m_didAssociateFormControlsTimer(
528 TaskRunnerHelper::get(TaskType::UnspecedLoading, this), 528 TaskRunnerHelper::get(TaskType::UnspecedLoading, this),
529 this, 529 this,
530 &Document::didAssociateFormControlsTimerFired), 530 &Document::didAssociateFormControlsTimerFired),
531 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)), 531 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)),
532 m_hasViewportUnits(false), 532 m_hasViewportUnits(false),
533 m_parserSyncPolicy(AllowAsynchronousParsing), 533 m_parserSyncPolicy(AllowAsynchronousParsing),
534 m_nodeCount(0), 534 m_nodeCount(0),
535 m_wouldLoadReason(Created), 535 m_wouldLoadReason(Invalid),
536 m_passwordCount(0), 536 m_passwordCount(0),
537 m_engagementLevel(mojom::blink::EngagementLevel::NONE) { 537 m_engagementLevel(mojom::blink::EngagementLevel::NONE) {
538 if (m_frame) { 538 if (m_frame) {
539 DCHECK(m_frame->page()); 539 DCHECK(m_frame->page());
540 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 540 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
541 541
542 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 542 m_fetcher = m_frame->loader().documentLoader()->fetcher();
543 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 543 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
544 544
545 // TODO(dcheng): Why does this need to check that DOMWindow is non-null? 545 // TODO(dcheng): Why does this need to check that DOMWindow is non-null?
(...skipping 6059 matching lines...) Expand 10 before | Expand all | Expand 10 after
6605 visitor->trace(m_styleReattachDataMap); 6605 visitor->trace(m_styleReattachDataMap);
6606 visitor->trace(m_networkStateObserver); 6606 visitor->trace(m_networkStateObserver);
6607 Supplementable<Document>::trace(visitor); 6607 Supplementable<Document>::trace(visitor);
6608 TreeScope::trace(visitor); 6608 TreeScope::trace(visitor);
6609 ContainerNode::trace(visitor); 6609 ContainerNode::trace(visitor);
6610 ExecutionContext::trace(visitor); 6610 ExecutionContext::trace(visitor);
6611 SecurityContext::trace(visitor); 6611 SecurityContext::trace(visitor);
6612 SynchronousMutationNotifier::trace(visitor); 6612 SynchronousMutationNotifier::trace(visitor);
6613 } 6613 }
6614 6614
6615 void Document::maybeRecordLoadReason(WouldLoadReason reason) { 6615 void Document::recordDeferredLoadReason(WouldLoadReason reason) {
6616 DCHECK(m_wouldLoadReason == Created || reason != Created); 6616 DCHECK(m_wouldLoadReason == Invalid || reason != Created);
6617 DCHECK(reason != Invalid);
6617 DCHECK(frame()); 6618 DCHECK(frame());
6618 if (m_wouldLoadReason == Created && frame()->isCrossOriginSubframe() && 6619 DCHECK(frame()->isCrossOriginSubframe());
6619 frame()->loader().stateMachine()->committedFirstRealDocumentLoad()) { 6620 if (reason <= m_wouldLoadReason ||
6620 recordLoadReasonToHistogram(reason); 6621 !frame()->loader().stateMachine()->committedFirstRealDocumentLoad())
6621 } 6622 return;
6623 for (int i = m_wouldLoadReason + 1; i <= reason; ++i)
6624 recordLoadReasonToHistogram(static_cast<WouldLoadReason>(i));
6622 m_wouldLoadReason = reason; 6625 m_wouldLoadReason = reason;
6623 } 6626 }
6624 6627
6625 DEFINE_TRACE_WRAPPERS(Document) { 6628 DEFINE_TRACE_WRAPPERS(Document) {
6626 visitor->traceWrappers(m_importsController); 6629 visitor->traceWrappers(m_importsController);
6627 visitor->traceWrappers(m_implementation); 6630 visitor->traceWrappers(m_implementation);
6628 visitor->traceWrappers(m_styleSheetList); 6631 visitor->traceWrappers(m_styleSheetList);
6629 visitor->traceWrappers(m_styleEngine); 6632 visitor->traceWrappers(m_styleEngine);
6630 for (int i = 0; i < numNodeListInvalidationTypes; ++i) { 6633 for (int i = 0; i < numNodeListInvalidationTypes; ++i) {
6631 for (auto list : m_nodeLists[i]) { 6634 for (auto list : m_nodeLists[i]) {
(...skipping 25 matching lines...) Expand all
6657 } 6660 }
6658 6661
6659 void showLiveDocumentInstances() { 6662 void showLiveDocumentInstances() {
6660 WeakDocumentSet& set = liveDocumentSet(); 6663 WeakDocumentSet& set = liveDocumentSet();
6661 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6664 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6662 for (blink::Document* document : set) 6665 for (blink::Document* document : set)
6663 fprintf(stderr, "- Document %p URL: %s\n", document, 6666 fprintf(stderr, "- Document %p URL: %s\n", document,
6664 document->url().getString().utf8().data()); 6667 document->url().getString().utf8().data());
6665 } 6668 }
6666 #endif 6669 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698