| 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/npapi/plugin_channel_host.h" | 5 #include "content/renderer/npapi/plugin_channel_host.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/child/child_process.h" | 9 #include "content/child/child_process.h" |
| 10 #include "content/child/npapi/npobject_base.h" | 10 #include "content/child/npapi/npobject_base.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
| 54 // static | 54 // static |
| 55 bool* PluginChannelHost::GetRemoveTrackingFlag() { | 55 bool* PluginChannelHost::GetRemoveTrackingFlag() { |
| 56 return &remove_tracking; | 56 return &remove_tracking; |
| 57 } | 57 } |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 // static | 60 // static |
| 61 PluginChannelHost* PluginChannelHost::GetPluginChannelHost( | 61 PluginChannelHost* PluginChannelHost::GetPluginChannelHost( |
| 62 const IPC::ChannelHandle& channel_handle, | 62 const IPC::ChannelHandle& channel_handle, |
| 63 base::SingleThreadTaskRunner* ipc_task_runner, | 63 base::SingleThreadTaskRunner* ipc_task_runner) { |
| 64 IPC::AttachmentBroker* broker) { | |
| 65 PluginChannelHost* result = | 64 PluginChannelHost* result = |
| 66 static_cast<PluginChannelHost*>(NPChannelBase::GetChannel( | 65 static_cast<PluginChannelHost*>(NPChannelBase::GetChannel( |
| 67 channel_handle, IPC::Channel::MODE_CLIENT, ClassFactory, | 66 channel_handle, IPC::Channel::MODE_CLIENT, ClassFactory, |
| 68 ipc_task_runner, true, ChildProcess::current()->GetShutDownEvent(), | 67 ipc_task_runner, true, ChildProcess::current()->GetShutDownEvent())); |
| 69 broker)); | |
| 70 return result; | 68 return result; |
| 71 } | 69 } |
| 72 | 70 |
| 73 PluginChannelHost::PluginChannelHost() : expecting_shutdown_(false) { | 71 PluginChannelHost::PluginChannelHost() : expecting_shutdown_(false) { |
| 74 } | 72 } |
| 75 | 73 |
| 76 PluginChannelHost::~PluginChannelHost() { | 74 PluginChannelHost::~PluginChannelHost() { |
| 77 } | 75 } |
| 78 | 76 |
| 79 bool PluginChannelHost::Init(base::SingleThreadTaskRunner* ipc_task_runner, | 77 bool PluginChannelHost::Init(base::SingleThreadTaskRunner* ipc_task_runner, |
| 80 bool create_pipe_now, | 78 bool create_pipe_now, |
| 81 base::WaitableEvent* shutdown_event, | 79 base::WaitableEvent* shutdown_event) { |
| 82 IPC::AttachmentBroker* broker) { | 80 return NPChannelBase::Init(ipc_task_runner, create_pipe_now, shutdown_event); |
| 83 return NPChannelBase::Init(ipc_task_runner, create_pipe_now, shutdown_event, | |
| 84 broker); | |
| 85 } | 81 } |
| 86 | 82 |
| 87 int PluginChannelHost::GenerateRouteID() { | 83 int PluginChannelHost::GenerateRouteID() { |
| 88 int route_id = MSG_ROUTING_NONE; | 84 int route_id = MSG_ROUTING_NONE; |
| 89 Send(new PluginMsg_GenerateRouteID(&route_id)); | 85 Send(new PluginMsg_GenerateRouteID(&route_id)); |
| 90 | 86 |
| 91 return route_id; | 87 return route_id; |
| 92 } | 88 } |
| 93 | 89 |
| 94 void PluginChannelHost::AddRoute(int route_id, | 90 void PluginChannelHost::AddRoute(int route_id, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 156 |
| 161 for (ProxyMap::iterator iter = proxies_.begin(); | 157 for (ProxyMap::iterator iter = proxies_.begin(); |
| 162 iter != proxies_.end(); iter++) { | 158 iter != proxies_.end(); iter++) { |
| 163 iter->second->OnChannelError(); | 159 iter->second->OnChannelError(); |
| 164 } | 160 } |
| 165 | 161 |
| 166 proxies_.clear(); | 162 proxies_.clear(); |
| 167 } | 163 } |
| 168 | 164 |
| 169 } // namespace content | 165 } // namespace content |
| OLD | NEW |