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

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

Issue 2927823002: Drop ImageLoader in plugins (Closed)
Patch Set: Drop ImageLoader in plugins Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
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 17 matching lines...) Expand all
28 #include "core/dom/Document.h" 28 #include "core/dom/Document.h"
29 #include "core/dom/Node.h" 29 #include "core/dom/Node.h"
30 #include "core/dom/shadow/ShadowRoot.h" 30 #include "core/dom/shadow/ShadowRoot.h"
31 #include "core/events/Event.h" 31 #include "core/events/Event.h"
32 #include "core/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/frame/LocalFrameClient.h" 33 #include "core/frame/LocalFrameClient.h"
34 #include "core/frame/LocalFrameView.h" 34 #include "core/frame/LocalFrameView.h"
35 #include "core/frame/Settings.h" 35 #include "core/frame/Settings.h"
36 #include "core/frame/csp/ContentSecurityPolicy.h" 36 #include "core/frame/csp/ContentSecurityPolicy.h"
37 #include "core/html/HTMLContentElement.h" 37 #include "core/html/HTMLContentElement.h"
38 #include "core/html/HTMLImageLoader.h"
39 #include "core/html/PluginDocument.h" 38 #include "core/html/PluginDocument.h"
40 #include "core/input/EventHandler.h" 39 #include "core/input/EventHandler.h"
41 #include "core/inspector/ConsoleMessage.h" 40 #include "core/inspector/ConsoleMessage.h"
42 #include "core/layout/LayoutEmbeddedContent.h" 41 #include "core/layout/LayoutEmbeddedContent.h"
43 #include "core/layout/LayoutImage.h" 42 #include "core/layout/LayoutImage.h"
44 #include "core/layout/api/LayoutEmbeddedItem.h" 43 #include "core/layout/api/LayoutEmbeddedItem.h"
45 #include "core/loader/MixedContentChecker.h" 44 #include "core/loader/MixedContentChecker.h"
46 #include "core/page/Page.h" 45 #include "core/page/Page.h"
47 #include "core/page/scrolling/ScrollingCoordinator.h" 46 #include "core/page/scrolling/ScrollingCoordinator.h"
48 #include "core/plugins/PluginView.h" 47 #include "core/plugins/PluginView.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 needs_plugin_update_(!created_by_parser), 83 needs_plugin_update_(!created_by_parser),
85 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option == 84 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option ==
86 kShouldPreferPlugInsForImages) {} 85 kShouldPreferPlugInsForImages) {}
87 86
88 HTMLPlugInElement::~HTMLPlugInElement() { 87 HTMLPlugInElement::~HTMLPlugInElement() {
89 DCHECK(plugin_wrapper_.IsEmpty()); // cleared in detachLayoutTree() 88 DCHECK(plugin_wrapper_.IsEmpty()); // cleared in detachLayoutTree()
90 DCHECK(!is_delaying_load_event_); 89 DCHECK(!is_delaying_load_event_);
91 } 90 }
92 91
93 DEFINE_TRACE(HTMLPlugInElement) { 92 DEFINE_TRACE(HTMLPlugInElement) {
94 visitor->Trace(image_loader_);
95 visitor->Trace(persisted_plugin_); 93 visitor->Trace(persisted_plugin_);
96 HTMLFrameOwnerElement::Trace(visitor); 94 HTMLFrameOwnerElement::Trace(visitor);
97 } 95 }
98 96
99 bool HTMLPlugInElement::HasPendingActivity() const {
100 return image_loader_ && image_loader_->HasPendingActivity();
101 }
102
103 void HTMLPlugInElement::SetPersistedPlugin(PluginView* plugin) { 97 void HTMLPlugInElement::SetPersistedPlugin(PluginView* plugin) {
104 if (persisted_plugin_ == plugin) 98 if (persisted_plugin_ == plugin)
105 return; 99 return;
106 if (persisted_plugin_) { 100 if (persisted_plugin_) {
107 persisted_plugin_->Hide(); 101 persisted_plugin_->Hide();
108 DisposePluginSoon(persisted_plugin_.Release()); 102 DisposePluginSoon(persisted_plugin_.Release());
109 } 103 }
110 persisted_plugin_ = plugin; 104 persisted_plugin_ = plugin;
111 } 105 }
112 106
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return r && (r->IsEmbeddedObject() || r->IsLayoutEmbeddedContent()); 159 return r && (r->IsEmbeddedObject() || r->IsLayoutEmbeddedContent());
166 } 160 }
167 161
168 void HTMLPlugInElement::RemoveAllEventListeners() { 162 void HTMLPlugInElement::RemoveAllEventListeners() {
169 HTMLFrameOwnerElement::RemoveAllEventListeners(); 163 HTMLFrameOwnerElement::RemoveAllEventListeners();
170 PluginView* plugin = OwnedPlugin(); 164 PluginView* plugin = OwnedPlugin();
171 if (plugin) 165 if (plugin)
172 plugin->EventListenersRemoved(); 166 plugin->EventListenersRemoved();
173 } 167 }
174 168
175 void HTMLPlugInElement::DidMoveToNewDocument(Document& old_document) {
176 if (image_loader_)
177 image_loader_->ElementDidMoveToNewDocument();
178 HTMLFrameOwnerElement::DidMoveToNewDocument(old_document);
179 }
180
181 void HTMLPlugInElement::AttachLayoutTree(const AttachContext& context) { 169 void HTMLPlugInElement::AttachLayoutTree(const AttachContext& context) {
182 HTMLFrameOwnerElement::AttachLayoutTree(context); 170 HTMLFrameOwnerElement::AttachLayoutTree(context);
183 171
184 if (!GetLayoutObject() || UseFallbackContent()) { 172 if (!GetLayoutObject() || UseFallbackContent()) {
185 // If we don't have a layoutObject we have to dispose of any plugins 173 // If we don't have a layoutObject we have to dispose of any plugins
186 // which we persisted over a reattach. 174 // which we persisted over a reattach.
187 if (persisted_plugin_) { 175 if (persisted_plugin_) {
188 HTMLFrameOwnerElement::PluginDisposeSuspendScope suspend_plugin_dispose; 176 HTMLFrameOwnerElement::PluginDisposeSuspendScope suspend_plugin_dispose;
189 SetPersistedPlugin(nullptr); 177 SetPersistedPlugin(nullptr);
190 } 178 }
191 return; 179 return;
192 } 180 }
193 181
194 if (IsImageType()) { 182 if (NeedsPluginUpdate() && !GetLayoutEmbeddedItem().IsNull() &&
195 if (!image_loader_) 183 !GetLayoutEmbeddedItem().ShowsUnavailablePluginIndicator() &&
196 image_loader_ = HTMLImageLoader::Create(this); 184 GetObjectContentType() != ObjectContentType::kPlugin &&
197 image_loader_->UpdateFromElement(); 185 !is_delaying_load_event_) {
198 } else if (NeedsPluginUpdate() && !GetLayoutEmbeddedItem().IsNull() &&
199 !GetLayoutEmbeddedItem().ShowsUnavailablePluginIndicator() &&
200 GetObjectContentType() != ObjectContentType::kPlugin &&
201 !is_delaying_load_event_) {
202 is_delaying_load_event_ = true; 186 is_delaying_load_event_ = true;
203 GetDocument().IncrementLoadEventDelayCount(); 187 GetDocument().IncrementLoadEventDelayCount();
204 GetDocument().LoadPluginsSoon(); 188 GetDocument().LoadPluginsSoon();
205 } 189 }
206 } 190 }
207 191
208 void HTMLPlugInElement::UpdatePlugin() { 192 void HTMLPlugInElement::UpdatePlugin() {
209 UpdatePluginInternal(); 193 UpdatePluginInternal();
210 if (is_delaying_load_event_) { 194 if (is_delaying_load_event_) {
211 is_delaying_load_event_ = false; 195 is_delaying_load_event_ = false;
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 662
679 void HTMLPlugInElement::LazyReattachIfNeeded() { 663 void HTMLPlugInElement::LazyReattachIfNeeded() {
680 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() && 664 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() &&
681 !IsImageType()) { 665 !IsImageType()) {
682 LazyReattachIfAttached(); 666 LazyReattachIfAttached();
683 SetPersistedPlugin(nullptr); 667 SetPersistedPlugin(nullptr);
684 } 668 }
685 } 669 }
686 670
687 } // namespace blink 671 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698