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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp

Issue 2814643003: Remove FrameViewBase as base class of PluginView. (Closed)
Patch Set: Address final comments Created 3 years, 8 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) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 16 matching lines...) Expand all
27 #include "core/events/Event.h" 27 #include "core/events/Event.h"
28 #include "core/frame/FrameView.h" 28 #include "core/frame/FrameView.h"
29 #include "core/frame/LocalFrame.h" 29 #include "core/frame/LocalFrame.h"
30 #include "core/frame/LocalFrameClient.h" 30 #include "core/frame/LocalFrameClient.h"
31 #include "core/layout/LayoutPart.h" 31 #include "core/layout/LayoutPart.h"
32 #include "core/layout/api/LayoutPartItem.h" 32 #include "core/layout/api/LayoutPartItem.h"
33 #include "core/loader/FrameLoadRequest.h" 33 #include "core/loader/FrameLoadRequest.h"
34 #include "core/loader/FrameLoader.h" 34 #include "core/loader/FrameLoader.h"
35 #include "core/page/Page.h" 35 #include "core/page/Page.h"
36 #include "core/plugins/PluginView.h" 36 #include "core/plugins/PluginView.h"
37 #include "platform/heap/HeapAllocator.h"
37 #include "platform/weborigin/SecurityOrigin.h" 38 #include "platform/weborigin/SecurityOrigin.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 typedef HeapHashMap<Member<FrameViewBase>, Member<FrameView>> 42 typedef HeapHashMap<Member<FrameViewBase>, Member<FrameView>>
42 FrameViewBaseToParentMap; 43 FrameViewBaseToParentMap;
43 static FrameViewBaseToParentMap& WidgetNewParentMap() { 44 static FrameViewBaseToParentMap& WidgetNewParentMap() {
44 DEFINE_STATIC_LOCAL(FrameViewBaseToParentMap, map, 45 DEFINE_STATIC_LOCAL(FrameViewBaseToParentMap, map,
45 (new FrameViewBaseToParentMap)); 46 (new FrameViewBaseToParentMap));
46 return map; 47 return map;
47 } 48 }
48 49
49 using FrameViewBaseSet = HeapHashSet<Member<FrameViewBase>>; 50 using FrameViewBaseSet = HeapHashSet<Member<FrameViewBase>>;
50 static FrameViewBaseSet& WidgetsPendingTemporaryRemovalFromParent() { 51 static FrameViewBaseSet& WidgetsPendingTemporaryRemovalFromParent() {
51 // FrameViewBases in this set will not leak because it will be cleared in 52 // FrameViewBases in this set will not leak because it will be cleared in
52 // HTMLFrameOwnerElement::UpdateSuspendScope::performDeferredWidgetTreeOperati ons. 53 // HTMLFrameOwnerElement::UpdateSuspendScope::performDeferredWidgetTreeOperati ons.
53 DEFINE_STATIC_LOCAL(FrameViewBaseSet, set, (new FrameViewBaseSet)); 54 DEFINE_STATIC_LOCAL(FrameViewBaseSet, set, (new FrameViewBaseSet));
54 return set; 55 return set;
55 } 56 }
56 57
57 static FrameViewBaseSet& WidgetsPendingDispose() { 58 using FrameOrPluginList = HeapVector<Member<FrameOrPlugin>>;
58 DEFINE_STATIC_LOCAL(FrameViewBaseSet, set, (new FrameViewBaseSet)); 59 static FrameOrPluginList& FrameOrPluginsPendingDispose() {
59 return set; 60 DEFINE_STATIC_LOCAL(FrameOrPluginList, list, (new FrameOrPluginList));
61 return list;
60 } 62 }
61 63
62 SubframeLoadingDisabler::SubtreeRootSet& 64 SubframeLoadingDisabler::SubtreeRootSet&
63 SubframeLoadingDisabler::DisabledSubtreeRoots() { 65 SubframeLoadingDisabler::DisabledSubtreeRoots() {
64 DEFINE_STATIC_LOCAL(SubtreeRootSet, nodes, ()); 66 DEFINE_STATIC_LOCAL(SubtreeRootSet, nodes, ());
65 return nodes; 67 return nodes;
66 } 68 }
67 69
68 static unsigned g_update_suspend_count = 0; 70 static unsigned g_update_suspend_count = 0;
69 71
(...skipping 23 matching lines...) Expand all
93 FrameViewBaseSet set; 95 FrameViewBaseSet set;
94 WidgetsPendingTemporaryRemovalFromParent().Swap(set); 96 WidgetsPendingTemporaryRemovalFromParent().Swap(set);
95 for (const auto& frame_view_base : set) { 97 for (const auto& frame_view_base : set) {
96 FrameView* current_parent = ToFrameView(frame_view_base->Parent()); 98 FrameView* current_parent = ToFrameView(frame_view_base->Parent());
97 if (current_parent) 99 if (current_parent)
98 current_parent->RemoveChild(frame_view_base.Get()); 100 current_parent->RemoveChild(frame_view_base.Get());
99 } 101 }
100 } 102 }
101 103
102 { 104 {
103 FrameViewBaseSet set; 105 FrameOrPluginList list;
104 WidgetsPendingDispose().Swap(set); 106 FrameOrPluginsPendingDispose().Swap(list);
105 for (const auto& frame_view_base : set) { 107 for (const auto& frame_or_plugin : list) {
106 frame_view_base->Dispose(); 108 frame_or_plugin->Dispose();
107 } 109 }
108 } 110 }
109 } 111 }
110 112
111 HTMLFrameOwnerElement::UpdateSuspendScope::~UpdateSuspendScope() { 113 HTMLFrameOwnerElement::UpdateSuspendScope::~UpdateSuspendScope() {
112 DCHECK_GT(g_update_suspend_count, 0u); 114 DCHECK_GT(g_update_suspend_count, 0u);
113 if (g_update_suspend_count == 1) 115 if (g_update_suspend_count == 1)
114 PerformDeferredWidgetTreeOperations(); 116 PerformDeferredWidgetTreeOperations();
115 --g_update_suspend_count; 117 --g_update_suspend_count;
116 } 118 }
117 119
118 // Unlike moveWidgetToParentSoon, this will not call dispose the Widget. 120 // Unlike moveWidgetToParentSoon, this will not call dispose.
119 void TemporarilyRemoveWidgetFromParentSoon(FrameViewBase* frame_view_base) { 121 void TemporarilyRemoveWidgetFromParentSoon(FrameViewBase* frame_view_base) {
120 if (g_update_suspend_count) { 122 if (g_update_suspend_count) {
121 WidgetsPendingTemporaryRemovalFromParent().insert(frame_view_base); 123 WidgetsPendingTemporaryRemovalFromParent().insert(frame_view_base);
122 } else { 124 } else {
123 if (ToFrameView(frame_view_base->Parent())) 125 if (ToFrameView(frame_view_base->Parent()))
124 ToFrameView(frame_view_base->Parent())->RemoveChild(frame_view_base); 126 ToFrameView(frame_view_base->Parent())->RemoveChild(frame_view_base);
125 } 127 }
126 } 128 }
127 129
128 void MoveWidgetToParentSoon(FrameViewBase* child, FrameView* parent) { 130 void MoveWidgetToParentSoon(FrameViewBase* child, FrameView* parent) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // the subframe hasn't been created yet. 210 // the subframe hasn't been created yet.
209 if (ContentFrame()) 211 if (ContentFrame())
210 GetDocument().GetFrame()->Loader().Client()->DidChangeSandboxFlags( 212 GetDocument().GetFrame()->Loader().Client()->DidChangeSandboxFlags(
211 ContentFrame(), flags); 213 ContentFrame(), flags);
212 } 214 }
213 215
214 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const { 216 bool HTMLFrameOwnerElement::IsKeyboardFocusable() const {
215 return content_frame_ && HTMLElement::IsKeyboardFocusable(); 217 return content_frame_ && HTMLElement::IsKeyboardFocusable();
216 } 218 }
217 219
218 void HTMLFrameOwnerElement::DisposeWidgetSoon(FrameViewBase* frame_view_base) { 220 void HTMLFrameOwnerElement::DisposeFrameOrPluginSoon(
221 FrameOrPlugin* frame_or_plugin) {
219 if (g_update_suspend_count) { 222 if (g_update_suspend_count) {
220 WidgetsPendingDispose().insert(frame_view_base); 223 FrameOrPluginsPendingDispose().push_back(frame_or_plugin);
221 return; 224 return;
222 } 225 }
223 frame_view_base->Dispose(); 226 frame_or_plugin->Dispose();
224 } 227 }
225 228
226 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() { 229 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() {
227 // Don't notify about updates if contentFrame() is null, for example when 230 // Don't notify about updates if contentFrame() is null, for example when
228 // the subframe hasn't been created yet. 231 // the subframe hasn't been created yet.
229 if (ContentFrame()) 232 if (ContentFrame())
230 GetDocument().GetFrame()->Loader().Client()->DidChangeFrameOwnerProperties( 233 GetDocument().GetFrame()->Loader().Client()->DidChangeFrameOwnerProperties(
231 this); 234 this);
232 } 235 }
233 236
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 345 }
343 346
344 DEFINE_TRACE(HTMLFrameOwnerElement) { 347 DEFINE_TRACE(HTMLFrameOwnerElement) {
345 visitor->Trace(content_frame_); 348 visitor->Trace(content_frame_);
346 visitor->Trace(widget_); 349 visitor->Trace(widget_);
347 HTMLElement::Trace(visitor); 350 HTMLElement::Trace(visitor);
348 FrameOwner::Trace(visitor); 351 FrameOwner::Trace(visitor);
349 } 352 }
350 353
351 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h ('k') | third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698