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

Side by Side Diff: mojo/edk/system/ref_ptr_internal.h

Issue 1423713009: EDK: Move ref counting classes to mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « mojo/edk/system/ref_ptr.h ('k') | mojo/edk/system/remote_consumer_data_pipe_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_REF_PTR_INTERNAL_H_
6 #define MOJO_EDK_SYSTEM_REF_PTR_INTERNAL_H_
7
8 #include <utility>
9
10 #include "mojo/public/cpp/system/macros.h"
11
12 namespace mojo {
13 namespace system {
14
15 template <typename T>
16 class RefPtr;
17
18 template <typename T>
19 RefPtr<T> AdoptRef(T* ptr);
20
21 namespace internal {
22
23 // This is a wrapper class that can be friended for a particular |T|, if you
24 // want to make |T|'s constructor private, but still use |MakeRefCounted()|
25 // (below). (You can't friend partial specializations.) See |MakeRefCounted()|
26 // and |FRIEND_MAKE_REF_COUNTED()|.
27 template <typename T>
28 class MakeRefCountedHelper {
29 public:
30 template <typename... Args>
31 static RefPtr<T> MakeRefCounted(Args&&... args) {
32 return AdoptRef<T>(new T(std::forward<Args>(args)...));
33 }
34 };
35
36 } // namespace internal
37 } // namespace system
38 } // namespace mojo
39
40 #endif // MOJO_EDK_SYSTEM_REF_PTR_INTERNAL_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/ref_ptr.h ('k') | mojo/edk/system/remote_consumer_data_pipe_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698