| OLD | NEW |
| 1 // Copyright (c) 2011 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/common/np_channel_base.h" | 5 #include "content/common/np_channel_base.h" |
| 6 | 6 |
| 7 #include <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "ipc/ipc_sync_message.h" | 13 #include "ipc/ipc_sync_message.h" |
| 14 | 14 |
| 15 #if defined(OS_POSIX) | 15 #if defined(OS_POSIX) |
| 16 #include "ipc/ipc_channel_posix.h" | 16 #include "ipc/ipc_channel_posix.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 typedef base::hash_map<std::string, scoped_refptr<NPChannelBase> > ChannelMap; | 19 typedef base::hash_map<std::string, scoped_refptr<NPChannelBase> > ChannelMap; |
| 20 static base::LazyInstance<ChannelMap, | 20 static base::LazyInstance<ChannelMap>::Leaky |
| 21 base::LeakyLazyInstanceTraits<ChannelMap> > | |
| 22 g_channels = LAZY_INSTANCE_INITIALIZER; | 21 g_channels = LAZY_INSTANCE_INITIALIZER; |
| 23 | 22 |
| 24 typedef std::stack<scoped_refptr<NPChannelBase> > NPChannelRefStack; | 23 typedef std::stack<scoped_refptr<NPChannelBase> > NPChannelRefStack; |
| 25 static base::LazyInstance<NPChannelRefStack, | 24 static base::LazyInstance<NPChannelRefStack>::Leaky |
| 26 base::LeakyLazyInstanceTraits<NPChannelRefStack> > | |
| 27 g_lazy_channel_stack = LAZY_INSTANCE_INITIALIZER; | 25 g_lazy_channel_stack = LAZY_INSTANCE_INITIALIZER; |
| 28 | 26 |
| 29 static int next_pipe_id = 0; | 27 static int next_pipe_id = 0; |
| 30 | 28 |
| 31 NPChannelBase* NPChannelBase::GetChannel( | 29 NPChannelBase* NPChannelBase::GetChannel( |
| 32 const IPC::ChannelHandle& channel_handle, IPC::Channel::Mode mode, | 30 const IPC::ChannelHandle& channel_handle, IPC::Channel::Mode mode, |
| 33 ChannelFactory factory, base::MessageLoopProxy* ipc_message_loop, | 31 ChannelFactory factory, base::MessageLoopProxy* ipc_message_loop, |
| 34 bool create_pipe_now, base::WaitableEvent* shutdown_event) { | 32 bool create_pipe_now, base::WaitableEvent* shutdown_event) { |
| 35 scoped_refptr<NPChannelBase> channel; | 33 scoped_refptr<NPChannelBase> channel; |
| 36 std::string channel_key = channel_handle.name; | 34 std::string channel_key = channel_handle.name; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 283 |
| 286 void NPChannelBase::RemoveMappingForNPObjectStub(int route_id, | 284 void NPChannelBase::RemoveMappingForNPObjectStub(int route_id, |
| 287 NPObject* object) { | 285 NPObject* object) { |
| 288 DCHECK(object != NULL); | 286 DCHECK(object != NULL); |
| 289 stub_map_.erase(object); | 287 stub_map_.erase(object); |
| 290 } | 288 } |
| 291 | 289 |
| 292 void NPChannelBase::RemoveMappingForNPObjectProxy(int route_id) { | 290 void NPChannelBase::RemoveMappingForNPObjectProxy(int route_id) { |
| 293 proxy_map_.erase(route_id); | 291 proxy_map_.erase(route_id); |
| 294 } | 292 } |
| OLD | NEW |