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

Unified Diff: content/test/layout_tests/runner/WebTask.cpp

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years 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
Index: content/test/layout_tests/runner/WebTask.cpp
diff --git a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h b/content/test/layout_tests/runner/WebTask.cpp
similarity index 59%
copy from third_party/tcmalloc/vendor/src/base/synchronization_profiling.h
copy to content/test/layout_tests/runner/WebTask.cpp
index cf02c218a111806189f71f7b528a83b5ceb164a4..4e4af8bae510bee70005b1fcaf68fa15f9adef43 100644
--- a/third_party/tcmalloc/vendor/src/base/synchronization_profiling.h
+++ b/content/test/layout_tests/runner/WebTask.cpp
@@ -1,5 +1,9 @@
-/* Copyright (c) 2010, Google Inc.
- * All rights reserved.
+// 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.
+
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,25 +30,54 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ---
- * Author: Chris Ruemmler
*/
-#ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
-#define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_
+#include "content/public/test/layout_tests/WebTask.h"
+
+#include "third_party/WebKit/public/web/WebKit.h"
+#include <algorithm>
+
+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();
+}
-#include "base/basictypes.h"
+void WebTaskList::registerTask(WebTask* task)
+{
+ m_tasks.push_back(task);
+}
-namespace base {
+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);
+}
-// We can do contention-profiling of SpinLocks, but the code is in
-// mutex.cc, which is not always linked in with spinlock. Hence we
-// provide a weak definition, which are used if mutex.cc isn't linked in.
+void WebTaskList::revokeAll()
+{
+ while (!m_tasks.empty())
+ m_tasks[0]->cancel();
+}
-// Submit the number of cycles the spinlock spent contending.
-ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64);
-extern void SubmitSpinLockProfileData(const void *contendedlock,
- int64 wait_cycles) {}
}
-#endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_

Powered by Google App Engine
This is Rietveld 408576698