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::MessageLoopProxy* ipc_message_loop) { | 63 base::SingleThreadTaskRunner* ipc_task_runner) { |
64 PluginChannelHost* result = | 64 PluginChannelHost* result = |
65 static_cast<PluginChannelHost*>(NPChannelBase::GetChannel( | 65 static_cast<PluginChannelHost*>(NPChannelBase::GetChannel( |
66 channel_handle, | 66 channel_handle, IPC::Channel::MODE_CLIENT, ClassFactory, |
67 IPC::Channel::MODE_CLIENT, | 67 ipc_task_runner, true, ChildProcess::current()->GetShutDownEvent())); |
68 ClassFactory, | |
69 ipc_message_loop, | |
70 true, | |
71 ChildProcess::current()->GetShutDownEvent())); | |
72 return result; | 68 return result; |
73 } | 69 } |
74 | 70 |
75 PluginChannelHost::PluginChannelHost() : expecting_shutdown_(false) { | 71 PluginChannelHost::PluginChannelHost() : expecting_shutdown_(false) { |
76 } | 72 } |
77 | 73 |
78 PluginChannelHost::~PluginChannelHost() { | 74 PluginChannelHost::~PluginChannelHost() { |
79 } | 75 } |
80 | 76 |
81 bool PluginChannelHost::Init(base::MessageLoopProxy* ipc_message_loop, | 77 bool PluginChannelHost::Init(base::SingleThreadTaskRunner* ipc_task_runner, |
82 bool create_pipe_now, | 78 bool create_pipe_now, |
83 base::WaitableEvent* shutdown_event) { | 79 base::WaitableEvent* shutdown_event) { |
84 return NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event); | 80 return NPChannelBase::Init(ipc_task_runner, create_pipe_now, shutdown_event); |
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 |