| Index: chrome/browser/sync/glue/file_model_worker.cc
|
| diff --git a/chrome/browser/sync/glue/file_model_worker.cc b/chrome/browser/sync/glue/file_model_worker.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..04b7c22bf688569e13353861d1935a4b804754cd
|
| --- /dev/null
|
| +++ b/chrome/browser/sync/glue/file_model_worker.cc
|
| @@ -0,0 +1,41 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/sync/glue/file_model_worker.h"
|
| +
|
| +#include "base/synchronization/waitable_event.h"
|
| +#include "content/browser/browser_thread.h"
|
| +
|
| +using base::WaitableEvent;
|
| +
|
| +namespace browser_sync {
|
| +
|
| +void FileModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {
|
| + if (BrowserThread::CurrentlyOn(BrowserThread::FILE)) {
|
| + DLOG(WARNING) << "DoWorkAndWaitUntilDone called from the FILE thread.";
|
| + work->Run();
|
| + return;
|
| + }
|
| + WaitableEvent done(false, false);
|
| + if (!BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
| + NewRunnableMethod(this, &FileModelWorker::CallDoWorkAndSignalTask,
|
| + work, &done))) {
|
| + NOTREACHED() << "Failed to post task to the db thread.";
|
| + return;
|
| + }
|
| + done.Wait();
|
| +}
|
| +
|
| +void FileModelWorker::CallDoWorkAndSignalTask(Callback0::Type* work,
|
| + WaitableEvent* done) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| + work->Run();
|
| + done->Signal();
|
| +}
|
| +
|
| +ModelSafeGroup FileModelWorker::GetModelSafeGroup() {
|
| + return GROUP_FILE;
|
| +}
|
| +
|
| +} // namespace browser_sync
|
|
|