blob: 0a21971df3c4eefca71afb8ae8af93d989a4024c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// 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/WebTask.h"
#include <algorithm>
#include "third_party/WebKit/public/web/WebKit.h"
using namespace std;
namespace WebTestRunner {
WebTask::WebTask(WebTaskList* list)
: m_taskList(list)
{
m_taskList->registerTask(this);
}
WebTask::~WebTask()
{
if (m_taskList)
m_taskList->unregisterTask(this);
}
WebTaskList::WebTaskList()
{
}
WebTaskList::~WebTaskList()
{
revokeAll();
}
void WebTaskList::registerTask(WebTask* task)
{
m_tasks.push_back(task);
}
void WebTaskList::unregisterTask(WebTask* task)
{
vector<WebTask*>::iterator iter = find(m_tasks.begin(), m_tasks.end(), task);
if (iter != m_tasks.end())
m_tasks.erase(iter);
}
void WebTaskList::revokeAll()
{
while (!m_tasks.empty())
m_tasks[0]->cancel();
}
}
|