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