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

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

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase needed again 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) 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 if (m_NPObject) { 80 if (m_NPObject) {
81 _NPN_ReleaseObject(m_NPObject); 81 _NPN_ReleaseObject(m_NPObject);
82 m_NPObject = 0; 82 m_NPObject = 0;
83 } 83 }
84 } 84 }
85 85
86 void HTMLPlugInElement::trace(Visitor* visitor) 86 void HTMLPlugInElement::trace(Visitor* visitor)
87 { 87 {
88 visitor->trace(m_imageLoader); 88 visitor->trace(m_imageLoader);
89 visitor->trace(m_persistedPluginWidget);
89 HTMLFrameOwnerElement::trace(visitor); 90 HTMLFrameOwnerElement::trace(visitor);
90 } 91 }
91 92
93 #if ENABLE(OILPAN)
94 void HTMLPlugInElement::disconnectContentFrame()
95 {
96 if (m_persistedPluginWidget) {
97 m_persistedPluginWidget->dispose();
98 m_persistedPluginWidget = nullptr;
99 }
100 HTMLFrameOwnerElement::disconnectContentFrame();
101 }
102 #endif
103
104 void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget)
sof 2014/10/08 11:52:25 This scheme is not complete and doesn't solve the
105 {
106 #if ENABLE(OILPAN)
107 if (widget->isPluginView()) {
108 PluginView* plugin = toPluginView(widget);
109 if (LocalFrame* frame = plugin->pluginFrame()) {
110 frame->registerPluginElement(this);
111 }
112 }
113 #endif
114 m_persistedPluginWidget = widget;
115 }
116
92 bool HTMLPlugInElement::canProcessDrag() const 117 bool HTMLPlugInElement::canProcessDrag() const
93 { 118 {
94 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag(); 119 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag();
95 } 120 }
96 121
97 bool HTMLPlugInElement::willRespondToMouseClickEvents() 122 bool HTMLPlugInElement::willRespondToMouseClickEvents()
98 { 123 {
99 if (isDisabledFormControl()) 124 if (isDisabledFormControl())
100 return false; 125 return false;
101 RenderObject* r = renderer(); 126 RenderObject* r = renderer();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (renderer() && !useFallbackContent()) 219 if (renderer() && !useFallbackContent())
195 setNeedsWidgetUpdate(true); 220 setNeedsWidgetUpdate(true);
196 if (m_isDelayingLoadEvent) { 221 if (m_isDelayingLoadEvent) {
197 m_isDelayingLoadEvent = false; 222 m_isDelayingLoadEvent = false;
198 document().decrementLoadEventDelayCount(); 223 document().decrementLoadEventDelayCount();
199 } 224 }
200 225
201 // Only try to persist a plugin widget we actually own. 226 // Only try to persist a plugin widget we actually own.
202 Widget* plugin = ownedWidget(); 227 Widget* plugin = ownedWidget();
203 if (plugin && plugin->pluginShouldPersist()) 228 if (plugin && plugin->pluginShouldPersist())
204 m_persistedPluginWidget = plugin; 229 setPersistedPluginWidget(plugin);
205 #if ENABLE(OILPAN) 230
206 else if (plugin)
207 plugin->detach();
208 #endif
209 resetInstance(); 231 resetInstance();
210 // FIXME - is this next line necessary? 232 // Clear the widget; will trigger disposal of it with Oilpan.
211 setWidget(nullptr); 233 setWidget(nullptr);
212 234
213 if (m_isCapturingMouseEvents) { 235 if (m_isCapturingMouseEvents) {
214 if (LocalFrame* frame = document().frame()) 236 if (LocalFrame* frame = document().frame())
215 frame->eventHandler().setCapturingMouseEventsNode(nullptr); 237 frame->eventHandler().setCapturingMouseEventsNode(nullptr);
216 m_isCapturingMouseEvents = false; 238 m_isCapturingMouseEvents = false;
217 } 239 }
218 240
219 if (m_NPObject) { 241 if (m_NPObject) {
220 _NPN_ReleaseObject(m_NPObject); 242 _NPN_ReleaseObject(m_NPObject);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // FIXME: Mouse down and scroll events are passed down to plug-in via custom 350 // FIXME: Mouse down and scroll events are passed down to plug-in via custom
329 // code in EventHandler; these code paths should be united. 351 // code in EventHandler; these code paths should be united.
330 352
331 RenderObject* r = renderer(); 353 RenderObject* r = renderer();
332 if (!r || !r->isWidget()) 354 if (!r || !r->isWidget())
333 return; 355 return;
334 if (r->isEmbeddedObject()) { 356 if (r->isEmbeddedObject()) {
335 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) 357 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator())
336 return; 358 return;
337 } 359 }
338 RefPtr<Widget> widget = toRenderWidget(r)->widget(); 360 RefPtrWillBeRawPtr<Widget> widget = toRenderWidget(r)->widget();
339 if (!widget) 361 if (!widget)
340 return; 362 return;
341 widget->handleEvent(event); 363 widget->handleEvent(event);
342 if (event->defaultHandled()) 364 if (event->defaultHandled())
343 return; 365 return;
344 HTMLFrameOwnerElement::defaultEventHandler(event); 366 HTMLFrameOwnerElement::defaultEventHandler(event);
345 } 367 }
346 368
347 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const 369 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const
348 { 370 {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 493
472 RenderEmbeddedObject* renderer = renderEmbeddedObject(); 494 RenderEmbeddedObject* renderer = renderEmbeddedObject();
473 // FIXME: This code should not depend on renderer! 495 // FIXME: This code should not depend on renderer!
474 if ((!renderer && requireRenderer) || useFallback) 496 if ((!renderer && requireRenderer) || useFallback)
475 return false; 497 return false;
476 498
477 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); 499 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data());
478 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); 500 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data());
479 m_loadedUrl = url; 501 m_loadedUrl = url;
480 502
481 RefPtr<Widget> widget = m_persistedPluginWidget; 503 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget;
482 if (!widget) { 504 if (!widget) {
483 bool loadManually = document().isPluginDocument() && !document().contain sPlugins(); 505 bool loadManually = document().isPluginDocument() && !document().contain sPlugins();
484 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? Frame LoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; 506 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? Frame LoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin;
485 widget = frame->loader().client()->createPlugin(this, url, paramNames, p aramValues, mimeType, loadManually, policy); 507 widget = frame->loader().client()->createPlugin(this, url, paramNames, p aramValues, mimeType, loadManually, policy);
486 } 508 }
487 509
488 if (!widget) { 510 if (!widget) {
489 if (renderer && !renderer->showsUnavailablePluginIndicator()) 511 if (renderer && !renderer->showsUnavailablePluginIndicator())
490 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing); 512 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing);
491 return false; 513 return false;
492 } 514 }
493 515
494 if (renderer) { 516 if (renderer) {
495 setWidget(widget); 517 setWidget(widget);
496 m_persistedPluginWidget = nullptr; 518 m_persistedPluginWidget = nullptr;
497 } else if (widget != m_persistedPluginWidget) { 519 } else if (widget != m_persistedPluginWidget) {
498 m_persistedPluginWidget = widget; 520 setPersistedPluginWidget(widget.get());
499 } 521 }
500 document().setContainsPlugins(); 522 document().setContainsPlugins();
501 scheduleSVGFilterLayerUpdateHack(); 523 scheduleSVGFilterLayerUpdateHack();
502 // Make sure any input event handlers introduced by the plugin are taken int o account. 524 // Make sure any input event handlers introduced by the plugin are taken int o account.
503 if (Page* page = document().frame()->page()) { 525 if (Page* page = document().frame()->page()) {
504 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) 526 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor())
505 scrollingCoordinator->notifyLayoutUpdated(); 527 scrollingCoordinator->notifyLayoutUpdated();
506 } 528 }
507 return true; 529 return true;
508 } 530 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 615 }
594 } 616 }
595 617
596 void HTMLPlugInElement::lazyReattachIfNeeded() 618 void HTMLPlugInElement::lazyReattachIfNeeded()
597 { 619 {
598 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) 620 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType())
599 lazyReattachIfAttached(); 621 lazyReattachIfAttached();
600 } 622 }
601 623
602 } 624 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698