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(this, ipc_message_loop, shutdown_event); |
jam
2014/06/03 17:30:41
why not use the Create method with 6 parameters as
Hajime Morrita
2014/06/03 18:01:59
Done.
| |
182 channel_handle_, mode_, this, ipc_message_loop, create_pipe_now, | 182 channel_->Init(channel_handle_, mode_, create_pipe_now); |
183 shutdown_event)); | |
184 | 183 |
185 #if defined(OS_POSIX) | 184 #if defined(OS_POSIX) |
186 // Check the validity of fd for bug investigation. Remove after fixed. | 185 // Check the validity of fd for bug investigation. Remove after fixed. |
187 // See crbug.com/97285 for details. | 186 // See crbug.com/97285 for details. |
188 if (mode_ == IPC::Channel::MODE_SERVER) | 187 if (mode_ == IPC::Channel::MODE_SERVER) |
189 CHECK_NE(-1, channel_->GetClientFileDescriptor()); | 188 CHECK_NE(-1, channel_->GetClientFileDescriptor()); |
190 #endif | 189 #endif |
191 | 190 |
192 channel_valid_ = true; | 191 channel_valid_ = true; |
193 return true; | 192 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); | 376 RouteToOwnerMap::iterator iter = route_to_owner_.find(route_id); |
378 return iter != route_to_owner_.end() ? iter->second : default_owner_; | 377 return iter != route_to_owner_.end() ? iter->second : default_owner_; |
379 } | 378 } |
380 | 379 |
381 int NPChannelBase::GetExistingRouteForNPObjectOwner(NPP owner) { | 380 int NPChannelBase::GetExistingRouteForNPObjectOwner(NPP owner) { |
382 OwnerToRouteMap::iterator iter = owner_to_route_.find(owner); | 381 OwnerToRouteMap::iterator iter = owner_to_route_.find(owner); |
383 return iter != owner_to_route_.end() ? iter->second : MSG_ROUTING_NONE; | 382 return iter != owner_to_route_.end() ? iter->second : MSG_ROUTING_NONE; |
384 } | 383 } |
385 | 384 |
386 } // namespace content | 385 } // namespace content |
OLD | NEW |