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

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 12673002: pepper: Use the RenderThread's shared context as the parent context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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
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(
842 webkit::ppapi::PluginDelegate::PlatformContext3D* context) {
843 static_cast<PlatformContext3DImpl*>(context)->SetParentContext(this);
844 }
845
846 webkit::ppapi::PluginDelegate::PlatformVideoCapture* 841 webkit::ppapi::PluginDelegate::PlatformVideoCapture*
847 PepperPluginDelegateImpl::CreateVideoCapture( 842 PepperPluginDelegateImpl::CreateVideoCapture(
848 const std::string& device_id, 843 const std::string& device_id,
849 PlatformVideoCaptureEventHandler* handler) { 844 PlatformVideoCaptureEventHandler* handler) {
850 return new PepperPlatformVideoCaptureImpl(AsWeakPtr(), device_id, handler); 845 return new PepperPlatformVideoCaptureImpl(AsWeakPtr(), device_id, handler);
851 } 846 }
852 847
853 webkit::ppapi::PluginDelegate::PlatformVideoDecoder* 848 webkit::ppapi::PluginDelegate::PlatformVideoDecoder*
854 PepperPluginDelegateImpl::CreateVideoDecoder( 849 PepperPluginDelegateImpl::CreateVideoDecoder(
855 media::VideoDecodeAccelerator::Client* client, 850 media::VideoDecodeAccelerator::Client* client,
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 0); 1561 0);
1567 default: 1562 default:
1568 NOTREACHED(); 1563 NOTREACHED();
1569 return 0; 1564 return 0;
1570 } 1565 }
1571 #else 1566 #else
1572 return 0; 1567 return 0;
1573 #endif 1568 #endif
1574 } 1569 }
1575 1570
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* 1571 MouseLockDispatcher::LockTarget*
1592 PepperPluginDelegateImpl::GetOrCreateLockTargetAdapter( 1572 PepperPluginDelegateImpl::GetOrCreateLockTargetAdapter(
1593 webkit::ppapi::PluginInstance* instance) { 1573 webkit::ppapi::PluginInstance* instance) {
1594 MouseLockDispatcher::LockTarget* target = mouse_lock_instances_[instance]; 1574 MouseLockDispatcher::LockTarget* target = mouse_lock_instances_[instance];
1595 if (target) 1575 if (target)
1596 return target; 1576 return target;
1597 1577
1598 return mouse_lock_instances_[instance] = 1578 return mouse_lock_instances_[instance] =
1599 new PluginInstanceLockTarget(instance); 1579 new PluginInstanceLockTarget(instance);
1600 } 1580 }
(...skipping 15 matching lines...) Expand all
1616 RenderWidgetFullscreenPepper* container = 1596 RenderWidgetFullscreenPepper* container =
1617 static_cast<RenderWidgetFullscreenPepper*>( 1597 static_cast<RenderWidgetFullscreenPepper*>(
1618 instance->fullscreen_container()); 1598 instance->fullscreen_container());
1619 return container->mouse_lock_dispatcher(); 1599 return container->mouse_lock_dispatcher();
1620 } else { 1600 } else {
1621 return render_view_->mouse_lock_dispatcher(); 1601 return render_view_->mouse_lock_dispatcher();
1622 } 1602 }
1623 } 1603 }
1624 1604
1625 } // namespace content 1605 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698