OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 didAccessInitialDocumentTimerFired(0); | 1029 didAccessInitialDocumentTimerFired(0); |
1030 } | 1030 } |
1031 } | 1031 } |
1032 | 1032 |
1033 bool FrameLoader::prepareForCommit() | 1033 bool FrameLoader::prepareForCommit() |
1034 { | 1034 { |
1035 PluginScriptForbiddenScope forbidPluginDestructorScripting; | 1035 PluginScriptForbiddenScope forbidPluginDestructorScripting; |
1036 RefPtrWillBeRawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; | 1036 RefPtrWillBeRawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; |
1037 | 1037 |
1038 if (m_frame->document()) { | 1038 if (m_frame->document()) { |
| 1039 unsigned nodeCount = 0; |
| 1040 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext()
) { |
| 1041 if (frame->isLocalFrame()) { |
| 1042 LocalFrame* localFrame = toLocalFrame(frame); |
| 1043 nodeCount += localFrame->document()->nodeCount(); |
| 1044 } |
| 1045 } |
1039 unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounter
s::NodeCounter); | 1046 unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounter
s::NodeCounter); |
1040 int nodeCount = static_cast<int>(totalNodeCount); | |
1041 for (Document* document : Document::liveDocumentSet()) { | |
1042 if (document != m_frame->document()) | |
1043 nodeCount -= document->nodeCount(); | |
1044 } | |
1045 ASSERT(nodeCount >= 0); | |
1046 float ratio = static_cast<float>(nodeCount) / totalNodeCount; | 1047 float ratio = static_cast<float>(nodeCount) / totalNodeCount; |
1047 ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio); | 1048 ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio); |
1048 } | 1049 } |
1049 | 1050 |
1050 // Don't allow any new child frames to load in this frame: attaching a new | 1051 // Don't allow any new child frames to load in this frame: attaching a new |
1051 // child frame during or after detaching children results in an attached | 1052 // child frame during or after detaching children results in an attached |
1052 // frame on a detached DOM tree, which is bad. | 1053 // frame on a detached DOM tree, which is bad. |
1053 SubframeLoadingDisabler disabler(m_frame->document()); | 1054 SubframeLoadingDisabler disabler(m_frame->document()); |
1054 if (m_documentLoader) { | 1055 if (m_documentLoader) { |
1055 client()->dispatchWillClose(); | 1056 client()->dispatchWillClose(); |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 // FIXME: We need a way to propagate insecure requests policy flags to | 1562 // FIXME: We need a way to propagate insecure requests policy flags to |
1562 // out-of-process frames. For now, we'll always use default behavior. | 1563 // out-of-process frames. For now, we'll always use default behavior. |
1563 if (!parentFrame->isLocalFrame()) | 1564 if (!parentFrame->isLocalFrame()) |
1564 return nullptr; | 1565 return nullptr; |
1565 | 1566 |
1566 ASSERT(toLocalFrame(parentFrame)->document()); | 1567 ASSERT(toLocalFrame(parentFrame)->document()); |
1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1568 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1568 } | 1569 } |
1569 | 1570 |
1570 } // namespace blink | 1571 } // namespace blink |
OLD | NEW |