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

Unified Diff: content/shell/renderer/test_runner/WebTask.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/BUILD.gn ('k') | content/shell/renderer/test_runner/WebTask.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/WebTask.h
diff --git a/content/shell/renderer/test_runner/WebTask.h b/content/shell/renderer/test_runner/WebTask.h
deleted file mode 100644
index 35e5d2d60061285c29c701d3b17f32c43cd0add6..0000000000000000000000000000000000000000
--- a/content/shell/renderer/test_runner/WebTask.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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.
-
-#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBTASK_H_
-#define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBTASK_H_
-
-#include <vector>
-
-namespace content {
-
-class WebTaskList;
-
-// WebTask represents a task which can run by WebTestDelegate::postTask() or
-// WebTestDelegate::postDelayedTask().
-class WebTask {
-public:
- explicit WebTask(WebTaskList*);
- virtual ~WebTask();
-
- // The main code of this task.
- // An implementation of run() should return immediately if cancel() was called.
- virtual void run() = 0;
- virtual void cancel() = 0;
-
-protected:
- WebTaskList* m_taskList;
-};
-
-class WebTaskList {
-public:
- WebTaskList();
- ~WebTaskList();
- void registerTask(WebTask*);
- void unregisterTask(WebTask*);
- void revokeAll();
-
-private:
- std::vector<WebTask*> m_tasks;
-};
-
-// A task containing an object pointer of class T. Derived classes should
-// override runIfValid() which in turn can safely invoke methods on the
-// m_object. The Class T must have "WebTaskList* mutable_task_list()".
-template<class T>
-class WebMethodTask : public WebTask {
-public:
- explicit WebMethodTask(T* object)
- : WebTask(object->mutable_task_list())
- , m_object(object)
- {
- }
-
- virtual ~WebMethodTask() { }
-
- virtual void run()
- {
- if (m_object)
- runIfValid();
- }
-
- virtual void cancel()
- {
- m_object = 0;
- m_taskList->unregisterTask(this);
- m_taskList = 0;
- }
-
- virtual void runIfValid() = 0;
-
-protected:
- T* m_object;
-};
-
-} // namespace content
-
-#endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBTASK_H_
« no previous file with comments | « content/shell/BUILD.gn ('k') | content/shell/renderer/test_runner/WebTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698