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

Unified Diff: mojo/public/bindings/passable.h

Issue 218613010: Mojo: Move mojo/public/bindings/*.h to mojo/public/cpp/bindings/*.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/bindings/message.h ('k') | mojo/public/bindings/remote_ptr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/passable.h
diff --git a/mojo/public/bindings/passable.h b/mojo/public/bindings/passable.h
deleted file mode 100644
index 579dcaf23f772c3ffce7fecf039cc5532463fb87..0000000000000000000000000000000000000000
--- a/mojo/public/bindings/passable.h
+++ /dev/null
@@ -1,73 +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 MOJO_PUBLIC_BINDINGS_PASSABLE_H_
-#define MOJO_PUBLIC_BINDINGS_PASSABLE_H_
-
-#include "mojo/public/bindings/lib/bindings_internal.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace mojo {
-
-template <typename HandleType>
-class Passable {
- public:
- // |ptr| may be null.
- explicit Passable(HandleType* ptr) : ptr_(ptr) {
- }
-
- bool is_valid() const {
- return ptr_ && ptr_->is_valid();
- }
-
- HandleType get() const {
- return ptr_ ? *ptr_ : HandleType();
- }
-
- HandleType release() MOJO_WARN_UNUSED_RESULT {
- return ptr_ ? internal::FetchAndReset(ptr_) : HandleType();
- }
-
- ScopedHandleBase<HandleType> Pass() {
- return ScopedHandleBase<HandleType>(release());
- }
-
- protected:
- Passable();
- // The default copy-ctor and operator= are OK.
-
- HandleType* ptr_;
-};
-
-template <typename HandleType>
-inline Passable<HandleType> MakePassable(HandleType* ptr) {
- return Passable<HandleType>(ptr);
-}
-
-template <typename HandleType>
-class AssignableAndPassable : public Passable<HandleType> {
- public:
- explicit AssignableAndPassable(HandleType* ptr) : Passable<HandleType>(ptr) {
- assert(ptr);
- }
-
- void operator=(ScopedHandleBase<HandleType> scoper) {
- reset(scoper.release());
- }
-
- void reset(HandleType obj = HandleType()) {
- ScopedHandleBase<HandleType>(*this->ptr_);
- this->ptr_->set_value(obj.value());
- }
-};
-
-template <typename HandleType>
-inline AssignableAndPassable<HandleType> MakeAssignableAndPassable(
- HandleType* ptr) {
- return AssignableAndPassable<HandleType>(ptr);
-}
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_BINDINGS_PASSABLE_H_
« no previous file with comments | « mojo/public/bindings/message.h ('k') | mojo/public/bindings/remote_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698