| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 // Private methods ------------------------------------------------------------- | 678 // Private methods ------------------------------------------------------------- |
| 679 | 679 |
| 680 WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
ugin* webPlugin) | 680 WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
ugin* webPlugin) |
| 681 : LocalFrameLifecycleObserver(element->document().frame()) | 681 : LocalFrameLifecycleObserver(element->document().frame()) |
| 682 , m_element(element) | 682 , m_element(element) |
| 683 , m_webPlugin(webPlugin) | 683 , m_webPlugin(webPlugin) |
| 684 , m_webLayer(nullptr) | 684 , m_webLayer(nullptr) |
| 685 , m_touchEventRequestType(TouchEventRequestTypeNone) | 685 , m_touchEventRequestType(TouchEventRequestTypeNone) |
| 686 , m_wantsWheelEvents(false) | 686 , m_wantsWheelEvents(false) |
| 687 , m_inDispose(false) | 687 , m_inDispose(false) |
| 688 { |
| 688 #if ENABLE(OILPAN) | 689 #if ENABLE(OILPAN) |
| 689 , m_shouldDisposePlugin(false) | 690 ThreadState::current()->registerPreFinalizer(this); |
| 690 #endif | 691 #endif |
| 691 { | |
| 692 } | 692 } |
| 693 | 693 |
| 694 WebPluginContainerImpl::~WebPluginContainerImpl() | 694 WebPluginContainerImpl::~WebPluginContainerImpl() |
| 695 { | 695 { |
| 696 #if ENABLE(OILPAN) | 696 #if ENABLE(OILPAN) |
| 697 if (m_shouldDisposePlugin) | |
| 698 dispose(); | |
| 699 // The plugin container must have been disposed of by now. | 697 // The plugin container must have been disposed of by now. |
| 700 ASSERT(!m_webPlugin); | 698 ASSERT(!m_webPlugin); |
| 701 #else | 699 #else |
| 702 dispose(); | 700 dispose(); |
| 703 #endif | 701 #endif |
| 704 } | 702 } |
| 705 | 703 |
| 706 void WebPluginContainerImpl::dispose() | 704 void WebPluginContainerImpl::dispose() |
| 707 { | 705 { |
| 708 m_inDispose = true; | 706 m_inDispose = true; |
| 709 | 707 |
| 710 if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_e
lement->document().frameHost()) | 708 if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_e
lement->document().frameHost()) |
| 711 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); | 709 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent
Handler(*m_element, EventHandlerRegistry::TouchEvent); |
| 712 | 710 |
| 713 if (m_webPlugin) { | 711 if (m_webPlugin) { |
| 714 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() ==
this); | 712 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() ==
this); |
| 715 m_webPlugin->destroy(); | 713 m_webPlugin->destroy(); |
| 716 m_webPlugin = nullptr; | 714 m_webPlugin = nullptr; |
| 717 } | 715 } |
| 718 | 716 |
| 719 if (m_webLayer) { | 717 if (m_webLayer) { |
| 720 GraphicsLayer::unregisterContentsLayer(m_webLayer); | 718 GraphicsLayer::unregisterContentsLayer(m_webLayer); |
| 721 m_webLayer = nullptr; | 719 m_webLayer = nullptr; |
| 722 } | 720 } |
| 723 | 721 |
| 724 m_element = nullptr; | 722 m_element = nullptr; |
| 725 } | 723 } |
| 726 | 724 |
| 727 #if ENABLE(OILPAN) | |
| 728 void WebPluginContainerImpl::shouldDisposePlugin() | |
| 729 { | |
| 730 // If the LocalFrame is still alive, but the plugin element isn't, the | |
| 731 // LocalFrame will set m_shouldDisposePlugin via its weak pointer | |
| 732 // callback. This is a signal that the plugin container | |
| 733 // must dispose of its plugin when finalizing. The LocalFrame and | |
| 734 // all objects accessible from it can safely be accessed, but not | |
| 735 // the plugin element itself. | |
| 736 ASSERT(!m_shouldDisposePlugin); | |
| 737 m_shouldDisposePlugin = true; | |
| 738 m_element = nullptr; | |
| 739 } | |
| 740 #endif | |
| 741 | |
| 742 DEFINE_TRACE(WebPluginContainerImpl) | 725 DEFINE_TRACE(WebPluginContainerImpl) |
| 743 { | 726 { |
| 744 visitor->trace(m_element); | 727 visitor->trace(m_element); |
| 745 LocalFrameLifecycleObserver::trace(visitor); | 728 LocalFrameLifecycleObserver::trace(visitor); |
| 746 PluginView::trace(visitor); | 729 PluginView::trace(visitor); |
| 747 } | 730 } |
| 748 | 731 |
| 749 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) | 732 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) |
| 750 { | 733 { |
| 751 ASSERT(parent()->isFrameView()); | 734 ASSERT(parent()->isFrameView()); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 // frame view. | 960 // frame view. |
| 978 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 961 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
| 979 } | 962 } |
| 980 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 963 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 981 // Convert to the plugin position. | 964 // Convert to the plugin position. |
| 982 for (size_t i = 0; i < cutOutRects.size(); i++) | 965 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 983 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 966 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 984 } | 967 } |
| 985 | 968 |
| 986 } // namespace blinkf | 969 } // namespace blinkf |
| OLD | NEW |