OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 #include "core/page/ChromeClient.h" | 62 #include "core/page/ChromeClient.h" |
63 #include "core/page/FocusController.h" | 63 #include "core/page/FocusController.h" |
64 #include "core/page/Page.h" | 64 #include "core/page/Page.h" |
65 #include "core/page/scrolling/ScrollingCoordinator.h" | 65 #include "core/page/scrolling/ScrollingCoordinator.h" |
66 #include "core/paint/ObjectPainter.h" | 66 #include "core/paint/ObjectPainter.h" |
67 #include "core/paint/PaintInfo.h" | 67 #include "core/paint/PaintInfo.h" |
68 #include "core/paint/PaintLayer.h" | 68 #include "core/paint/PaintLayer.h" |
69 #include "core/paint/TransformRecorder.h" | 69 #include "core/paint/TransformRecorder.h" |
70 #include "core/svg/SVGDocumentExtensions.h" | 70 #include "core/svg/SVGDocumentExtensions.h" |
71 #include "platform/DragImage.h" | 71 #include "platform/DragImage.h" |
72 #include "platform/Histogram.h" | |
72 #include "platform/JSONValues.h" | 73 #include "platform/JSONValues.h" |
73 #include "platform/PluginScriptForbiddenScope.h" | 74 #include "platform/PluginScriptForbiddenScope.h" |
74 #include "platform/RuntimeEnabledFeatures.h" | 75 #include "platform/RuntimeEnabledFeatures.h" |
75 #include "platform/ScriptForbiddenScope.h" | 76 #include "platform/ScriptForbiddenScope.h" |
76 #include "platform/graphics/GraphicsContext.h" | 77 #include "platform/graphics/GraphicsContext.h" |
77 #include "platform/graphics/StaticBitmapImage.h" | 78 #include "platform/graphics/StaticBitmapImage.h" |
78 #include "platform/graphics/paint/ClipRecorder.h" | 79 #include "platform/graphics/paint/ClipRecorder.h" |
79 #include "platform/graphics/paint/PaintController.h" | 80 #include "platform/graphics/paint/PaintController.h" |
80 #include "platform/graphics/paint/SkPictureBuilder.h" | 81 #include "platform/graphics/paint/SkPictureBuilder.h" |
81 #include "platform/graphics/paint/TransformDisplayItem.h" | 82 #include "platform/graphics/paint/TransformDisplayItem.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 } | 232 } |
232 | 233 |
233 inline float parentTextZoomFactor(LocalFrame* frame) | 234 inline float parentTextZoomFactor(LocalFrame* frame) |
234 { | 235 { |
235 Frame* parent = frame->tree().parent(); | 236 Frame* parent = frame->tree().parent(); |
236 if (!parent || !parent->isLocalFrame()) | 237 if (!parent || !parent->isLocalFrame()) |
237 return 1; | 238 return 1; |
238 return toLocalFrame(parent)->textZoomFactor(); | 239 return toLocalFrame(parent)->textZoomFactor(); |
239 } | 240 } |
240 | 241 |
242 // These are logged to UMA, so don't re-arrange them without creating a new hist ogram. | |
243 enum FrameStateForDeferredLoading { | |
244 Created, | |
245 WouldLoadBecauseVisible, | |
246 // TODO(dgrogan): Add WouldLoadBecauseTopOrLeft, WouldLoadBecauseDisplayNone , etc | |
247 | |
248 FrameStateForDeferredLoadingEnd | |
249 }; | |
250 | |
251 void RecordStateToHistogram(FrameStateForDeferredLoading state) | |
252 { | |
253 DEFINE_STATIC_LOCAL(EnumerationHistogram, unseenFrameHistogram, ("FrameLoadi ng.Deferred.StateCountsV1", FrameStateForDeferredLoadingEnd)); | |
254 unseenFrameHistogram.count(state); | |
255 } | |
256 | |
241 } // namespace | 257 } // namespace |
242 | 258 |
243 template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>; | 259 template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>; |
244 | 260 |
245 LocalFrame* LocalFrame::create(FrameLoaderClient* client, FrameHost* host, Frame Owner* owner, ServiceRegistry* serviceRegistry) | 261 LocalFrame* LocalFrame::create(FrameLoaderClient* client, FrameHost* host, Frame Owner* owner, ServiceRegistry* serviceRegistry) |
246 { | 262 { |
247 LocalFrame* frame = new LocalFrame(client, host, owner, serviceRegistry ? se rviceRegistry : ServiceRegistry::getEmptyServiceRegistry()); | 263 LocalFrame* frame = new LocalFrame(client, host, owner, serviceRegistry ? se rviceRegistry : ServiceRegistry::getEmptyServiceRegistry()); |
248 InspectorInstrumentation::frameAttachedToParent(frame); | 264 InspectorInstrumentation::frameAttachedToParent(frame); |
249 return frame; | 265 return frame; |
250 } | 266 } |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 // will have been done. | 498 // will have been done. |
483 // | 499 // |
484 // - Calling LocalDOMWindow::reset() is not needed (called from | 500 // - Calling LocalDOMWindow::reset() is not needed (called from |
485 // Frame::setDOMWindow().) The Member references it clears will now | 501 // Frame::setDOMWindow().) The Member references it clears will now |
486 // die with the window. And the registered DOMWindowProperty instances th at don't, | 502 // die with the window. And the registered DOMWindowProperty instances th at don't, |
487 // only keep a weak reference to this frame, so there's no need to be | 503 // only keep a weak reference to this frame, so there's no need to be |
488 // explicitly notified that this frame is going away. | 504 // explicitly notified that this frame is going away. |
489 if (domWindow) | 505 if (domWindow) |
490 script().clearWindowProxy(); | 506 script().clearWindowProxy(); |
491 | 507 |
508 // Can't call isCrossOrigin until we get here, which seems to happen | |
509 // more than once. | |
ojan
2016/08/08 22:01:54
Nit:
I think this would get called every time a fr
dgrogan
2016/08/09 00:30:16
In my testing it happens exactly twice per frame l
| |
492 if (m_domWindow) | 510 if (m_domWindow) |
493 m_domWindow->reset(); | 511 m_domWindow->reset(); |
494 m_domWindow = domWindow; | 512 m_domWindow = domWindow; |
495 } | 513 } |
496 | 514 |
497 Document* LocalFrame::document() const | 515 Document* LocalFrame::document() const |
498 { | 516 { |
499 return m_domWindow ? m_domWindow->document() : nullptr; | 517 return m_domWindow ? m_domWindow->document() : nullptr; |
500 } | 518 } |
501 | 519 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 , m_spellChecker(SpellChecker::create(*this)) | 831 , m_spellChecker(SpellChecker::create(*this)) |
814 , m_selection(FrameSelection::create(this)) | 832 , m_selection(FrameSelection::create(this)) |
815 , m_eventHandler(new EventHandler(this)) | 833 , m_eventHandler(new EventHandler(this)) |
816 , m_console(FrameConsole::create(*this)) | 834 , m_console(FrameConsole::create(*this)) |
817 , m_inputMethodController(InputMethodController::create(*this)) | 835 , m_inputMethodController(InputMethodController::create(*this)) |
818 , m_navigationDisableCount(0) | 836 , m_navigationDisableCount(0) |
819 , m_pageZoomFactor(parentPageZoomFactor(this)) | 837 , m_pageZoomFactor(parentPageZoomFactor(this)) |
820 , m_textZoomFactor(parentTextZoomFactor(this)) | 838 , m_textZoomFactor(parentTextZoomFactor(this)) |
821 , m_inViewSourceMode(false) | 839 , m_inViewSourceMode(false) |
822 , m_serviceRegistry(serviceRegistry) | 840 , m_serviceRegistry(serviceRegistry) |
841 , m_visibilityWasLogged(false) | |
842 , m_creationWasLogged(false) | |
823 { | 843 { |
824 if (isLocalRoot()) | 844 if (isLocalRoot()) |
825 m_instrumentingAgents = new InstrumentingAgents(); | 845 m_instrumentingAgents = new InstrumentingAgents(); |
826 else | 846 else |
827 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; | 847 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; |
828 } | 848 } |
829 | 849 |
830 WebFrameScheduler* LocalFrame::frameScheduler() | 850 WebFrameScheduler* LocalFrame::frameScheduler() |
831 { | 851 { |
832 if (!m_frameScheduler.get()) | 852 if (!m_frameScheduler.get()) |
(...skipping 15 matching lines...) Expand all Loading... | |
848 return static_cast<FrameLoaderClient*>(Frame::client()); | 868 return static_cast<FrameLoaderClient*>(Frame::client()); |
849 } | 869 } |
850 | 870 |
851 PluginData* LocalFrame::pluginData() const | 871 PluginData* LocalFrame::pluginData() const |
852 { | 872 { |
853 if (!loader().allowPlugins(NotAboutToInstantiatePlugin)) | 873 if (!loader().allowPlugins(NotAboutToInstantiatePlugin)) |
854 return nullptr; | 874 return nullptr; |
855 return page()->pluginData(); | 875 return page()->pluginData(); |
856 } | 876 } |
857 | 877 |
878 void LocalFrame::onVisibilityMaybeChanged(bool visible) | |
879 { | |
880 // Which x-origin check do we want? Frame::isCrossOrigin checks this origin against | |
881 // the top. But FrameView::m_crossOriginForThrottling is set if this origin is unable | |
882 // to access ANY origin between here and the top, inclusive. | |
883 if (!isCrossOrigin()) | |
ojan
2016/08/08 22:01:54
I think this is probably the right one. I think th
| |
884 return; | |
885 | |
886 // Logging creation here is lame but I don't know where else to do it. | |
887 // Can't do it in the ctor because isCrossOrigin relies on document(), which isn't set yet. | |
ojan
2016/08/08 22:01:54
How about we log this in setDOMWindow? That actual
dgrogan
2016/08/09 00:30:16
We have the same isCrossOrigin problem there: the
dcheng
2016/08/09 01:24:04
If this needs to depend on isCrossOrigin(), it sho
| |
888 if (!m_creationWasLogged) { | |
889 m_creationWasLogged = true; | |
890 RecordStateToHistogram(Created); | |
891 } | |
892 | |
893 if (visible && !m_visibilityWasLogged) { | |
894 m_visibilityWasLogged = true; | |
895 RecordStateToHistogram(WouldLoadBecauseVisible); | |
896 } | |
897 } | |
898 | |
858 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); | 899 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); |
859 | 900 |
860 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame) | 901 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame) |
861 : m_frame(&frame) | 902 : m_frame(&frame) |
862 { | 903 { |
863 m_frame->disableNavigation(); | 904 m_frame->disableNavigation(); |
864 } | 905 } |
865 | 906 |
866 FrameNavigationDisabler::~FrameNavigationDisabler() | 907 FrameNavigationDisabler::~FrameNavigationDisabler() |
867 { | 908 { |
868 m_frame->enableNavigation(); | 909 m_frame->enableNavigation(); |
869 } | 910 } |
870 | 911 |
871 ScopedFrameBlamer::ScopedFrameBlamer(LocalFrame* frame) | 912 ScopedFrameBlamer::ScopedFrameBlamer(LocalFrame* frame) |
872 : m_frame(frame) | 913 : m_frame(frame) |
873 { | 914 { |
874 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) | 915 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) |
875 m_frame->client()->frameBlameContext()->Enter(); | 916 m_frame->client()->frameBlameContext()->Enter(); |
876 } | 917 } |
877 | 918 |
878 ScopedFrameBlamer::~ScopedFrameBlamer() | 919 ScopedFrameBlamer::~ScopedFrameBlamer() |
879 { | 920 { |
880 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) | 921 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) |
881 m_frame->client()->frameBlameContext()->Leave(); | 922 m_frame->client()->frameBlameContext()->Leave(); |
882 } | 923 } |
883 | 924 |
884 } // namespace blink | 925 } // namespace blink |
OLD | NEW |