OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/npapi/np_channel_base.h" | 5 #include "content/child/npapi/np_channel_base.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 bool NPChannelBase::Init(base::MessageLoopProxy* ipc_message_loop, | 171 bool NPChannelBase::Init(base::MessageLoopProxy* ipc_message_loop, |
172 bool create_pipe_now, | 172 bool create_pipe_now, |
173 base::WaitableEvent* shutdown_event) { | 173 base::WaitableEvent* shutdown_event) { |
174 #if defined(OS_POSIX) | 174 #if defined(OS_POSIX) |
175 // Attempting to initialize with an invalid channel handle. | 175 // Attempting to initialize with an invalid channel handle. |
176 // See http://crbug.com/97285 for details. | 176 // See http://crbug.com/97285 for details. |
177 if (mode_ == IPC::Channel::MODE_CLIENT && -1 == channel_handle_.socket.fd) | 177 if (mode_ == IPC::Channel::MODE_CLIENT && -1 == channel_handle_.socket.fd) |
178 return false; | 178 return false; |
179 #endif | 179 #endif |
180 | 180 |
181 channel_.reset(new IPC::SyncChannel( | 181 channel_ = IPC::SyncChannel::Create( |
182 channel_handle_, mode_, this, ipc_message_loop, create_pipe_now, | 182 channel_handle_, mode_, this, ipc_message_loop, create_pipe_now, |
183 shutdown_event)); | 183 shutdown_event); |
184 | 184 |
185 #if defined(OS_POSIX) | 185 #if defined(OS_POSIX) |
186 // Check the validity of fd for bug investigation. Remove after fixed. | 186 // Check the validity of fd for bug investigation. Remove after fixed. |
187 // See crbug.com/97285 for details. | 187 // See crbug.com/97285 for details. |
188 if (mode_ == IPC::Channel::MODE_SERVER) | 188 if (mode_ == IPC::Channel::MODE_SERVER) |
189 CHECK_NE(-1, channel_->GetClientFileDescriptor()); | 189 CHECK_NE(-1, channel_->GetClientFileDescriptor()); |
190 #endif | 190 #endif |
191 | 191 |
192 channel_valid_ = true; | 192 channel_valid_ = true; |
193 return true; | 193 return true; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 RouteToOwnerMap::iterator iter = route_to_owner_.find(route_id); | 377 RouteToOwnerMap::iterator iter = route_to_owner_.find(route_id); |
378 return iter != route_to_owner_.end() ? iter->second : default_owner_; | 378 return iter != route_to_owner_.end() ? iter->second : default_owner_; |
379 } | 379 } |
380 | 380 |
381 int NPChannelBase::GetExistingRouteForNPObjectOwner(NPP owner) { | 381 int NPChannelBase::GetExistingRouteForNPObjectOwner(NPP owner) { |
382 OwnerToRouteMap::iterator iter = owner_to_route_.find(owner); | 382 OwnerToRouteMap::iterator iter = owner_to_route_.find(owner); |
383 return iter != owner_to_route_.end() ? iter->second : MSG_ROUTING_NONE; | 383 return iter != owner_to_route_.end() ? iter->second : MSG_ROUTING_NONE; |
384 } | 384 } |
385 | 385 |
386 } // namespace content | 386 } // namespace content |
OLD | NEW |