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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 PepperPluginDelegateImpl::GetGraphics2D( | 802 PepperPluginDelegateImpl::GetGraphics2D( |
803 webkit::ppapi::PluginInstance* instance, | 803 webkit::ppapi::PluginInstance* instance, |
804 PP_Resource resource) { | 804 PP_Resource resource) { |
805 RendererPpapiHostImpl* host_impl = static_cast<RendererPpapiHostImpl*>( | 805 RendererPpapiHostImpl* host_impl = static_cast<RendererPpapiHostImpl*>( |
806 instance->module()->GetEmbedderState()); | 806 instance->module()->GetEmbedderState()); |
807 return host_impl->GetPlatformGraphics2D(resource); | 807 return host_impl->GetPlatformGraphics2D(resource); |
808 } | 808 } |
809 | 809 |
810 webkit::ppapi::PluginDelegate::PlatformContext3D* | 810 webkit::ppapi::PluginDelegate::PlatformContext3D* |
811 PepperPluginDelegateImpl::CreateContext3D() { | 811 PepperPluginDelegateImpl::CreateContext3D() { |
812 #ifdef ENABLE_GPU | |
813 // If accelerated compositing of plugins is disabled, fail to create a 3D | 812 // If accelerated compositing of plugins is disabled, fail to create a 3D |
814 // context, because it won't be visible. This allows graceful fallback in the | 813 // context, because it won't be visible. This allows graceful fallback in the |
815 // modules. | 814 // modules. |
816 const WebPreferences& prefs = render_view_->webkit_preferences(); | 815 const WebPreferences& prefs = render_view_->webkit_preferences(); |
817 if (!prefs.accelerated_compositing_for_plugins_enabled) | 816 if (!prefs.accelerated_compositing_for_plugins_enabled) |
818 return NULL; | 817 return NULL; |
819 return new PlatformContext3DImpl; | 818 return new PlatformContext3DImpl; |
820 #else | |
821 return NULL; | |
822 #endif | |
823 } | |
824 | |
825 void PepperPluginDelegateImpl::ReparentContext( | |
826 webkit::ppapi::PluginDelegate::PlatformContext3D* context) { | |
827 static_cast<PlatformContext3DImpl*>(context)-> | |
828 SetParentAndCreateBackingTextureIfNeeded(); | |
829 } | 819 } |
830 | 820 |
831 webkit::ppapi::PluginDelegate::PlatformVideoCapture* | 821 webkit::ppapi::PluginDelegate::PlatformVideoCapture* |
832 PepperPluginDelegateImpl::CreateVideoCapture( | 822 PepperPluginDelegateImpl::CreateVideoCapture( |
833 const std::string& device_id, | 823 const std::string& device_id, |
834 PlatformVideoCaptureEventHandler* handler) { | 824 PlatformVideoCaptureEventHandler* handler) { |
835 return new PepperPlatformVideoCaptureImpl(AsWeakPtr(), device_id, handler); | 825 return new PepperPlatformVideoCaptureImpl(AsWeakPtr(), device_id, handler); |
836 } | 826 } |
837 | 827 |
838 webkit::ppapi::PluginDelegate::PlatformVideoDecoder* | 828 webkit::ppapi::PluginDelegate::PlatformVideoDecoder* |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 should_close_source); | 1676 should_close_source); |
1687 } | 1677 } |
1688 | 1678 |
1689 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { | 1679 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { |
1690 RendererPpapiHostImpl* host = | 1680 RendererPpapiHostImpl* host = |
1691 RendererPpapiHostImpl::GetForPPInstance(instance); | 1681 RendererPpapiHostImpl::GetForPPInstance(instance); |
1692 return host && host->IsRunningInProcess(); | 1682 return host && host->IsRunningInProcess(); |
1693 } | 1683 } |
1694 | 1684 |
1695 } // namespace content | 1685 } // namespace content |
OLD | NEW |