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

Unified Diff: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc

Issue 2608783003: Fix ThreadSafeAssociatedInterfacePtrProvider raciness. (Closed)
Patch Set: Created 4 years 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
Index: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
index a32c969992c1ca76de7491f77294e7128ce06c2b..4849c617bcec4588e7bcd754937b0caa3ab673b0 100644
--- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -854,16 +854,17 @@ TEST_F(InterfacePtrTest, ThreadSafeInterfacePointer) {
}
TEST_F(InterfacePtrTest, BindLaterThreadSafeInterfacePointer) {
- // Create a ThreadSafeInterfacePtr that we'll bind from a different thread.
- scoped_refptr<math::ThreadSafeCalculatorPtr> thread_safe_ptr =
- math::ThreadSafeCalculatorPtr::CreateUnbound();
- ASSERT_TRUE(thread_safe_ptr);
-
// Create and start the thread from where we'll bind the interface pointer.
base::Thread other_thread("service test thread");
other_thread.Start();
const scoped_refptr<base::SingleThreadTaskRunner>& other_thread_task_runner =
other_thread.message_loop()->task_runner();
+
+ // Create a ThreadSafeInterfacePtr that we'll bind from a different thread.
+ scoped_refptr<math::ThreadSafeCalculatorPtr> thread_safe_ptr =
+ math::ThreadSafeCalculatorPtr::CreateUnbound(other_thread_task_runner);
+ ASSERT_TRUE(thread_safe_ptr);
+
MathCalculatorImpl* math_calc_impl = nullptr;
{
base::RunLoop run_loop;

Powered by Google App Engine
This is Rietveld 408576698