Don't preload rarely seen large images
[chromium-blink-merge.git] / components / test_runner / web_task.cc
blobdf3cb6993282249d8136522d4b2f5d382c32ad44
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.
5 #include "components/test_runner/web_task.h"
7 #include <algorithm>
9 #include "third_party/WebKit/public/web/WebKit.h"
11 namespace test_runner {
13 WebTask::WebTask(WebTaskList* list) : task_list_(list) {
14 task_list_->RegisterTask(this);
17 WebTask::~WebTask() {
18 if (task_list_)
19 task_list_->UnregisterTask(this);
22 WebTaskList::WebTaskList() {
25 WebTaskList::~WebTaskList() {
26 RevokeAll();
29 void WebTaskList::RegisterTask(WebTask* task) {
30 tasks_.push_back(task);
33 void WebTaskList::UnregisterTask(WebTask* task) {
34 std::vector<WebTask*>::iterator iter =
35 std::find(tasks_.begin(), tasks_.end(), task);
36 if (iter != tasks_.end())
37 tasks_.erase(iter);
40 void WebTaskList::RevokeAll() {
41 while (!tasks_.empty())
42 tasks_[0]->cancel();
45 } // namespace test_runner