From 13f383ff5fc8ff095501794d4ce758f0067ff9b5 Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Mon, 28 Sep 2009 18:12:55 +0000 Subject: Assert that thread-safe reference counting is used with cross-thread NewRunnableMethod. This assertion caught such an error in VisitedLinkMaster! My approach, modify RunnableMethodTraits to assert that when ReleaseCallee happens on a different thread from RetainCallee that the type supports thread-safe reference counting. I do this by adding a static method to both RefCounted and RefCountedThreadSafe. This results in a little ugliness in cases where people implement AddRef and Release by hand (to make the no-ops). There may be a nicer way to deal with those few cases. R=brettw BUG=none TEST=none Review URL: http://codereview.chromium.org/251012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27379 0039d316-1c4b-4281-b951-d872f2087c98 --- ipc/ipc_sync_channel_unittest.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'ipc/ipc_sync_channel_unittest.cc') diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index f20f788..f6bf10e 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -66,6 +66,7 @@ class Worker : public Channel::Listener, public Message::Sender { } void AddRef() { } void Release() { } + static bool ImplementsThreadSafeReferenceCounting() { return true; } bool Send(Message* msg) { return channel_->Send(msg); } bool SendWithTimeout(Message* msg, int timeout_ms) { return channel_->SendWithTimeout(msg, timeout_ms); -- cgit v1.1