Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/shell/renderer/test_runner/web_task.h" | |
| 6 | |
| 7 #include <algorithm> | |
| 8 #include "third_party/WebKit/public/web/WebKit.h" | |
|
jochen (gone - plz use gerrit)
2014/09/12 07:47:03
nit. empty line between system headers and other h
Abhishek
2014/09/12 08:00:09
Done.
| |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 WebTask::WebTask(WebTaskList* list) : task_list_(list) { | |
| 13 task_list_->RegisterTask(this); | |
| 14 } | |
| 15 | |
| 16 WebTask::~WebTask() { | |
| 17 if (task_list_) | |
| 18 task_list_->UnregisterTask(this); | |
| 19 } | |
| 20 | |
| 21 WebTaskList::WebTaskList() { | |
| 22 } | |
| 23 | |
| 24 WebTaskList::~WebTaskList() { | |
| 25 RevokeAll(); | |
| 26 } | |
| 27 | |
| 28 void WebTaskList::RegisterTask(WebTask* task) { | |
| 29 tasks_.push_back(task); | |
| 30 } | |
| 31 | |
| 32 void WebTaskList::UnregisterTask(WebTask* task) { | |
| 33 std::vector<WebTask*>::iterator iter = | |
| 34 std::find(tasks_.begin(), tasks_.end(), task); | |
| 35 if (iter != tasks_.end()) | |
| 36 tasks_.erase(iter); | |
| 37 } | |
| 38 | |
| 39 void WebTaskList::RevokeAll() { | |
| 40 while (!tasks_.empty()) | |
| 41 tasks_[0]->cancel(); | |
| 42 } | |
| 43 | |
| 44 } // namespace content | |
| OLD | NEW |