[safe-browsing] Database full hash matches like prefix match.
[chromium-blink-merge.git] / content / shell / renderer / test_runner / WebTask.cpp
blob0a21971df3c4eefca71afb8ae8af93d989a4024c
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 "content/shell/renderer/test_runner/WebTask.h"
7 #include <algorithm>
8 #include "third_party/WebKit/public/web/WebKit.h"
10 using namespace std;
12 namespace WebTestRunner {
14 WebTask::WebTask(WebTaskList* list)
15 : m_taskList(list)
17 m_taskList->registerTask(this);
20 WebTask::~WebTask()
22 if (m_taskList)
23 m_taskList->unregisterTask(this);
26 WebTaskList::WebTaskList()
30 WebTaskList::~WebTaskList()
32 revokeAll();
35 void WebTaskList::registerTask(WebTask* task)
37 m_tasks.push_back(task);
40 void WebTaskList::unregisterTask(WebTask* task)
42 vector<WebTask*>::iterator iter = find(m_tasks.begin(), m_tasks.end(), task);
43 if (iter != m_tasks.end())
44 m_tasks.erase(iter);
47 void WebTaskList::revokeAll()
49 while (!m_tasks.empty())
50 m_tasks[0]->cancel();