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" |
11 #include "content/common/java_bridge_messages.h" | 11 #include "content/common/java_bridge_messages.h" |
12 | 12 |
13 using base::WaitableEvent; | 13 using base::WaitableEvent; |
14 | 14 |
| 15 namespace content { |
15 namespace { | 16 namespace { |
16 struct WaitableEventLazyInstanceTraits | 17 struct WaitableEventLazyInstanceTraits |
17 : public base::DefaultLazyInstanceTraits<WaitableEvent> { | 18 : public base::DefaultLazyInstanceTraits<WaitableEvent> { |
18 static WaitableEvent* New(void* instance) { | 19 static WaitableEvent* New(void* instance) { |
19 // Use placement new to initialize our instance in our preallocated space. | 20 // Use placement new to initialize our instance in our preallocated space. |
20 // The parenthesis is very important here to force POD type initialization. | 21 // The parenthesis is very important here to force POD type initialization. |
21 return new (instance) WaitableEvent(false, false); | 22 return new (instance) WaitableEvent(false, false); |
22 } | 23 } |
23 }; | 24 }; |
24 base::LazyInstance<WaitableEvent, WaitableEventLazyInstanceTraits> dummy_event = | 25 base::LazyInstance<WaitableEvent, WaitableEventLazyInstanceTraits> dummy_event = |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 bool handled = true; | 74 bool handled = true; |
74 IPC_BEGIN_MESSAGE_MAP(JavaBridgeChannelHost, message) | 75 IPC_BEGIN_MESSAGE_MAP(JavaBridgeChannelHost, message) |
75 IPC_MESSAGE_HANDLER(JavaBridgeMsg_GenerateRouteID, OnGenerateRouteID) | 76 IPC_MESSAGE_HANDLER(JavaBridgeMsg_GenerateRouteID, OnGenerateRouteID) |
76 IPC_END_MESSAGE_MAP() | 77 IPC_END_MESSAGE_MAP() |
77 return handled; | 78 return handled; |
78 } | 79 } |
79 | 80 |
80 void JavaBridgeChannelHost::OnGenerateRouteID(int* route_id) { | 81 void JavaBridgeChannelHost::OnGenerateRouteID(int* route_id) { |
81 *route_id = GenerateRouteID(); | 82 *route_id = GenerateRouteID(); |
82 } | 83 } |
| 84 |
| 85 } // namespace content |
OLD | NEW |