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

Unified Diff: mojo/public/cpp/bindings/tests/container_test_util.cc

Issue 611633002: mojom: Add associative arrays to the mojom language. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved test classes to their own shared file. Created 6 years, 2 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
Index: mojo/public/cpp/bindings/tests/container_test_util.cc
diff --git a/mojo/public/cpp/bindings/tests/container_test_util.cc b/mojo/public/cpp/bindings/tests/container_test_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..12fdabacb85bbae72febb83f97db72a7585b83e3
--- /dev/null
+++ b/mojo/public/cpp/bindings/tests/container_test_util.cc
@@ -0,0 +1,50 @@
+// Copyright 2014 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 "mojo/public/cpp/bindings/tests/container_test_util.h"
+
+namespace mojo {
+
+size_t CopyableType::num_instances_ = 0;
+size_t MoveOnlyType::num_instances_ = 0;
+
+CopyableType::CopyableType() : copied_(false), ptr_(this) {
+ num_instances_++;
+}
+
+CopyableType::CopyableType(const CopyableType& other)
+ : copied_(true), ptr_(other.ptr()) {
+ num_instances_++;
+}
+
+CopyableType& CopyableType::operator=(const CopyableType& other) {
+ copied_ = true;
+ ptr_ = other.ptr();
+ return *this;
+}
+
+CopyableType::~CopyableType() {
+ num_instances_--;
+}
+
+MoveOnlyType::MoveOnlyType() : moved_(false), ptr_(this) {
+ num_instances_++;
+}
+
+MoveOnlyType::MoveOnlyType(RValue other)
+ : moved_(true), ptr_(other.object->ptr()) {
+ num_instances_++;
+}
+
+MoveOnlyType& MoveOnlyType::operator=(RValue other) {
+ moved_ = true;
+ ptr_ = other.object->ptr();
+ return *this;
+}
+
+MoveOnlyType::~MoveOnlyType() {
+ num_instances_--;
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/tests/container_test_util.h ('k') | mojo/public/cpp/bindings/tests/map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698