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, 2010, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Aliases by callers. | 229 // Aliases by callers. |
230 // Clone a node: https://dom.spec.whatwg.org/#concept-node-clone | 230 // Clone a node: https://dom.spec.whatwg.org/#concept-node-clone |
231 CreatedByCloneNode = AsynchronousCustomElements, | 231 CreatedByCloneNode = AsynchronousCustomElements, |
232 CreatedByImportNode = CreatedByCloneNode, | 232 CreatedByImportNode = CreatedByCloneNode, |
233 // https://dom.spec.whatwg.org/#dom-document-createelement | 233 // https://dom.spec.whatwg.org/#dom-document-createelement |
234 CreatedByCreateElement = SynchronousCustomElements, | 234 CreatedByCreateElement = SynchronousCustomElements, |
235 // https://html.spec.whatwg.org/#create-an-element-for-the-token | 235 // https://html.spec.whatwg.org/#create-an-element-for-the-token |
236 CreatedByFragmentParser = CreatedByParser | AsynchronousCustomElements, | 236 CreatedByFragmentParser = CreatedByParser | AsynchronousCustomElements, |
237 }; | 237 }; |
238 | 238 |
| 239 // Collect data about deferred loading of offscreen cross-origin documents. All |
| 240 // cross-origin documents log Created. Only those that would load log a reason. |
| 241 // We can then see the % of cross-origin documents that never have to load. |
| 242 // See https://crbug.com/635105. |
| 243 // Logged to UMA, don't re-arrange entries without creating a new histogram. |
| 244 enum WouldLoadReason { |
| 245 Created, |
| 246 // If outer and inner frames aren't in the same process we can't determine |
| 247 // if the inner frame is visible, so just load it. |
| 248 // TODO(dgrogan): Revisit after https://crbug.com/650433 is fixed. |
| 249 WouldLoadOutOfProcess, |
| 250 // The next four indicate frames that are probably used for cross-origin |
| 251 // communication. |
| 252 WouldLoadDisplayNone, |
| 253 WouldLoadZeroByZero, |
| 254 WouldLoadAbove, |
| 255 WouldLoadLeft, |
| 256 // We have to load documents in visible frames. |
| 257 WouldLoadVisible, |
| 258 |
| 259 WouldLoadReasonEnd |
| 260 }; |
| 261 |
239 using DocumentClassFlags = unsigned char; | 262 using DocumentClassFlags = unsigned char; |
240 | 263 |
241 class CORE_EXPORT Document : public ContainerNode, | 264 class CORE_EXPORT Document : public ContainerNode, |
242 public TreeScope, | 265 public TreeScope, |
243 public SecurityContext, | 266 public SecurityContext, |
244 public ExecutionContext, | 267 public ExecutionContext, |
245 public Supplementable<Document> { | 268 public Supplementable<Document> { |
246 DEFINE_WRAPPERTYPEINFO(); | 269 DEFINE_WRAPPERTYPEINFO(); |
247 USING_GARBAGE_COLLECTED_MIXIN(Document); | 270 USING_GARBAGE_COLLECTED_MIXIN(Document); |
248 | 271 |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 } | 1302 } |
1280 | 1303 |
1281 Element* rootScroller() const; | 1304 Element* rootScroller() const; |
1282 void setRootScroller(Element*, ExceptionState&); | 1305 void setRootScroller(Element*, ExceptionState&); |
1283 RootScrollerController* rootScrollerController() const { | 1306 RootScrollerController* rootScrollerController() const { |
1284 return m_rootScrollerController.get(); | 1307 return m_rootScrollerController.get(); |
1285 } | 1308 } |
1286 | 1309 |
1287 bool isInMainFrame() const; | 1310 bool isInMainFrame() const; |
1288 | 1311 |
1289 void onVisibilityMaybeChanged(bool visible); | 1312 void maybeRecordLoadReason(WouldLoadReason); |
| 1313 WouldLoadReason wouldLoadReason() { return m_wouldLoadReason; } |
1290 | 1314 |
1291 PropertyRegistry* propertyRegistry(); | 1315 PropertyRegistry* propertyRegistry(); |
1292 | 1316 |
1293 protected: | 1317 protected: |
1294 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); | 1318 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); |
1295 | 1319 |
1296 void didUpdateSecurityOrigin() final; | 1320 void didUpdateSecurityOrigin() final; |
1297 | 1321 |
1298 void clearXMLVersion() { m_xmlVersion = String(); } | 1322 void clearXMLVersion() { m_xmlVersion = String(); } |
1299 | 1323 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 Member<IntersectionObserverController> m_intersectionObserverController; | 1658 Member<IntersectionObserverController> m_intersectionObserverController; |
1635 Member<NodeIntersectionObserverData> m_intersectionObserverData; | 1659 Member<NodeIntersectionObserverData> m_intersectionObserverData; |
1636 Member<ResizeObserverController> m_resizeObserverController; | 1660 Member<ResizeObserverController> m_resizeObserverController; |
1637 | 1661 |
1638 int m_nodeCount; | 1662 int m_nodeCount; |
1639 | 1663 |
1640 bool m_mayContainV0Shadow = false; | 1664 bool m_mayContainV0Shadow = false; |
1641 | 1665 |
1642 Member<SnapCoordinator> m_snapCoordinator; | 1666 Member<SnapCoordinator> m_snapCoordinator; |
1643 | 1667 |
1644 bool m_visibilityWasLogged; | 1668 WouldLoadReason m_wouldLoadReason; |
1645 | 1669 |
1646 Member<PropertyRegistry> m_propertyRegistry; | 1670 Member<PropertyRegistry> m_propertyRegistry; |
1647 }; | 1671 }; |
1648 | 1672 |
1649 extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<Document>; | 1673 extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<Document>; |
1650 | 1674 |
1651 inline bool Document::shouldOverrideLegacyDescription( | 1675 inline bool Document::shouldOverrideLegacyDescription( |
1652 ViewportDescription::Type origin) const { | 1676 ViewportDescription::Type origin) const { |
1653 // The different (legacy) meta tags have different priorities based on the | 1677 // The different (legacy) meta tags have different priorities based on the |
1654 // type regardless of which order they appear in the DOM. The priority is | 1678 // type regardless of which order they appear in the DOM. The priority is |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true); | 1715 DEFINE_TYPE_CASTS(TreeScope, Document, document, true, true); |
1692 | 1716 |
1693 } // namespace blink | 1717 } // namespace blink |
1694 | 1718 |
1695 #ifndef NDEBUG | 1719 #ifndef NDEBUG |
1696 // Outside the WebCore namespace for ease of invocation from gdb. | 1720 // Outside the WebCore namespace for ease of invocation from gdb. |
1697 CORE_EXPORT void showLiveDocumentInstances(); | 1721 CORE_EXPORT void showLiveDocumentInstances(); |
1698 #endif | 1722 #endif |
1699 | 1723 |
1700 #endif // Document_h | 1724 #endif // Document_h |
OLD | NEW |