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 "components/sync_driver/glue/ui_model_worker.h" |
| 6 |
5 #include "base/bind.h" | 7 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
7 #include "base/callback.h" | 9 #include "base/callback.h" |
8 #include "base/location.h" | 10 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
11 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
12 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
13 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
14 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
15 #include "components/sync_driver/glue/ui_model_worker.h" | |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using browser_sync::UIModelWorker; | 19 using browser_sync::UIModelWorker; |
19 using syncer::SyncerError; | 20 using syncer::SyncerError; |
20 | 21 |
21 class UIModelWorkerVisitor { | 22 class UIModelWorkerVisitor { |
22 public: | 23 public: |
23 UIModelWorkerVisitor(base::WaitableEvent* was_run, | 24 UIModelWorkerVisitor(base::WaitableEvent* was_run, |
24 bool quit_loop) | 25 bool quit_loop) |
25 : quit_loop_when_run_(quit_loop), | 26 : quit_loop_when_run_(quit_loop), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 87 |
87 syncer_thread()->task_runner()->PostTask( | 88 syncer_thread()->task_runner()->PostTask( |
88 FROM_HERE, | 89 FROM_HERE, |
89 base::Bind(&Syncer::SyncShare, base::Unretained(syncer()), v.get())); | 90 base::Bind(&Syncer::SyncShare, base::Unretained(syncer()), v.get())); |
90 | 91 |
91 // We are on the UI thread, so run our loop to process the | 92 // We are on the UI thread, so run our loop to process the |
92 // (hopefully) scheduled task from a SyncShare invocation. | 93 // (hopefully) scheduled task from a SyncShare invocation. |
93 base::MessageLoop::current()->Run(); | 94 base::MessageLoop::current()->Run(); |
94 syncer_thread()->Stop(); | 95 syncer_thread()->Stop(); |
95 } | 96 } |
OLD | NEW |