| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/files/file_util_proxy.h" | 16 #include "base/files/file_util_proxy.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/sync_socket.h" | 19 #include "base/sync_socket.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "content/common/child_process.h" | 21 #include "content/common/child_process.h" |
| 22 #include "content/common/child_process_messages.h" | 22 #include "content/common/child_process_messages.h" |
| 23 #include "content/common/child_thread.h" | 23 #include "content/common/child_thread.h" |
| 24 #include "content/common/fileapi/file_system_dispatcher.h" | 24 #include "content/common/fileapi/file_system_dispatcher.h" |
| 25 #include "content/common/fileapi/file_system_messages.h" | 25 #include "content/common/fileapi/file_system_messages.h" |
| 26 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 27 #include "content/common/pepper_messages.h" | 28 #include "content/common/pepper_messages.h" |
| 28 #include "content/common/pepper_plugin_registry.h" | 29 #include "content/common/pepper_plugin_registry.h" |
| 29 #include "content/common/quota_dispatcher.h" | 30 #include "content/common/quota_dispatcher.h" |
| 30 #include "content/common/view_messages.h" | 31 #include "content/common/view_messages.h" |
| 31 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 32 #include "content/public/common/context_menu_params.h" | 33 #include "content/public/common/context_menu_params.h" |
| 33 #include "content/public/common/media_stream_request.h" | 34 #include "content/public/common/media_stream_request.h" |
| 34 #include "content/public/common/referrer.h" | 35 #include "content/public/common/referrer.h" |
| 35 #include "content/public/renderer/content_renderer_client.h" | 36 #include "content/public/renderer/content_renderer_client.h" |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 NOTREACHED(); | 1568 NOTREACHED(); |
| 1568 return 0; | 1569 return 0; |
| 1569 } | 1570 } |
| 1570 #else | 1571 #else |
| 1571 return 0; | 1572 return 0; |
| 1572 #endif | 1573 #endif |
| 1573 } | 1574 } |
| 1574 | 1575 |
| 1575 WebGraphicsContext3DCommandBufferImpl* | 1576 WebGraphicsContext3DCommandBufferImpl* |
| 1576 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { | 1577 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { |
| 1577 WebGraphicsContext3DCommandBufferImpl* context = | 1578 if (!offscreen_context3d_ || offscreen_context3d_->DestroyedOnMainThread()) { |
| 1578 static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 1579 offscreen_context3d_ = |
| 1579 render_view_->webview()->sharedGraphicsContext3D()); | 1580 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 1580 if (!context) | |
| 1581 return NULL; | |
| 1582 if (!context->makeContextCurrent() || context->isContextLost()) | |
| 1583 return NULL; | |
| 1584 | 1581 |
| 1585 return context; | 1582 if (!offscreen_context3d_->InitializeOnMainThread() || |
| 1583 !offscreen_context3d_->BindToCurrentThread()) { |
| 1584 offscreen_context3d_ = NULL; |
| 1585 return NULL; |
| 1586 } |
| 1587 } |
| 1588 return offscreen_context3d_->Context3d(); |
| 1586 } | 1589 } |
| 1587 | 1590 |
| 1588 MouseLockDispatcher::LockTarget* | 1591 MouseLockDispatcher::LockTarget* |
| 1589 PepperPluginDelegateImpl::GetOrCreateLockTargetAdapter( | 1592 PepperPluginDelegateImpl::GetOrCreateLockTargetAdapter( |
| 1590 webkit::ppapi::PluginInstance* instance) { | 1593 webkit::ppapi::PluginInstance* instance) { |
| 1591 MouseLockDispatcher::LockTarget* target = mouse_lock_instances_[instance]; | 1594 MouseLockDispatcher::LockTarget* target = mouse_lock_instances_[instance]; |
| 1592 if (target) | 1595 if (target) |
| 1593 return target; | 1596 return target; |
| 1594 | 1597 |
| 1595 return mouse_lock_instances_[instance] = | 1598 return mouse_lock_instances_[instance] = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1613 RenderWidgetFullscreenPepper* container = | 1616 RenderWidgetFullscreenPepper* container = |
| 1614 static_cast<RenderWidgetFullscreenPepper*>( | 1617 static_cast<RenderWidgetFullscreenPepper*>( |
| 1615 instance->fullscreen_container()); | 1618 instance->fullscreen_container()); |
| 1616 return container->mouse_lock_dispatcher(); | 1619 return container->mouse_lock_dispatcher(); |
| 1617 } else { | 1620 } else { |
| 1618 return render_view_->mouse_lock_dispatcher(); | 1621 return render_view_->mouse_lock_dispatcher(); |
| 1619 } | 1622 } |
| 1620 } | 1623 } |
| 1621 | 1624 |
| 1622 } // namespace content | 1625 } // namespace content |
| OLD | NEW |