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

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

Issue 2814643003: Remove FrameViewBase as base class of PluginView. (Closed)
Patch Set: Changed upstream to origin/master. 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 17 matching lines...) Expand all
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/weborigin/SecurityOrigin.h" 37 #include "platform/weborigin/SecurityOrigin.h"
38 #include "wtf/Vector.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 DisposeList = Vector<FrameOrPlugin*>;
joelhockey 2017/04/12 04:33:00 I didn't know if this needs to interact with oilpa
58 DEFINE_STATIC_LOCAL(FrameViewBaseSet, set, (new FrameViewBaseSet)); 59 static DisposeList& PendingDispose() {
59 return set; 60 DEFINE_STATIC_LOCAL(DisposeList, list, ());
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 DisposeList list;
104 WidgetsPendingDispose().Swap(set); 106 PendingDispose().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 }
(...skipping 91 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::DisposeSoon(FrameOrPlugin* frame_or_plugin) {
219 if (g_update_suspend_count) { 221 if (g_update_suspend_count) {
220 WidgetsPendingDispose().insert(frame_view_base); 222 PendingDispose().push_back(frame_or_plugin);
221 return; 223 return;
222 } 224 }
223 frame_view_base->Dispose(); 225 frame_or_plugin->Dispose();
224 } 226 }
225 227
226 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() { 228 void HTMLFrameOwnerElement::FrameOwnerPropertiesChanged() {
227 // Don't notify about updates if contentFrame() is null, for example when 229 // Don't notify about updates if contentFrame() is null, for example when
228 // the subframe hasn't been created yet. 230 // the subframe hasn't been created yet.
229 if (ContentFrame()) 231 if (ContentFrame())
230 GetDocument().GetFrame()->Loader().Client()->DidChangeFrameOwnerProperties( 232 GetDocument().GetFrame()->Loader().Client()->DidChangeFrameOwnerProperties(
231 this); 233 this);
232 } 234 }
233 235
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 344 }
343 345
344 DEFINE_TRACE(HTMLFrameOwnerElement) { 346 DEFINE_TRACE(HTMLFrameOwnerElement) {
345 visitor->Trace(content_frame_); 347 visitor->Trace(content_frame_);
346 visitor->Trace(widget_); 348 visitor->Trace(widget_);
347 HTMLElement::Trace(visitor); 349 HTMLElement::Trace(visitor);
348 FrameOwner::Trace(visitor); 350 FrameOwner::Trace(visitor);
349 } 351 }
350 352
351 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698