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

Side by Side Diff: content/shell/renderer/test_runner/WebTask.cpp

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 unified diff | Download patch
OLDNEW
(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/WebTask.h"
6
7 #include <algorithm>
8 #include "third_party/WebKit/public/web/WebKit.h"
9
10 namespace content {
11
12 WebTask::WebTask(WebTaskList* list)
13 : m_taskList(list)
14 {
15 m_taskList->registerTask(this);
16 }
17
18 WebTask::~WebTask()
19 {
20 if (m_taskList)
21 m_taskList->unregisterTask(this);
22 }
23
24 WebTaskList::WebTaskList()
25 {
26 }
27
28 WebTaskList::~WebTaskList()
29 {
30 revokeAll();
31 }
32
33 void WebTaskList::registerTask(WebTask* task)
34 {
35 m_tasks.push_back(task);
36 }
37
38 void WebTaskList::unregisterTask(WebTask* task)
39 {
40 std::vector<WebTask*>::iterator iter = std::find(m_tasks.begin(), m_tasks.en d(), task);
41 if (iter != m_tasks.end())
42 m_tasks.erase(iter);
43 }
44
45 void WebTaskList::revokeAll()
46 {
47 while (!m_tasks.empty())
48 m_tasks[0]->cancel();
49 }
50
51 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/WebTask.h ('k') | content/shell/renderer/test_runner/event_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698