| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/shell/renderer/test_runner/WebTask.h" | 5 #include "content/shell/renderer/test_runner/WebTask.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "third_party/WebKit/public/web/WebKit.h" | 8 #include "third_party/WebKit/public/web/WebKit.h" |
| 9 | 9 |
| 10 using namespace std; | |
| 11 | |
| 12 namespace content { | 10 namespace content { |
| 13 | 11 |
| 14 WebTask::WebTask(WebTaskList* list) | 12 WebTask::WebTask(WebTaskList* list) |
| 15 : m_taskList(list) | 13 : m_taskList(list) |
| 16 { | 14 { |
| 17 m_taskList->registerTask(this); | 15 m_taskList->registerTask(this); |
| 18 } | 16 } |
| 19 | 17 |
| 20 WebTask::~WebTask() | 18 WebTask::~WebTask() |
| 21 { | 19 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 revokeAll(); | 30 revokeAll(); |
| 33 } | 31 } |
| 34 | 32 |
| 35 void WebTaskList::registerTask(WebTask* task) | 33 void WebTaskList::registerTask(WebTask* task) |
| 36 { | 34 { |
| 37 m_tasks.push_back(task); | 35 m_tasks.push_back(task); |
| 38 } | 36 } |
| 39 | 37 |
| 40 void WebTaskList::unregisterTask(WebTask* task) | 38 void WebTaskList::unregisterTask(WebTask* task) |
| 41 { | 39 { |
| 42 vector<WebTask*>::iterator iter = find(m_tasks.begin(), m_tasks.end(), task)
; | 40 std::vector<WebTask*>::iterator iter = std::find(m_tasks.begin(), m_tasks.en
d(), task); |
| 43 if (iter != m_tasks.end()) | 41 if (iter != m_tasks.end()) |
| 44 m_tasks.erase(iter); | 42 m_tasks.erase(iter); |
| 45 } | 43 } |
| 46 | 44 |
| 47 void WebTaskList::revokeAll() | 45 void WebTaskList::revokeAll() |
| 48 { | 46 { |
| 49 while (!m_tasks.empty()) | 47 while (!m_tasks.empty()) |
| 50 m_tasks[0]->cancel(); | 48 m_tasks[0]->cancel(); |
| 51 } | 49 } |
| 52 | 50 |
| 53 } // namespace content | 51 } // namespace content |
| OLD | NEW |