OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/renderer_host/java/java_bridge_channel_host.h" | 5 #include "content/browser/renderer_host/java/java_bridge_channel_host.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #if defined(OS_POSIX) | 32 #if defined(OS_POSIX) |
33 if (channel_handle_.socket.fd > 0) { | 33 if (channel_handle_.socket.fd > 0) { |
34 close(channel_handle_.socket.fd); | 34 close(channel_handle_.socket.fd); |
35 } | 35 } |
36 #endif | 36 #endif |
37 } | 37 } |
38 | 38 |
39 JavaBridgeChannelHost* JavaBridgeChannelHost::GetJavaBridgeChannelHost( | 39 JavaBridgeChannelHost* JavaBridgeChannelHost::GetJavaBridgeChannelHost( |
40 int renderer_id, | 40 int renderer_id, |
41 base::MessageLoopProxy* ipc_message_loop) { | 41 base::MessageLoopProxy* ipc_message_loop) { |
42 std::string channel_name(StringPrintf("r%d.javabridge", renderer_id)); | 42 std::string channel_name(base::StringPrintf("r%d.javabridge", renderer_id)); |
43 // There's no need for a shutdown event here. If the browser is terminated | 43 // There's no need for a shutdown event here. If the browser is terminated |
44 // while the JavaBridgeChannelHost is blocked on a synchronous IPC call, the | 44 // while the JavaBridgeChannelHost is blocked on a synchronous IPC call, the |
45 // renderer's shutdown event will cause the underlying channel to shut down, | 45 // renderer's shutdown event will cause the underlying channel to shut down, |
46 // thus terminating the IPC call. | 46 // thus terminating the IPC call. |
47 return static_cast<JavaBridgeChannelHost*>(NPChannelBase::GetChannel( | 47 return static_cast<JavaBridgeChannelHost*>(NPChannelBase::GetChannel( |
48 channel_name, | 48 channel_name, |
49 IPC::Channel::MODE_SERVER, | 49 IPC::Channel::MODE_SERVER, |
50 ClassFactory, | 50 ClassFactory, |
51 ipc_message_loop, | 51 ipc_message_loop, |
52 true, | 52 true, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 IPC_MESSAGE_HANDLER(JavaBridgeMsg_GenerateRouteID, OnGenerateRouteID) | 86 IPC_MESSAGE_HANDLER(JavaBridgeMsg_GenerateRouteID, OnGenerateRouteID) |
87 IPC_END_MESSAGE_MAP() | 87 IPC_END_MESSAGE_MAP() |
88 return handled; | 88 return handled; |
89 } | 89 } |
90 | 90 |
91 void JavaBridgeChannelHost::OnGenerateRouteID(int* route_id) { | 91 void JavaBridgeChannelHost::OnGenerateRouteID(int* route_id) { |
92 *route_id = GenerateRouteID(); | 92 *route_id = GenerateRouteID(); |
93 } | 93 } |
94 | 94 |
95 } // namespace content | 95 } // namespace content |
OLD | NEW |