| OLD | NEW |
| 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 #include <stack> | 10 #include <stack> |
| 11 | 11 |
| 12 #include "base/atomic_sequence_num.h" | 12 #include "base/atomic_sequence_num.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
| 16 #include "ipc/ipc_sync_message.h" | 16 #include "ipc/ipc_sync_message.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 struct WaitableEventLazyInstanceTraits | 20 struct WaitableEventLazyInstanceTraits |
| 21 : public base::DefaultLazyInstanceTraits<base::WaitableEvent> { | 21 : public base::DefaultLazyInstanceTraits<base::WaitableEvent> { |
| 22 static base::WaitableEvent* New(void* instance) { | 22 static base::WaitableEvent* New(void* instance) { |
| 23 // Use placement new to initialize our instance in our preallocated space. | 23 // Use placement new to initialize our instance in our preallocated space. |
| 24 return new (instance) base::WaitableEvent(true, true); | 24 return new (instance) base::WaitableEvent(true, true); |
| 25 } | 25 } |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 static base::LazyInstance<base::WaitableEvent, WaitableEventLazyInstanceTraits> | 28 base::LazyInstance<base::WaitableEvent, WaitableEventLazyInstanceTraits> |
| 29 dummy_event = LAZY_INSTANCE_INITIALIZER; | 29 dummy_event = LAZY_INSTANCE_INITIALIZER; |
| 30 | 30 |
| 31 } | 31 base::StaticAtomicSequenceNumber g_next_id; |
| 32 |
| 33 } // namespace |
| 32 | 34 |
| 33 namespace IPC { | 35 namespace IPC { |
| 34 | 36 |
| 35 #define kSyncMessageHeaderSize 4 | 37 #define kSyncMessageHeaderSize 4 |
| 36 | 38 |
| 37 static base::AtomicSequenceNumber g_next_id(base::LINKER_INITIALIZED); | |
| 38 | |
| 39 SyncMessage::SyncMessage( | 39 SyncMessage::SyncMessage( |
| 40 int32 routing_id, | 40 int32 routing_id, |
| 41 uint32 type, | 41 uint32 type, |
| 42 PriorityValue priority, | 42 PriorityValue priority, |
| 43 MessageReplyDeserializer* deserializer) | 43 MessageReplyDeserializer* deserializer) |
| 44 : Message(routing_id, type, priority), | 44 : Message(routing_id, type, priority), |
| 45 deserializer_(deserializer), | 45 deserializer_(deserializer), |
| 46 pump_messages_event_(NULL) | 46 pump_messages_event_(NULL) |
| 47 { | 47 { |
| 48 set_sync(); | 48 set_sync(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 return true; | 135 return true; |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 bool MessageReplyDeserializer::SerializeOutputParameters(const Message& msg) { | 139 bool MessageReplyDeserializer::SerializeOutputParameters(const Message& msg) { |
| 140 return SerializeOutputParameters(msg, SyncMessage::GetDataIterator(&msg)); | 140 return SerializeOutputParameters(msg, SyncMessage::GetDataIterator(&msg)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace IPC | 143 } // namespace IPC |
| OLD | NEW |