Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: components/test_runner/web_task.cc

Issue 1852603002: Replacing most of web_task.h with base::Closure + base::WeakPtrFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-mocks-to-test-runner
Patch Set: Rebasing... Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/test_runner/web_task.h ('k') | components/test_runner/web_test_interfaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/web_task.cc
diff --git a/components/test_runner/web_task.cc b/components/test_runner/web_task.cc
index df3cb6993282249d8136522d4b2f5d382c32ad44..b7c6e4e38586c2ea6698138ea14db8412e3735c1 100644
--- a/components/test_runner/web_task.cc
+++ b/components/test_runner/web_task.cc
@@ -4,42 +4,15 @@
#include "components/test_runner/web_task.h"
-#include <algorithm>
-
-#include "third_party/WebKit/public/web/WebKit.h"
-
namespace test_runner {
-WebTask::WebTask(WebTaskList* list) : task_list_(list) {
- task_list_->RegisterTask(this);
-}
-
-WebTask::~WebTask() {
- if (task_list_)
- task_list_->UnregisterTask(this);
-}
-
-WebTaskList::WebTaskList() {
-}
-
-WebTaskList::~WebTaskList() {
- RevokeAll();
-}
+WebCallbackTask::WebCallbackTask(const base::Closure& callback)
+ : callback_(callback) {}
-void WebTaskList::RegisterTask(WebTask* task) {
- tasks_.push_back(task);
-}
-
-void WebTaskList::UnregisterTask(WebTask* task) {
- std::vector<WebTask*>::iterator iter =
- std::find(tasks_.begin(), tasks_.end(), task);
- if (iter != tasks_.end())
- tasks_.erase(iter);
-}
+WebCallbackTask::~WebCallbackTask() {}
-void WebTaskList::RevokeAll() {
- while (!tasks_.empty())
- tasks_[0]->cancel();
+void WebCallbackTask::run() {
+ callback_.Run();
}
} // namespace test_runner
« no previous file with comments | « components/test_runner/web_task.h ('k') | components/test_runner/web_test_interfaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698