| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sync/driver/shared_change_processor.h" | 5 #include "components/sync/driver/shared_change_processor.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 EXPECT_TRUE(backend_thread_.task_runner()->PostTask( | 111 EXPECT_TRUE(backend_thread_.task_runner()->PostTask( |
| 112 FROM_HERE, | 112 FROM_HERE, |
| 113 base::Bind(&SyncSharedChangeProcessorTest::TearDownDBSyncableService, | 113 base::Bind(&SyncSharedChangeProcessorTest::TearDownDBSyncableService, |
| 114 base::Unretained(this)))); | 114 base::Unretained(this)))); |
| 115 // This must happen before the DB thread is stopped since | 115 // This must happen before the DB thread is stopped since |
| 116 // |shared_change_processor_| may post tasks to delete its members | 116 // |shared_change_processor_| may post tasks to delete its members |
| 117 // on the correct thread. | 117 // on the correct thread. |
| 118 // | 118 // |
| 119 // TODO(akalin): Write deterministic tests for the destruction of | 119 // TODO(akalin): Write deterministic tests for the destruction of |
| 120 // |shared_change_processor_| on the UI and DB threads. | 120 // |shared_change_processor_| on the UI and DB threads. |
| 121 shared_change_processor_ = NULL; | 121 shared_change_processor_ = nullptr; |
| 122 backend_thread_.Stop(); | 122 backend_thread_.Stop(); |
| 123 | 123 |
| 124 // Note: Stop() joins the threads, and that barrier prevents this read | 124 // Note: Stop() joins the threads, and that barrier prevents this read |
| 125 // from being moved (e.g by compiler optimization) in such a way that it | 125 // from being moved (e.g by compiler optimization) in such a way that it |
| 126 // would race with the write in ConnectOnDBThread (because by this time, | 126 // would race with the write in ConnectOnDBThread (because by this time, |
| 127 // everything that could have run on |backend_thread_| has done so). | 127 // everything that could have run on |backend_thread_| has done so). |
| 128 ASSERT_TRUE(did_connect_); | 128 ASSERT_TRUE(did_connect_); |
| 129 test_user_share_.TearDown(); | 129 test_user_share_.TearDown(); |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // creates AttachmentService and passes it back to the syncable service. | 224 // creates AttachmentService and passes it back to the syncable service. |
| 225 TEST_F(SyncSharedChangeProcessorTest, ConnectWithAttachmentStore) { | 225 TEST_F(SyncSharedChangeProcessorTest, ConnectWithAttachmentStore) { |
| 226 SetAttachmentStore(); | 226 SetAttachmentStore(); |
| 227 Connect(); | 227 Connect(); |
| 228 EXPECT_TRUE(HasAttachmentService()); | 228 EXPECT_TRUE(HasAttachmentService()); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace | 231 } // namespace |
| 232 | 232 |
| 233 } // namespace syncer | 233 } // namespace syncer |
| OLD | NEW |