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

Side by Side Diff: Source/web/WebPluginContainerImpl.h

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch LocalFrame::m_pluginElements rep to HashSet<HTMLPlugInElement*> Created 6 years, 2 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 namespace blink { 47 namespace blink {
48 48
49 class GestureEvent; 49 class GestureEvent;
50 class HTMLPlugInElement; 50 class HTMLPlugInElement;
51 class IntRect; 51 class IntRect;
52 class KeyboardEvent; 52 class KeyboardEvent;
53 class MouseEvent; 53 class MouseEvent;
54 class PlatformGestureEvent; 54 class PlatformGestureEvent;
55 class ResourceError; 55 class ResourceError;
56 class ResourceResponse; 56 class ResourceResponse;
57 class ScriptController;
57 class ScrollbarGroup; 58 class ScrollbarGroup;
58 class TouchEvent; 59 class TouchEvent;
59 class WebPlugin; 60 class WebPlugin;
60 class WebPluginLoadObserver; 61 class WebPluginLoadObserver;
61 class WebExternalTextureLayer; 62 class WebExternalTextureLayer;
62 class WheelEvent; 63 class WheelEvent;
63 class Widget; 64 class Widget;
64 struct WebPrintParams; 65 struct WebPrintParams;
65 66
66 class WebPluginContainerImpl final 67 class WebPluginContainerImpl final : public PluginView, public WebPluginContaine r, public FrameDestructionObserver {
67 : public PluginView 68 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl);
68 , public WebPluginContainer 69 public:
69 #if !ENABLE(OILPAN) 70 static PassRefPtrWillBeRawPtr<WebPluginContainerImpl> create(HTMLPlugInEleme nt* element, WebPlugin* webPlugin)
70 , public FrameDestructionObserver
71 #endif
72 { 71 {
73 public: 72 return adoptRefWillBeNoop(new WebPluginContainerImpl(element, webPlugin) );
74 static PassRefPtr<WebPluginContainerImpl> create(HTMLPlugInElement* element, WebPlugin* webPlugin)
75 {
76 return adoptRef(new WebPluginContainerImpl(element, webPlugin));
77 } 73 }
78 74
79 // PluginView methods 75 // PluginView methods
80 virtual WebLayer* platformLayer() const override; 76 virtual WebLayer* platformLayer() const override;
81 virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) override; 77 virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) override;
82 virtual bool getFormValue(String&) override; 78 virtual bool getFormValue(String&) override;
83 virtual bool supportsKeyboardFocus() const override; 79 virtual bool supportsKeyboardFocus() const override;
84 virtual bool supportsInputMethod() const override; 80 virtual bool supportsInputMethod() const override;
85 virtual bool canProcessDrag() const override; 81 virtual bool canProcessDrag() const override;
86 virtual bool wantsWheelEvents() override; 82 virtual bool wantsWheelEvents() override;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 158
163 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); 159 void willDestroyPluginLoadObserver(WebPluginLoadObserver*);
164 160
165 ScrollbarGroup* scrollbarGroup(); 161 ScrollbarGroup* scrollbarGroup();
166 162
167 void willStartLiveResize(); 163 void willStartLiveResize();
168 void willEndLiveResize(); 164 void willEndLiveResize();
169 165
170 bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect &, const IntRect&); 166 bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect &, const IntRect&);
171 167
168 virtual void trace(Visitor*) override;
169 virtual void dispose() override;
170
172 #if ENABLE(OILPAN) 171 #if ENABLE(OILPAN)
173 virtual void detach() override; 172 virtual LocalFrame* pluginFrame() const override { return frame(); }
173 virtual void shouldDisposePlugin() override;
174 #endif 174 #endif
175 175
176 private: 176 private:
177 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); 177 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*);
178 virtual ~WebPluginContainerImpl(); 178 virtual ~WebPluginContainerImpl();
179 179
180 void handleMouseEvent(MouseEvent*); 180 void handleMouseEvent(MouseEvent*);
181 void handleDragEvent(MouseEvent*); 181 void handleDragEvent(MouseEvent*);
182 void handleWheelEvent(WheelEvent*); 182 void handleWheelEvent(WheelEvent*);
183 void handleKeyboardEvent(KeyboardEvent*); 183 void handleKeyboardEvent(KeyboardEvent*);
184 void handleTouchEvent(TouchEvent*); 184 void handleTouchEvent(TouchEvent*);
185 void handleGestureEvent(GestureEvent*); 185 void handleGestureEvent(GestureEvent*);
186 186
187 void synthesizeMouseEventIfPossible(TouchEvent*); 187 void synthesizeMouseEventIfPossible(TouchEvent*);
188 188
189 void focusPlugin(); 189 void focusPlugin();
190 190
191 void calculateGeometry( 191 void calculateGeometry(
192 const IntRect& frameRect, 192 const IntRect& frameRect,
193 IntRect& windowRect, 193 IntRect& windowRect,
194 IntRect& clipRect, 194 IntRect& clipRect,
195 Vector<IntRect>& cutOutRects); 195 Vector<IntRect>& cutOutRects);
196 IntRect windowClipRect() const; 196 IntRect windowClipRect() const;
197 void windowCutOutRects( 197 void windowCutOutRects(
198 const IntRect& frameRect, 198 const IntRect& frameRect,
199 Vector<IntRect>& cutOutRects); 199 Vector<IntRect>& cutOutRects);
200 200
201 #if ENABLE(OILPAN) 201 RawPtrWillBeMember<HTMLPlugInElement> m_element;
202 // FIXME: Oilpan: consider moving Widget to the heap, allowing this
203 // container object to be a FrameDestructionObserver. And thereby
204 // keep a traced member reference to the frame rather than as a
205 // bare pointer. Instead, the owning object (HTMLFrameOwnerElement)
206 // explicitly deletes this object when it is disconnected from its
207 // frame. Any access to an invalid frame via this bare pointer
208 // is therefore not possible.
209 //
210 // See the HTMLFrameOwnerElement::disconnectContentFrame comment for
211 // (even) more.
212 LocalFrame* m_frame;
213
214 LocalFrame* frame() const { return m_frame; }
215 #endif
216
217 // FIXME: see above; for the time being, a bare pointer to the owning
218 // HTMLPlugInElement and managed as such.
219 HTMLPlugInElement* m_element;
220 WebPlugin* m_webPlugin; 202 WebPlugin* m_webPlugin;
221 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; 203 Vector<WebPluginLoadObserver*> m_pluginLoadObservers;
222 204
223 WebLayer* m_webLayer; 205 WebLayer* m_webLayer;
224 206
225 // The associated scrollbar group object, created lazily. Used for Pepper 207 // The associated scrollbar group object, created lazily. Used for Pepper
226 // scrollbars. 208 // scrollbars.
227 OwnPtr<ScrollbarGroup> m_scrollbarGroup; 209 OwnPtr<ScrollbarGroup> m_scrollbarGroup;
228 210
229 TouchEventRequestType m_touchEventRequestType; 211 TouchEventRequestType m_touchEventRequestType;
230 bool m_wantsWheelEvents; 212 bool m_wantsWheelEvents;
213
214 #if ENABLE(OILPAN)
215 // Oilpan: if true, the plugin container must dispose
216 // of its plugin when being finalized.
217 bool m_shouldDisposePlugin;
218 #endif
231 }; 219 };
232 220
233 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai ner(), widget.isPluginContainer()); 221 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai ner(), widget.isPluginContainer());
234 // Unlike Widget, we need not worry about object type for container. 222 // Unlike Widget, we need not worry about object type for container.
235 // WebPluginContainerImpl is the only subclass of WebPluginContainer. 223 // WebPluginContainerImpl is the only subclass of WebPluginContainer.
236 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t rue); 224 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t rue);
237 225
238 } // namespace blink 226 } // namespace blink
239 227
240 #endif 228 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698