Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: ipc/ipc_sync_message.cc

Issue 1601005: Allow synchronous messages to be sent from threads other than the main thread... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_sync_message.h ('k') | ipc/ipc_sync_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_message.cc
===================================================================
--- ipc/ipc_sync_message.cc (revision 43588)
+++ ipc/ipc_sync_message.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,17 +9,19 @@
#endif
#include <stack>
+#include "base/atomic_sequence_num.h"
#include "base/logging.h"
#include "base/waitable_event.h"
#include "ipc/ipc_sync_message.h"
namespace IPC {
-uint32 SyncMessage::next_id_ = 0;
#define kSyncMessageHeaderSize 4
-base::WaitableEvent* dummy_event = new base::WaitableEvent(true, true);
+static base::AtomicSequenceNumber g_next_id(base::LINKER_INITIALIZED);
+static base::WaitableEvent* dummy_event = new base::WaitableEvent(true, true);
+
SyncMessage::SyncMessage(
int32 routing_id,
uint32 type,
@@ -34,7 +36,7 @@
// Add synchronous message data before the message payload.
SyncHeader header;
- header.message_id = ++next_id_;
+ header.message_id = g_next_id.GetNext();
WriteSyncHeader(this, header);
}
« no previous file with comments | « ipc/ipc_sync_message.h ('k') | ipc/ipc_sync_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698