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

Unified Diff: mojo/public/cpp/bindings/lib/value_traits.h

Issue 2031823002: Mojo C++ bindings: more consistent Clone() and Equals(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « mojo/public/cpp/bindings/lib/template_util.h ('k') | mojo/public/cpp/bindings/map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/value_traits.h
diff --git a/mojo/public/cpp/bindings/lib/value_traits.h b/mojo/public/cpp/bindings/lib/value_traits.h
deleted file mode 100644
index 56bdf3adb1cf14d557f4ea7a9cf6894268fe81ee..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/lib/value_traits.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2015 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 MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
-
-#include "mojo/public/cpp/bindings/lib/template_util.h"
-
-namespace mojo {
-
-template <typename T>
-class Array;
-
-template <typename T>
-class AssociatedInterfacePtrInfo;
-
-template <typename T>
-class AssociatedInterfaceRequest;
-
-template <typename T>
-class InlinedStructPtr;
-
-template <typename T>
-class InterfacePtr;
-
-template <typename T>
-class InterfaceRequest;
-
-template <typename K, typename V>
-class Map;
-
-template <typename T>
-class ScopedHandleBase;
-
-template <typename T>
-class StructPtr;
-
-template <typename T>
-class WTFArray;
-
-namespace internal {
-
-template <typename T, typename Enable = void>
-struct ValueTraits {
- static bool Equals(const T& a, const T& b) { return a == b; }
-};
-
-template <typename T>
-struct ValueTraits<
- T,
- typename EnableIf<IsSpecializationOf<Array, T>::value ||
- IsSpecializationOf<WTFArray, T>::value ||
- IsSpecializationOf<Map, T>::value ||
- IsSpecializationOf<StructPtr, T>::value ||
- IsSpecializationOf<InlinedStructPtr, T>::value>::type> {
- static bool Equals(const T& a, const T& b) { return a.Equals(b); }
-};
-
-template <typename T>
-struct ValueTraits<ScopedHandleBase<T>> {
- static bool Equals(const ScopedHandleBase<T>& a,
- const ScopedHandleBase<T>& b) {
- return a.get().value() == b.get().value();
- }
-};
-
-template <typename T>
-struct ValueTraits<
- T,
- typename EnableIf<
- IsSpecializationOf<InterfaceRequest, T>::value ||
- IsSpecializationOf<AssociatedInterfaceRequest, T>::value>::type> {
- static bool Equals(const T& a, const T& b) {
- if (&a == &b)
- return true;
-
- // Now that |a| and |b| refer to different objects, they are equivalent if
- // and only if they are both invalid.
- return !a.is_pending() && !b.is_pending();
- }
-};
-
-template <typename T>
-struct ValueTraits<InterfacePtr<T>> {
- static bool Equals(const InterfacePtr<T>& a, const InterfacePtr<T>& b) {
- if (&a == &b)
- return true;
-
- // Now that |a| and |b| refer to different objects, they are equivalent if
- // and only if they are both null.
- return !a && !b;
- }
-};
-
-template <typename T>
-struct ValueTraits<AssociatedInterfacePtrInfo<T>> {
- static bool Equals(const AssociatedInterfacePtrInfo<T>& a,
- const AssociatedInterfacePtrInfo<T>& b) {
- if (&a == &b)
- return true;
-
- // Now that |a| and |b| refer to different objects, they are equivalent if
- // and only if they are both invalid.
- return !a.is_valid() && !b.is_valid();
- }
-};
-
-} // namespace internal
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALUE_TRAITS_H_
« no previous file with comments | « mojo/public/cpp/bindings/lib/template_util.h ('k') | mojo/public/cpp/bindings/map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698