OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/sync/glue/ui_model_worker.h" | 5 #include "chrome/browser/sync/glue/ui_model_worker.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
9 #include "base/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 | 10 |
11 namespace browser_sync { | 11 namespace browser_sync { |
12 | 12 |
13 void UIModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { | 13 void UIModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { |
14 // In most cases, this method is called in WORKING state. It is possible this | 14 // In most cases, this method is called in WORKING state. It is possible this |
15 // gets called when we are in the RUNNING_MANUAL_SHUTDOWN_PUMP state, because | 15 // gets called when we are in the RUNNING_MANUAL_SHUTDOWN_PUMP state, because |
16 // the UI loop has initiated shutdown but the syncer hasn't got the memo yet. | 16 // the UI loop has initiated shutdown but the syncer hasn't got the memo yet. |
17 // This is fine, the work will get scheduled and run normally or run by our | 17 // This is fine, the work will get scheduled and run normally or run by our |
18 // code handling this case in Stop(). Note there _no_ way we can be in here | 18 // code handling this case in Stop(). Note there _no_ way we can be in here |
19 // with state_ = STOPPED, so it is safe to read / compare in this case. | 19 // with state_ = STOPPED, so it is safe to read / compare in this case. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // get run twice. | 115 // get run twice. |
116 work_ = NULL; | 116 work_ = NULL; |
117 | 117 |
118 // Notify the UIModelWorker that scheduled us that we have run | 118 // Notify the UIModelWorker that scheduled us that we have run |
119 // successfully. | 119 // successfully. |
120 scheduler_->OnTaskCompleted(); | 120 scheduler_->OnTaskCompleted(); |
121 work_done_->Signal(); // Unblock the syncer thread that scheduled us. | 121 work_done_->Signal(); // Unblock the syncer thread that scheduled us. |
122 } | 122 } |
123 | 123 |
124 } // namespace browser_sync | 124 } // namespace browser_sync |
OLD | NEW |