| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/dynamic_annotations.h" | |
| 8 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 9 #include "base/waitable_event.h" | 9 #include "base/waitable_event.h" |
| 10 | 10 |
| 11 namespace browser_sync { | 11 namespace browser_sync { |
| 12 | 12 |
| 13 void UIModelWorker::DoWorkAndWaitUntilDone(Closure* work) { | 13 void UIModelWorker::DoWorkAndWaitUntilDone(Closure* 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 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // get run twice. | 103 // get run twice. |
| 104 work_ = NULL; | 104 work_ = NULL; |
| 105 | 105 |
| 106 // Notify the UIModelWorker that scheduled us that we have run | 106 // Notify the UIModelWorker that scheduled us that we have run |
| 107 // successfully. | 107 // successfully. |
| 108 scheduler_->OnTaskCompleted(); | 108 scheduler_->OnTaskCompleted(); |
| 109 work_done_->Signal(); // Unblock the syncer thread that scheduled us. | 109 work_done_->Signal(); // Unblock the syncer thread that scheduled us. |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace browser_sync | 112 } // namespace browser_sync |
| OLD | NEW |