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

Unified Diff: mojo/public/bindings/lib/shared_ptr.h

Issue 220243007: Mojo: Move mojo/public/bindings/lib to mojo/public/cpp/bindings/lib. (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/lib/shared_data.h ('k') | mojo/public/bindings/lib/sync_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/lib/shared_ptr.h
diff --git a/mojo/public/bindings/lib/shared_ptr.h b/mojo/public/bindings/lib/shared_ptr.h
deleted file mode 100644
index 537b39e6cfc287d8edbfaf97e33433307c798518..0000000000000000000000000000000000000000
--- a/mojo/public/bindings/lib/shared_ptr.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.
-
-#ifndef MOJO_PUBLIC_BINDINGS_LIB_SHARED_PTR_H_
-#define MOJO_PUBLIC_BINDINGS_LIB_SHARED_PTR_H_
-
-#include "mojo/public/bindings/lib/shared_data.h"
-
-namespace mojo {
-namespace internal {
-
-// Used to manage a heap-allocated instance of P that can be shared via
-// reference counting. When the last reference is dropped, the instance is
-// deleted.
-template <typename P>
-class SharedPtr {
- public:
- SharedPtr() {}
-
- explicit SharedPtr(P* ptr) {
- impl_.mutable_value()->ptr = ptr;
- }
-
- // Default copy-constructor and assignment operator are OK.
-
- P* get() {
- return impl_.value().ptr;
- }
- const P* get() const {
- return impl_.value().ptr;
- }
-
- P* operator->() { return get(); }
- const P* operator->() const { return get(); }
-
- private:
- class Impl {
- public:
- ~Impl() {
- if (ptr)
- delete ptr;
- }
-
- Impl() : ptr(NULL) {
- }
-
- Impl(P* ptr) : ptr(ptr) {
- }
-
- P* ptr;
-
- private:
- MOJO_DISALLOW_COPY_AND_ASSIGN(Impl);
- };
-
- SharedData<Impl> impl_;
-};
-
-} // namespace mojo
-} // namespace internal
-
-#endif // MOJO_PUBLIC_BINDINGS_LIB_SHARED_PTR_H_
« no previous file with comments | « mojo/public/bindings/lib/shared_data.h ('k') | mojo/public/bindings/lib/sync_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698