OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 825 |
826 webkit::ppapi::PluginDelegate::PlatformContext3D* | 826 webkit::ppapi::PluginDelegate::PlatformContext3D* |
827 PepperPluginDelegateImpl::CreateContext3D() { | 827 PepperPluginDelegateImpl::CreateContext3D() { |
828 #ifdef ENABLE_GPU | 828 #ifdef ENABLE_GPU |
829 // If accelerated compositing of plugins is disabled, fail to create a 3D | 829 // If accelerated compositing of plugins is disabled, fail to create a 3D |
830 // context, because it won't be visible. This allows graceful fallback in the | 830 // context, because it won't be visible. This allows graceful fallback in the |
831 // modules. | 831 // modules. |
832 const webkit_glue::WebPreferences& prefs = render_view_->webkit_preferences(); | 832 const webkit_glue::WebPreferences& prefs = render_view_->webkit_preferences(); |
833 if (!prefs.accelerated_compositing_for_plugins_enabled) | 833 if (!prefs.accelerated_compositing_for_plugins_enabled) |
834 return NULL; | 834 return NULL; |
835 return new PlatformContext3DImpl(this); | 835 return new PlatformContext3DImpl; |
836 #else | 836 #else |
837 return NULL; | 837 return NULL; |
838 #endif | 838 #endif |
839 } | 839 } |
840 | 840 |
841 void PepperPluginDelegateImpl::ReparentContext( | 841 void PepperPluginDelegateImpl::ReparentContext( |
842 webkit::ppapi::PluginDelegate::PlatformContext3D* context) { | 842 webkit::ppapi::PluginDelegate::PlatformContext3D* context) { |
843 static_cast<PlatformContext3DImpl*>(context)->SetParentContext(this); | 843 static_cast<PlatformContext3DImpl*>(context)-> |
| 844 SetParentAndCreateBackingTextureIfNeeded(); |
844 } | 845 } |
845 | 846 |
846 webkit::ppapi::PluginDelegate::PlatformVideoCapture* | 847 webkit::ppapi::PluginDelegate::PlatformVideoCapture* |
847 PepperPluginDelegateImpl::CreateVideoCapture( | 848 PepperPluginDelegateImpl::CreateVideoCapture( |
848 const std::string& device_id, | 849 const std::string& device_id, |
849 PlatformVideoCaptureEventHandler* handler) { | 850 PlatformVideoCaptureEventHandler* handler) { |
850 return new PepperPlatformVideoCaptureImpl(AsWeakPtr(), device_id, handler); | 851 return new PepperPlatformVideoCaptureImpl(AsWeakPtr(), device_id, handler); |
851 } | 852 } |
852 | 853 |
853 webkit::ppapi::PluginDelegate::PlatformVideoDecoder* | 854 webkit::ppapi::PluginDelegate::PlatformVideoDecoder* |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 0); | 1567 0); |
1567 default: | 1568 default: |
1568 NOTREACHED(); | 1569 NOTREACHED(); |
1569 return 0; | 1570 return 0; |
1570 } | 1571 } |
1571 #else | 1572 #else |
1572 return 0; | 1573 return 0; |
1573 #endif | 1574 #endif |
1574 } | 1575 } |
1575 | 1576 |
1576 WebGraphicsContext3DCommandBufferImpl* | |
1577 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { | |
1578 if (!offscreen_context3d_ || offscreen_context3d_->DestroyedOnMainThread()) { | |
1579 offscreen_context3d_ = | |
1580 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | |
1581 | |
1582 if (!offscreen_context3d_->InitializeOnMainThread() || | |
1583 !offscreen_context3d_->BindToCurrentThread()) { | |
1584 offscreen_context3d_ = NULL; | |
1585 return NULL; | |
1586 } | |
1587 } | |
1588 return offscreen_context3d_->Context3d(); | |
1589 } | |
1590 | |
1591 MouseLockDispatcher::LockTarget* | 1577 MouseLockDispatcher::LockTarget* |
1592 PepperPluginDelegateImpl::GetOrCreateLockTargetAdapter( | 1578 PepperPluginDelegateImpl::GetOrCreateLockTargetAdapter( |
1593 webkit::ppapi::PluginInstance* instance) { | 1579 webkit::ppapi::PluginInstance* instance) { |
1594 MouseLockDispatcher::LockTarget* target = mouse_lock_instances_[instance]; | 1580 MouseLockDispatcher::LockTarget* target = mouse_lock_instances_[instance]; |
1595 if (target) | 1581 if (target) |
1596 return target; | 1582 return target; |
1597 | 1583 |
1598 return mouse_lock_instances_[instance] = | 1584 return mouse_lock_instances_[instance] = |
1599 new PluginInstanceLockTarget(instance); | 1585 new PluginInstanceLockTarget(instance); |
1600 } | 1586 } |
(...skipping 15 matching lines...) Expand all Loading... |
1616 RenderWidgetFullscreenPepper* container = | 1602 RenderWidgetFullscreenPepper* container = |
1617 static_cast<RenderWidgetFullscreenPepper*>( | 1603 static_cast<RenderWidgetFullscreenPepper*>( |
1618 instance->fullscreen_container()); | 1604 instance->fullscreen_container()); |
1619 return container->mouse_lock_dispatcher(); | 1605 return container->mouse_lock_dispatcher(); |
1620 } else { | 1606 } else { |
1621 return render_view_->mouse_lock_dispatcher(); | 1607 return render_view_->mouse_lock_dispatcher(); |
1622 } | 1608 } |
1623 } | 1609 } |
1624 | 1610 |
1625 } // namespace content | 1611 } // namespace content |
OLD | NEW |