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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLPlugInElement.h

Issue 2855753002: Simplify HTMLPlugInElement::PluginWrapper to not use SharedPersistent. (Closed)
Patch Set: no need for mutable Created 3 years, 7 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 class CORE_EXPORT HTMLPlugInElement : public HTMLFrameOwnerElement { 44 class CORE_EXPORT HTMLPlugInElement : public HTMLFrameOwnerElement {
45 public: 45 public:
46 ~HTMLPlugInElement() override; 46 ~HTMLPlugInElement() override;
47 DECLARE_VIRTUAL_TRACE(); 47 DECLARE_VIRTUAL_TRACE();
48 48
49 void SetFocused(bool, WebFocusType) override; 49 void SetFocused(bool, WebFocusType) override;
50 void ResetInstance(); 50 void ResetInstance();
51 // TODO(dcheng): Consider removing this, since HTMLEmbedElementLegacyCall 51 // TODO(dcheng): Consider removing this, since HTMLEmbedElementLegacyCall
52 // and HTMLObjectElementLegacyCall usage is extremely low. 52 // and HTMLObjectElementLegacyCall usage is extremely low.
53 SharedPersistent<v8::Object>* PluginWrapper(); 53 v8::Local<v8::Object> PluginWrapper();
54 // TODO(joelhockey): Clean up pluginWidget and plugin (maybe also 54 // TODO(joelhockey): Clean up pluginWidget and plugin (maybe also
55 // pluginWrapper). It would be good to remove and/or rename some of these. 55 // pluginWrapper). It would be good to remove and/or rename some of these.
56 // pluginWidget and plugin both return the plugin that is stored on this 56 // pluginWidget and plugin both return the plugin that is stored on this
57 // element. However pluginWidget will synchronously create the plugin if 57 // element. However pluginWidget will synchronously create the plugin if
58 // required by calling layoutPartForJSBindings. Possibly the pluginWidget 58 // required by calling layoutPartForJSBindings. Possibly the pluginWidget
59 // code can be inlined into pluginWrapper. 59 // code can be inlined into pluginWrapper.
60 PluginView* PluginWidget() const; 60 PluginView* PluginWidget() const;
61 PluginView* Plugin() const; 61 PluginView* Plugin() const;
62 bool CanProcessDrag() const; 62 bool CanProcessDrag() const;
63 const String& Url() const { return url_; } 63 const String& Url() const { return url_; }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void SetPlugin(PluginView*); 168 void SetPlugin(PluginView*);
169 PluginView* ReleasePlugin(); 169 PluginView* ReleasePlugin();
170 void SetPersistedPlugin(PluginView*); 170 void SetPersistedPlugin(PluginView*);
171 171
172 bool RequestObjectInternal(const String& url, 172 bool RequestObjectInternal(const String& url,
173 const String& mime_type, 173 const String& mime_type,
174 const Vector<String>& param_names, 174 const Vector<String>& param_names,
175 const Vector<String>& param_values); 175 const Vector<String>& param_values);
176 176
177 mutable RefPtr<SharedPersistent<v8::Object>> plugin_wrapper_; 177 v8::Global<v8::Object> plugin_wrapper_;
178 bool needs_plugin_update_; 178 bool needs_plugin_update_;
179 bool should_prefer_plug_ins_for_images_; 179 bool should_prefer_plug_ins_for_images_;
180 // Represents |layoutObject() && layoutObject()->isEmbeddedObject() && 180 // Represents |layoutObject() && layoutObject()->isEmbeddedObject() &&
181 // !layoutEmbeddedItem().showsUnavailablePluginIndicator()|. We want to 181 // !layoutEmbeddedItem().showsUnavailablePluginIndicator()|. We want to
182 // avoid accessing |layoutObject()| in layoutObjectIsFocusable(). 182 // avoid accessing |layoutObject()| in layoutObjectIsFocusable().
183 bool plugin_is_available_ = false; 183 bool plugin_is_available_ = false;
184 184
185 Member<PluginView> plugin_; 185 Member<PluginView> plugin_;
186 // Normally the plugin is stored in HTMLFrameOwnerElement::m_widget. 186 // Normally the plugin is stored in HTMLFrameOwnerElement::m_widget.
187 // However, plugins can persist even when not rendered. In order to 187 // However, plugins can persist even when not rendered. In order to
188 // prevent confusing code which may assume that ownedWidget() != null 188 // prevent confusing code which may assume that ownedWidget() != null
189 // means the frame is active, we save off m_widget here while 189 // means the frame is active, we save off m_widget here while
190 // the plugin is persisting but not being displayed. 190 // the plugin is persisting but not being displayed.
191 Member<PluginView> persisted_plugin_; 191 Member<PluginView> persisted_plugin_;
192 }; 192 };
193 193
194 inline bool IsHTMLPlugInElement(const HTMLElement& element) { 194 inline bool IsHTMLPlugInElement(const HTMLElement& element) {
195 return element.IsPluginElement(); 195 return element.IsPluginElement();
196 } 196 }
197 197
198 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLPlugInElement); 198 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLPlugInElement);
199 199
200 } // namespace blink 200 } // namespace blink
201 201
202 #endif // HTMLPlugInElement_h 202 #endif // HTMLPlugInElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698