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

Unified Diff: content/shell/renderer/test_runner/web_task.cc

Issue 566833002: Update WebTask in chromium c++ style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolved build error Created 6 years, 3 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 | « content/shell/renderer/test_runner/web_task.h ('k') | content/shell/renderer/test_runner/web_test_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/web_task.cc
diff --git a/content/shell/renderer/test_runner/web_task.cc b/content/shell/renderer/test_runner/web_task.cc
new file mode 100644
index 0000000000000000000000000000000000000000..369b049efc58a86820a67a6d5fb6a74c9aa6782e
--- /dev/null
+++ b/content/shell/renderer/test_runner/web_task.cc
@@ -0,0 +1,45 @@
+// Copyright 2013 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 "content/shell/renderer/test_runner/web_task.h"
+
+#include <algorithm>
+
+#include "third_party/WebKit/public/web/WebKit.h"
+
+namespace content {
+
+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();
+}
+
+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);
+}
+
+void WebTaskList::RevokeAll() {
+ while (!tasks_.empty())
+ tasks_[0]->cancel();
+}
+
+} // namespace content
« no previous file with comments | « content/shell/renderer/test_runner/web_task.h ('k') | content/shell/renderer/test_runner/web_test_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698