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

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

Issue 357443005: Oilpan: make shutdown of plugin container objects work better. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Conditionally define detach() Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 // If either of the layers is null we need to switch between hardware 297 // If either of the layers is null we need to switch between hardware
298 // and software compositing. 298 // and software compositing.
299 bool needsCompositingUpdate = !m_webLayer || !layer; 299 bool needsCompositingUpdate = !m_webLayer || !layer;
300 300
301 m_webLayer = layer; 301 m_webLayer = layer;
302 302
303 if (!needsCompositingUpdate) 303 if (!needsCompositingUpdate)
304 return; 304 return;
305 305
306 #if ENABLE(OILPAN)
307 if (!m_element)
308 return;
309 #endif
310
306 m_element->setNeedsCompositingUpdate(); 311 m_element->setNeedsCompositingUpdate();
307 // Being composited or not affects the self painting layer bit 312 // Being composited or not affects the self painting layer bit
308 // on the RenderLayer. 313 // on the RenderLayer.
309 if (RenderPart* renderer = m_element->renderPart()) { 314 if (RenderPart* renderer = m_element->renderPart()) {
310 ASSERT(renderer->hasLayer()); 315 ASSERT(renderer->hasLayer());
311 renderer->layer()->updateSelfPaintingLayer(); 316 renderer->layer()->updateSelfPaintingLayer();
312 } 317 }
313 } 318 }
314 319
315 bool WebPluginContainerImpl::supportsPaginatedPrint() const 320 bool WebPluginContainerImpl::supportsPaginatedPrint() const
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 m_scrollbarGroup->setFrameRect(frameRect()); 424 m_scrollbarGroup->setFrameRect(frameRect());
420 } 425 }
421 } 426 }
422 427
423 void WebPluginContainerImpl::allowScriptObjects() 428 void WebPluginContainerImpl::allowScriptObjects()
424 { 429 {
425 } 430 }
426 431
427 void WebPluginContainerImpl::clearScriptObjects() 432 void WebPluginContainerImpl::clearScriptObjects()
428 { 433 {
434 #if ENABLE(OILPAN)
435 if (m_scriptController) {
436 m_scriptController->cleanupScriptObjectsForPlugin(this);
haraken 2014/06/25 05:40:16 Maybe should we call cleanupScriptObjectsForPlugin
sof 2014/06/25 05:44:25 Is Node::detach() (from where we call this contain
haraken 2014/06/25 05:54:24 ah, understood. Then would it be possible to call
sof 2014/06/25 07:09:32 (cleanupScriptObjectsForPlugin() is something the
437 m_scriptController = nullptr;
438 }
439 #else
429 LocalFrame* frame = m_element->document().frame(); 440 LocalFrame* frame = m_element->document().frame();
430 if (!frame) 441 if (!frame)
431 return; 442 return;
432 frame->script().cleanupScriptObjectsForPlugin(this); 443 frame->script().cleanupScriptObjectsForPlugin(this);
444 #endif
433 } 445 }
434 446
447 #if ENABLE(OILPAN)
448 void WebPluginContainerImpl::setScriptController(WebCore::ScriptController* scri ptController)
449 {
450 m_scriptController = scriptController;
451 }
452 #endif
453
435 NPObject* WebPluginContainerImpl::scriptableObjectForElement() 454 NPObject* WebPluginContainerImpl::scriptableObjectForElement()
436 { 455 {
437 return m_element->getNPObject(); 456 return m_element->getNPObject();
438 } 457 }
439 458
440 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, bool popup sAllowed) 459 WebString WebPluginContainerImpl::executeScriptURL(const WebURL& url, bool popup sAllowed)
441 { 460 {
442 LocalFrame* frame = m_element->document().frame(); 461 LocalFrame* frame = m_element->document().frame();
443 if (!frame) 462 if (!frame)
444 return WebString(); 463 return WebString();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 context->fillRect(intersection(verticalOverhangArea, dirtyRect)); 667 context->fillRect(intersection(verticalOverhangArea, dirtyRect));
649 context->restore(); 668 context->restore();
650 return true; 669 return true;
651 } 670 }
652 671
653 // Private methods ------------------------------------------------------------- 672 // Private methods -------------------------------------------------------------
654 673
655 WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme nt, WebPlugin* webPlugin) 674 WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme nt, WebPlugin* webPlugin)
656 : m_element(element) 675 : m_element(element)
657 , m_webPlugin(webPlugin) 676 , m_webPlugin(webPlugin)
677 #if ENABLE(OILPAN)
678 , m_scriptController(0)
679 #endif
658 , m_webLayer(0) 680 , m_webLayer(0)
659 , m_touchEventRequestType(TouchEventRequestTypeNone) 681 , m_touchEventRequestType(TouchEventRequestTypeNone)
660 , m_wantsWheelEvents(false) 682 , m_wantsWheelEvents(false)
661 { 683 {
662 } 684 }
663 685
664 WebPluginContainerImpl::~WebPluginContainerImpl() 686 WebPluginContainerImpl::~WebPluginContainerImpl()
665 { 687 {
688 #if ENABLE(OILPAN)
689 // The element (and its document) are heap allocated and may
690 // have been finalized by now; unsafe to unregister the touch
691 // event handler at this stage.
692 //
693 // This is acceptable, as the widget will unregister itself if it
694 // is cleanly detached. If an explicit detach doesn't happen, this
695 // container is assumed to have died with the plugin element (and
696 // its document), hence no unregistration step is needed.
697 //
698 m_element = 0;
699 #else
666 if (m_touchEventRequestType != TouchEventRequestTypeNone) 700 if (m_touchEventRequestType != TouchEventRequestTypeNone)
667 m_element->document().didRemoveTouchEventHandler(m_element); 701 m_element->document().didRemoveTouchEventHandler(m_element);
702 #endif
668 703
669 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i) 704 for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
670 m_pluginLoadObservers[i]->clearPluginContainer(); 705 m_pluginLoadObservers[i]->clearPluginContainer();
671 m_webPlugin->destroy(); 706 m_webPlugin->destroy();
672 if (m_webLayer) 707 if (m_webLayer)
673 GraphicsLayer::unregisterContentsLayer(m_webLayer); 708 GraphicsLayer::unregisterContentsLayer(m_webLayer);
haraken 2014/06/25 05:40:16 Probably can we move the line 704 - 708 to detach(
674 } 709 }
675 710
711 #if ENABLE(OILPAN)
712 void WebPluginContainerImpl::detach()
713 {
714 if (m_touchEventRequestType != TouchEventRequestTypeNone)
715 m_element->document().didRemoveTouchEventHandler(m_element);
716
717 setWebLayer(0);
haraken 2014/06/25 05:54:24 Just help me understand: Calling setWebLayer(0) is
sof 2014/06/25 07:09:32 Exactly so; we cannot do it at finalization time a
718 }
719 #endif
720
676 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) 721 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
677 { 722 {
678 ASSERT(parent()->isFrameView()); 723 ASSERT(parent()->isFrameView());
679 724
680 if (event->isDragEvent()) { 725 if (event->isDragEvent()) {
681 if (m_webPlugin->canProcessDrag()) 726 if (m_webPlugin->canProcessDrag())
682 handleDragEvent(event); 727 handleDragEvent(event);
683 return; 728 return;
684 } 729 }
685 730
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 956
912 return clipRect; 957 return clipRect;
913 } 958 }
914 959
915 bool WebPluginContainerImpl::pluginShouldPersist() const 960 bool WebPluginContainerImpl::pluginShouldPersist() const
916 { 961 {
917 return m_webPlugin->shouldPersist(); 962 return m_webPlugin->shouldPersist();
918 } 963 }
919 964
920 } // namespace blink 965 } // namespace blink
OLDNEW
« Source/platform/Widget.h ('K') | « Source/web/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698