diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 14:06:11 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 14:06:11 +0000 |
commit | a66e33a22551f345c784e94e324ef7f59eb82460 (patch) | |
tree | 0cef9730b0d0fe6ad2e4f74f754c3fc17cee4067 /chrome/browser | |
parent | f8efd95f9652964bc214367648c5dfbce8ae9d30 (diff) | |
download | chromium_src-a66e33a22551f345c784e94e324ef7f59eb82460.zip chromium_src-a66e33a22551f345c784e94e324ef7f59eb82460.tar.gz chromium_src-a66e33a22551f345c784e94e324ef7f59eb82460.tar.bz2 |
sync: Get rid of duplicated typedef Closure definition.
The closure.h file just defines a callback type. But base/callback.h already
define a callback with the same type, but with a different name. So just use
the callback from base instead.
BUG=26443
TEST=trybots
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Review URL: http://codereview.chromium.org/2966009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
18 files changed, 39 insertions, 54 deletions
diff --git a/chrome/browser/sync/engine/model_changing_syncer_command.cc b/chrome/browser/sync/engine/model_changing_syncer_command.cc index c9f2d4d..b2131b4 100644 --- a/chrome/browser/sync/engine/model_changing_syncer_command.cc +++ b/chrome/browser/sync/engine/model_changing_syncer_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -8,7 +8,6 @@ #include "chrome/browser/sync/engine/model_safe_worker.h" #include "chrome/browser/sync/sessions/status_controller.h" #include "chrome/browser/sync/sessions/sync_session.h" -#include "chrome/browser/sync/util/closure.h" namespace browser_sync { @@ -24,7 +23,7 @@ void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { sessions::StatusController* status = work_session_->status_controller(); sessions::ScopedModelSafeGroupRestriction r(status, group); - scoped_ptr<Closure> c(NewCallback(this, + scoped_ptr<Callback0::Type> c(NewCallback(this, &ModelChangingSyncerCommand::StartChangingModel)); worker->DoWorkAndWaitUntilDone(c.get()); } diff --git a/chrome/browser/sync/engine/model_safe_worker.h b/chrome/browser/sync/engine/model_safe_worker.h index 597797c..7b84fd3 100644 --- a/chrome/browser/sync/engine/model_safe_worker.h +++ b/chrome/browser/sync/engine/model_safe_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -9,9 +9,9 @@ #include <string> #include <vector> +#include "base/callback.h" #include "base/ref_counted.h" #include "chrome/browser/sync/syncable/model_type.h" -#include "chrome/browser/sync/util/closure.h" #include "chrome/browser/sync/util/sync_types.h" namespace browser_sync { @@ -47,7 +47,7 @@ class ModelSafeWorker : public base::RefCountedThreadSafe<ModelSafeWorker> { // Any time the Syncer performs model modifications (e.g employing a // WriteTransaction), it should be done by this method to ensure it is done // from a model-safe thread. - virtual void DoWorkAndWaitUntilDone(Closure* work) { + virtual void DoWorkAndWaitUntilDone(Callback0::Type* work) { work->Run(); // For GROUP_PASSIVE, we do the work on the current thread. } diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index 26706db..04088ab 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -46,7 +46,6 @@ #include "chrome/browser/sync/sessions/sync_session_context.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/syncable.h" -#include "chrome/browser/sync/util/closure.h" #include "chrome/browser/sync/util/crypto_helpers.h" #include "chrome/browser/sync/util/user_settings.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/sync/engine/syncer.cc b/chrome/browser/sync/engine/syncer.cc index b3608c6..f64de42 100644 --- a/chrome/browser/sync/engine/syncer.cc +++ b/chrome/browser/sync/engine/syncer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -28,7 +28,6 @@ #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/syncable-inl.h" #include "chrome/browser/sync/syncable/syncable.h" -#include "chrome/browser/sync/util/closure.h" using base::TimeDelta; using sync_pb::ClientCommand; diff --git a/chrome/browser/sync/engine/syncer.h b/chrome/browser/sync/engine/syncer.h index 820f760..2930bb8 100644 --- a/chrome/browser/sync/engine/syncer.h +++ b/chrome/browser/sync/engine/syncer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -10,6 +10,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/callback.h" #include "base/gtest_prod_util.h" #include "base/lock.h" #include "base/scoped_ptr.h" @@ -18,7 +19,6 @@ #include "chrome/browser/sync/engine/syncproto.h" #include "chrome/browser/sync/sessions/sync_session.h" #include "chrome/browser/sync/syncable/directory_event.h" -#include "chrome/browser/sync/util/closure.h" #include "chrome/browser/sync/util/extensions_activity_monitor.h" #include "chrome/common/deprecated/event_sys.h" #include "chrome/common/deprecated/event_sys-inl.h" @@ -164,7 +164,7 @@ class Syncer { // A callback hook used in unittests to simulate changes between conflict set // building and conflict resolution. - Closure* pre_conflict_resolution_closure_; + Callback0::Type* pre_conflict_resolution_closure_; friend class SyncerTest; FRIEND_TEST_ALL_PREFIXES(SyncerTest, NameClashWithResolver); diff --git a/chrome/browser/sync/engine/syncer_unittest.cc b/chrome/browser/sync/engine/syncer_unittest.cc index f2077e3..2eab857 100644 --- a/chrome/browser/sync/engine/syncer_unittest.cc +++ b/chrome/browser/sync/engine/syncer_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. // @@ -27,7 +27,6 @@ #include "chrome/browser/sync/protocol/sync.pb.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/syncable.h" -#include "chrome/browser/sync/util/closure.h" #include "chrome/common/deprecated/event_sys-inl.h" #include "chrome/test/sync/engine/mock_connection_manager.h" #include "chrome/test/sync/engine/test_directory_setter_upper.h" diff --git a/chrome/browser/sync/glue/database_model_worker.cc b/chrome/browser/sync/glue/database_model_worker.cc index 95c49a6..13f5122 100644 --- a/chrome/browser/sync/glue/database_model_worker.cc +++ b/chrome/browser/sync/glue/database_model_worker.cc @@ -10,7 +10,7 @@ using base::WaitableEvent; namespace browser_sync { -void DatabaseModelWorker::DoWorkAndWaitUntilDone(Closure* work) { +void DatabaseModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { if (ChromeThread::CurrentlyOn(ChromeThread::DB)) { DLOG(WARNING) << "DoWorkAndWaitUntilDone called from the DB thread."; work->Run(); @@ -26,7 +26,7 @@ void DatabaseModelWorker::DoWorkAndWaitUntilDone(Closure* work) { done.Wait(); } -void DatabaseModelWorker::CallDoWorkAndSignalTask(Closure* work, +void DatabaseModelWorker::CallDoWorkAndSignalTask(Callback0::Type* work, WaitableEvent* done) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); work->Run(); diff --git a/chrome/browser/sync/glue/database_model_worker.h b/chrome/browser/sync/glue/database_model_worker.h index fbaf2bd..1f4092d 100644 --- a/chrome/browser/sync/glue/database_model_worker.h +++ b/chrome/browser/sync/glue/database_model_worker.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_SYNC_GLUE_DATABASE_MODEL_WORKER_H_ #define CHROME_BROWSER_SYNC_GLUE_DATABASE_MODEL_WORKER_H_ +#include "base/callback.h" #include "base/ref_counted.h" #include "base/waitable_event.h" #include "chrome/browser/sync/engine/model_safe_worker.h" -#include "chrome/browser/sync/util/closure.h" namespace browser_sync { @@ -19,12 +19,13 @@ class DatabaseModelWorker : public browser_sync::ModelSafeWorker { explicit DatabaseModelWorker() {} // ModelSafeWorker implementation. Called on syncapi SyncerThread. - void DoWorkAndWaitUntilDone(Closure* work); + void DoWorkAndWaitUntilDone(Callback0::Type* work); virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_DB; } virtual bool CurrentThreadIsWorkThread(); private: - void CallDoWorkAndSignalTask(Closure* work, base::WaitableEvent* done); + void CallDoWorkAndSignalTask(Callback0::Type* work, + base::WaitableEvent* done); DISALLOW_COPY_AND_ASSIGN(DatabaseModelWorker); }; diff --git a/chrome/browser/sync/glue/database_model_worker_unittest.cc b/chrome/browser/sync/glue/database_model_worker_unittest.cc index 666962c..1b5c1a2 100644 --- a/chrome/browser/sync/glue/database_model_worker_unittest.cc +++ b/chrome/browser/sync/glue/database_model_worker_unittest.cc @@ -36,7 +36,8 @@ class DatabaseModelWorkerTest : public testing::Test { // Schedule DoWork to be executed on the DB thread and have the test fail if // DoWork hasn't executed within 10 seconds. void ScheduleWork() { - scoped_ptr<Closure> c(NewCallback(this, &DatabaseModelWorkerTest::DoWork)); + scoped_ptr<Callback0::Type> c(NewCallback(this, + &DatabaseModelWorkerTest::DoWork)); timer()->Start(TimeDelta::FromSeconds(10), this, &DatabaseModelWorkerTest::Timeout); worker()->DoWorkAndWaitUntilDone(c.get()); diff --git a/chrome/browser/sync/glue/history_model_worker.cc b/chrome/browser/sync/glue/history_model_worker.cc index 74b914b..df0187d 100644 --- a/chrome/browser/sync/glue/history_model_worker.cc +++ b/chrome/browser/sync/glue/history_model_worker.cc @@ -11,7 +11,6 @@ #include "base/waitable_event.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/history/history.h" -#include "chrome/browser/sync/util/closure.h" using base::WaitableEvent; @@ -19,7 +18,7 @@ namespace browser_sync { class WorkerTask : public HistoryDBTask { public: - WorkerTask(Closure* work, WaitableEvent* done) + WorkerTask(Callback0::Type* work, WaitableEvent* done) : work_(work), done_(done) {} virtual bool RunOnDBThread(history::HistoryBackend* backend, @@ -34,7 +33,7 @@ class WorkerTask : public HistoryDBTask { virtual void DoneRunOnMainThread() {} protected: - Closure* work_; + Callback0::Type* work_; WaitableEvent* done_; }; @@ -43,7 +42,7 @@ HistoryModelWorker::HistoryModelWorker(HistoryService* history_service) : history_service_(history_service) { } -void HistoryModelWorker::DoWorkAndWaitUntilDone(Closure* work) { +void HistoryModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { WaitableEvent done(false, false); scoped_refptr<WorkerTask> task = new WorkerTask(work, &done); history_service_->ScheduleDBTask(task.get(), this); diff --git a/chrome/browser/sync/glue/history_model_worker.h b/chrome/browser/sync/glue/history_model_worker.h index 6fd65e8..2882d5a 100644 --- a/chrome/browser/sync/glue/history_model_worker.h +++ b/chrome/browser/sync/glue/history_model_worker.h @@ -8,9 +8,9 @@ #include "chrome/browser/sync/engine/model_safe_worker.h" #include "base/basictypes.h" +#include "base/callback.h" #include "base/ref_counted.h" #include "chrome/browser/cancelable_request.h" -#include "chrome/browser/sync/util/closure.h" class HistoryService; @@ -28,7 +28,7 @@ class HistoryModelWorker : public browser_sync::ModelSafeWorker, explicit HistoryModelWorker(HistoryService* history_service); // ModelSafeWorker implementation. Called on syncapi SyncerThread. - void DoWorkAndWaitUntilDone(Closure* work); + void DoWorkAndWaitUntilDone(Callback0::Type* work); virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_HISTORY; } virtual bool CurrentThreadIsWorkThread(); diff --git a/chrome/browser/sync/glue/password_model_worker.cc b/chrome/browser/sync/glue/password_model_worker.cc index be7531b..5e7669c 100644 --- a/chrome/browser/sync/glue/password_model_worker.cc +++ b/chrome/browser/sync/glue/password_model_worker.cc @@ -4,12 +4,12 @@ #include "chrome/browser/sync/glue/password_model_worker.h" +#include "base/callback.h" #include "base/logging.h" #include "base/ref_counted.h" #include "base/task.h" #include "base/waitable_event.h" #include "chrome/browser/password_manager/password_store.h" -#include "chrome/browser/sync/util/closure.h" using base::WaitableEvent; @@ -19,7 +19,7 @@ PasswordModelWorker::PasswordModelWorker(PasswordStore* password_store) : password_store_(password_store) { } -void PasswordModelWorker::DoWorkAndWaitUntilDone(Closure* work) { +void PasswordModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { WaitableEvent done(false, false); password_store_->ScheduleTask( NewRunnableMethod(this, &PasswordModelWorker::CallDoWorkAndSignalTask, @@ -27,7 +27,7 @@ void PasswordModelWorker::DoWorkAndWaitUntilDone(Closure* work) { done.Wait(); } -void PasswordModelWorker::CallDoWorkAndSignalTask(Closure* work, +void PasswordModelWorker::CallDoWorkAndSignalTask(Callback0::Type* work, WaitableEvent* done) { work->Run(); done->Signal(); diff --git a/chrome/browser/sync/glue/password_model_worker.h b/chrome/browser/sync/glue/password_model_worker.h index e778441..31637cd 100644 --- a/chrome/browser/sync/glue/password_model_worker.h +++ b/chrome/browser/sync/glue/password_model_worker.h @@ -8,8 +8,8 @@ #include "chrome/browser/sync/engine/model_safe_worker.h" #include "base/basictypes.h" +#include "base/callback.h" #include "base/ref_counted.h" -#include "chrome/browser/sync/util/closure.h" class PasswordStore; @@ -27,12 +27,13 @@ class PasswordModelWorker : public browser_sync::ModelSafeWorker { explicit PasswordModelWorker(PasswordStore* password_store); // ModelSafeWorker implementation. Called on syncapi SyncerThread. - void DoWorkAndWaitUntilDone(Closure* work); + void DoWorkAndWaitUntilDone(Callback0::Type* work); virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_PASSWORD; } virtual bool CurrentThreadIsWorkThread(); private: - void CallDoWorkAndSignalTask(Closure* work, base::WaitableEvent* done); + void CallDoWorkAndSignalTask(Callback0::Type* work, + base::WaitableEvent* done); scoped_refptr<PasswordStore> password_store_; DISALLOW_COPY_AND_ASSIGN(PasswordModelWorker); diff --git a/chrome/browser/sync/glue/ui_model_worker.cc b/chrome/browser/sync/glue/ui_model_worker.cc index 2d08aa5..62b0b15 100644 --- a/chrome/browser/sync/glue/ui_model_worker.cc +++ b/chrome/browser/sync/glue/ui_model_worker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -10,7 +10,7 @@ namespace browser_sync { -void UIModelWorker::DoWorkAndWaitUntilDone(Closure* work) { +void UIModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { // In most cases, this method is called in WORKING state. It is possible this // gets called when we are in the RUNNING_MANUAL_SHUTDOWN_PUMP state, because // the UI loop has initiated shutdown but the syncer hasn't got the memo yet. diff --git a/chrome/browser/sync/glue/ui_model_worker.h b/chrome/browser/sync/glue/ui_model_worker.h index f7d9188..50d4576 100644 --- a/chrome/browser/sync/glue/ui_model_worker.h +++ b/chrome/browser/sync/glue/ui_model_worker.h @@ -1,17 +1,17 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. #ifndef CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ #define CHROME_BROWSER_SYNC_GLUE_UI_MODEL_WORKER_H_ +#include "base/callback.h" #include "base/condition_variable.h" #include "base/lock.h" #include "base/task.h" #include "base/waitable_event.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/engine/model_safe_worker.h" -#include "chrome/browser/sync/util/closure.h" class MessageLoop; @@ -39,7 +39,7 @@ class UIModelWorker : public browser_sync::ModelSafeWorker { // A simple task to signal a waitable event after Run()ning a Closure. class CallDoWorkAndSignalTask : public Task { public: - CallDoWorkAndSignalTask(Closure* work, + CallDoWorkAndSignalTask(Callback0::Type* work, base::WaitableEvent* work_done, UIModelWorker* scheduler) : work_(work), work_done_(work_done), scheduler_(scheduler) { @@ -52,7 +52,7 @@ class UIModelWorker : public browser_sync::ModelSafeWorker { private: // Task data - a closure and a waitable event to signal after the work has // been done. - Closure* work_; + Callback0::Type* work_; base::WaitableEvent* work_done_; // The UIModelWorker responsible for scheduling us. @@ -68,7 +68,7 @@ class UIModelWorker : public browser_sync::ModelSafeWorker { void Stop(); // ModelSafeWorker implementation. Called on syncapi SyncerThread. - virtual void DoWorkAndWaitUntilDone(Closure* work); + virtual void DoWorkAndWaitUntilDone(Callback0::Type* work); virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_UI; } virtual bool CurrentThreadIsWorkThread(); diff --git a/chrome/browser/sync/glue/ui_model_worker_unittest.cc b/chrome/browser/sync/glue/ui_model_worker_unittest.cc index e0ad82f..79e9fb0 100644 --- a/chrome/browser/sync/glue/ui_model_worker_unittest.cc +++ b/chrome/browser/sync/glue/ui_model_worker_unittest.cc @@ -45,7 +45,7 @@ class Syncer { ~Syncer() {} void SyncShare(UIModelWorkerVisitor* visitor) { - scoped_ptr<Closure> c(NewCallback(visitor, + scoped_ptr<Callback0::Type> c(NewCallback(visitor, &UIModelWorkerVisitor::DoWork)); worker_->DoWorkAndWaitUntilDone(c.get()); } diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc index f5a9fa7..c8be9f4 100644 --- a/chrome/browser/sync/syncable/syncable_unittest.cc +++ b/chrome/browser/sync/syncable/syncable_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -32,7 +32,6 @@ #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" #include "chrome/browser/sync/syncable/directory_backing_store.h" #include "chrome/browser/sync/syncable/directory_manager.h" -#include "chrome/browser/sync/util/closure.h" #include "chrome/common/deprecated/event_sys-inl.h" #include "chrome/test/sync/engine/test_id_factory.h" #include "chrome/test/sync/engine/test_syncable_utils.h" diff --git a/chrome/browser/sync/util/closure.h b/chrome/browser/sync/util/closure.h deleted file mode 100644 index 0e4389f..0000000 --- a/chrome/browser/sync/util/closure.h +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2009 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. - -#ifndef CHROME_BROWSER_SYNC_UTIL_CLOSURE_H_ -#define CHROME_BROWSER_SYNC_UTIL_CLOSURE_H_ - -#include "base/callback.h" - -typedef CallbackRunner<Tuple0> Closure; - -#endif // CHROME_BROWSER_SYNC_UTIL_CLOSURE_H_ |