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

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: Fix popup unit tests 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages) 70 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages)
71 , m_usePlaceholderContent(false) 71 , m_usePlaceholderContent(false)
72 { 72 {
73 } 73 }
74 74
75 HTMLPlugInElement::~HTMLPlugInElement() 75 HTMLPlugInElement::~HTMLPlugInElement()
76 { 76 {
77 ASSERT(!m_pluginWrapper); // cleared in detach() 77 ASSERT(!m_pluginWrapper); // cleared in detach()
78 ASSERT(!m_isDelayingLoadEvent); 78 ASSERT(!m_isDelayingLoadEvent);
79 79
80 #if ENABLE(OILPAN)
81 if (m_persistedPluginWidget)
82 HTMLFrameOwnerElement::disposeWidget(m_persistedPluginWidget.get());
83 #endif
84
80 if (m_NPObject) { 85 if (m_NPObject) {
81 _NPN_ReleaseObject(m_NPObject); 86 _NPN_ReleaseObject(m_NPObject);
82 m_NPObject = 0; 87 m_NPObject = 0;
83 } 88 }
84 } 89 }
85 90
86 void HTMLPlugInElement::trace(Visitor* visitor) 91 void HTMLPlugInElement::trace(Visitor* visitor)
87 { 92 {
88 visitor->trace(m_imageLoader); 93 visitor->trace(m_imageLoader);
94 visitor->trace(m_persistedPluginWidget);
89 HTMLFrameOwnerElement::trace(visitor); 95 HTMLFrameOwnerElement::trace(visitor);
90 } 96 }
91 97
98 #if ENABLE(OILPAN)
99 void HTMLPlugInElement::disconnectContentFrame()
100 {
101 if (m_persistedPluginWidget)
102 HTMLFrameOwnerElement::disposeWidget(m_persistedPluginWidget.get());
103 HTMLFrameOwnerElement::disconnectContentFrame();
104 }
105 #endif
106
92 bool HTMLPlugInElement::canProcessDrag() const 107 bool HTMLPlugInElement::canProcessDrag() const
93 { 108 {
94 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag(); 109 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag();
95 } 110 }
96 111
97 bool HTMLPlugInElement::willRespondToMouseClickEvents() 112 bool HTMLPlugInElement::willRespondToMouseClickEvents()
98 { 113 {
99 if (isDisabledFormControl()) 114 if (isDisabledFormControl())
100 return false; 115 return false;
101 RenderObject* r = renderer(); 116 RenderObject* r = renderer();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 setNeedsWidgetUpdate(true); 210 setNeedsWidgetUpdate(true);
196 if (m_isDelayingLoadEvent) { 211 if (m_isDelayingLoadEvent) {
197 m_isDelayingLoadEvent = false; 212 m_isDelayingLoadEvent = false;
198 document().decrementLoadEventDelayCount(); 213 document().decrementLoadEventDelayCount();
199 } 214 }
200 215
201 // Only try to persist a plugin widget we actually own. 216 // Only try to persist a plugin widget we actually own.
202 Widget* plugin = ownedWidget(); 217 Widget* plugin = ownedWidget();
203 if (plugin && plugin->pluginShouldPersist()) 218 if (plugin && plugin->pluginShouldPersist())
204 m_persistedPluginWidget = plugin; 219 m_persistedPluginWidget = plugin;
205 #if ENABLE(OILPAN) 220
206 else if (plugin)
207 plugin->detach();
208 #endif
209 resetInstance(); 221 resetInstance();
210 // FIXME - is this next line necessary? 222 // Clear the widget; will trigger disposal of it with Oilpan.
211 setWidget(nullptr); 223 setWidget(nullptr);
212 224
213 if (m_isCapturingMouseEvents) { 225 if (m_isCapturingMouseEvents) {
214 if (LocalFrame* frame = document().frame()) 226 if (LocalFrame* frame = document().frame())
215 frame->eventHandler().setCapturingMouseEventsNode(nullptr); 227 frame->eventHandler().setCapturingMouseEventsNode(nullptr);
216 m_isCapturingMouseEvents = false; 228 m_isCapturingMouseEvents = false;
217 } 229 }
218 230
219 if (m_NPObject) { 231 if (m_NPObject) {
220 _NPN_ReleaseObject(m_NPObject); 232 _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 340 // FIXME: Mouse down and scroll events are passed down to plug-in via custom
329 // code in EventHandler; these code paths should be united. 341 // code in EventHandler; these code paths should be united.
330 342
331 RenderObject* r = renderer(); 343 RenderObject* r = renderer();
332 if (!r || !r->isWidget()) 344 if (!r || !r->isWidget())
333 return; 345 return;
334 if (r->isEmbeddedObject()) { 346 if (r->isEmbeddedObject()) {
335 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) 347 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator())
336 return; 348 return;
337 } 349 }
338 RefPtr<Widget> widget = toRenderWidget(r)->widget(); 350 RefPtrWillBeRawPtr<Widget> widget = toRenderWidget(r)->widget();
339 if (!widget) 351 if (!widget)
340 return; 352 return;
341 widget->handleEvent(event); 353 widget->handleEvent(event);
342 if (event->defaultHandled()) 354 if (event->defaultHandled())
343 return; 355 return;
344 HTMLFrameOwnerElement::defaultEventHandler(event); 356 HTMLFrameOwnerElement::defaultEventHandler(event);
345 } 357 }
346 358
347 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const 359 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const
348 { 360 {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 480
469 RenderEmbeddedObject* renderer = renderEmbeddedObject(); 481 RenderEmbeddedObject* renderer = renderEmbeddedObject();
470 // FIXME: This code should not depend on renderer! 482 // FIXME: This code should not depend on renderer!
471 if ((!renderer && requireRenderer) || useFallback) 483 if ((!renderer && requireRenderer) || useFallback)
472 return false; 484 return false;
473 485
474 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); 486 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data());
475 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); 487 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data());
476 m_loadedUrl = url; 488 m_loadedUrl = url;
477 489
478 RefPtr<Widget> widget = m_persistedPluginWidget; 490 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget;
479 if (!widget) { 491 if (!widget) {
480 bool loadManually = document().isPluginDocument() && !document().contain sPlugins(); 492 bool loadManually = document().isPluginDocument() && !document().contain sPlugins();
481 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? Frame LoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; 493 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? Frame LoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin;
482 widget = frame->loader().client()->createPlugin(this, url, paramNames, p aramValues, mimeType, loadManually, policy); 494 widget = frame->loader().client()->createPlugin(this, url, paramNames, p aramValues, mimeType, loadManually, policy);
483 } 495 }
484 496
485 if (!widget) { 497 if (!widget) {
486 if (renderer && !renderer->showsUnavailablePluginIndicator()) 498 if (renderer && !renderer->showsUnavailablePluginIndicator())
487 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing); 499 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing);
488 return false; 500 return false;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 602 }
591 } 603 }
592 604
593 void HTMLPlugInElement::lazyReattachIfNeeded() 605 void HTMLPlugInElement::lazyReattachIfNeeded()
594 { 606 {
595 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) 607 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType())
596 lazyReattachIfAttached(); 608 lazyReattachIfAttached();
597 } 609 }
598 610
599 } 611 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698