| 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/host_dispatcher_wrapper.h" | 5 #include "content/renderer/pepper/host_dispatcher_wrapper.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "content/common/frame_messages.h" | 8 #include "content/common/frame_messages.h" |
| 9 #include "content/public/common/origin_util.h" | 9 #include "content/public/common/origin_util.h" |
| 10 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" | 10 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 plugin_child_id_(plugin_child_id), | 30 plugin_child_id_(plugin_child_id), |
| 31 permissions_(perms), | 31 permissions_(perms), |
| 32 is_external_(is_external) {} | 32 is_external_(is_external) {} |
| 33 | 33 |
| 34 HostDispatcherWrapper::~HostDispatcherWrapper() {} | 34 HostDispatcherWrapper::~HostDispatcherWrapper() {} |
| 35 | 35 |
| 36 bool HostDispatcherWrapper::Init(const IPC::ChannelHandle& channel_handle, | 36 bool HostDispatcherWrapper::Init(const IPC::ChannelHandle& channel_handle, |
| 37 PP_GetInterface_Func local_get_interface, | 37 PP_GetInterface_Func local_get_interface, |
| 38 const ppapi::Preferences& preferences, | 38 const ppapi::Preferences& preferences, |
| 39 scoped_refptr<PepperHungPluginFilter> filter) { | 39 scoped_refptr<PepperHungPluginFilter> filter) { |
| 40 if (channel_handle.name.empty()) | 40 DCHECK(channel_handle.mojo_handle.is_valid()); |
| 41 if (!channel_handle.mojo_handle.is_valid()) |
| 41 return false; | 42 return false; |
| 42 | 43 |
| 43 #if defined(OS_POSIX) | |
| 44 DCHECK(channel_handle.socket.fd != -1 || | |
| 45 channel_handle.mojo_handle.is_valid()); | |
| 46 if (channel_handle.socket.fd == -1 && !channel_handle.mojo_handle.is_valid()) | |
| 47 return false; | |
| 48 #endif | |
| 49 | |
| 50 dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); | 44 dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); |
| 51 dispatcher_.reset(new ppapi::proxy::HostDispatcher( | 45 dispatcher_.reset(new ppapi::proxy::HostDispatcher( |
| 52 module_->pp_module(), local_get_interface, permissions_)); | 46 module_->pp_module(), local_get_interface, permissions_)); |
| 53 // The HungPluginFilter needs to know when we are blocked on a sync message | 47 // The HungPluginFilter needs to know when we are blocked on a sync message |
| 54 // to the plugin. Note the filter outlives the dispatcher, so there is no | 48 // to the plugin. Note the filter outlives the dispatcher, so there is no |
| 55 // need to remove it as an observer. | 49 // need to remove it as an observer. |
| 56 dispatcher_->AddSyncMessageStatusObserver(filter.get()); | 50 dispatcher_->AddSyncMessageStatusObserver(filter.get()); |
| 57 // Guarantee the hung_plugin_filter_ outlives |dispatcher_|. | 51 // Guarantee the hung_plugin_filter_ outlives |dispatcher_|. |
| 58 hung_plugin_filter_ = filter; | 52 hung_plugin_filter_ = filter; |
| 59 | 53 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (host) { | 109 if (host) { |
| 116 RenderFrame* render_frame = host->GetRenderFrameForInstance(instance); | 110 RenderFrame* render_frame = host->GetRenderFrameForInstance(instance); |
| 117 if (render_frame) { | 111 if (render_frame) { |
| 118 render_frame->Send(new FrameHostMsg_DidDeleteOutOfProcessPepperInstance( | 112 render_frame->Send(new FrameHostMsg_DidDeleteOutOfProcessPepperInstance( |
| 119 plugin_child_id_, instance, is_external_)); | 113 plugin_child_id_, instance, is_external_)); |
| 120 } | 114 } |
| 121 } | 115 } |
| 122 } | 116 } |
| 123 | 117 |
| 124 } // namespace content | 118 } // namespace content |
| OLD | NEW |