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

Side by Side Diff: src/untrusted/init/scoped_non_ptr.h

Issue 25147002: nacl_init Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/untrusted/init/scoped_lock.h ('k') | src/untrusted/init/simple_lock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // -*- c++ -*-
2 // Copyright (c) 2013 The Native Client Authors. All rights reserved. 1 // Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 3 // found in the LICENSE file.
5 4
6 #ifndef NATIVE_CLIENT_TESTS_SUBPROCESS_SCOPED_CLEANUP_H_ 5 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_INIT_SCOPED_NON_PTR_H_
7 #define NATIVE_CLIENT_TESTS_SUBPROCESS_SCOPED_CLEANUP_H_ 6 #define NATIVE_CLIENT_SRC_UNTRUSTED_INIT_SCOPED_NON_PTR_H_
8 7
9 #include "native_client/src/include/nacl_base.h" 8 #include "native_client/src/include/nacl_base.h"
10 9
11 template<typename T, void (*cleanup)(T)> 10 template<typename T, void (*cleanup)(T)>
12 class ScopedNonPtr { 11 class ScopedNonPtr {
13 public: 12 public:
14 explicit ScopedNonPtr(T obj) 13 explicit ScopedNonPtr(T obj)
15 : obj_(obj) {} 14 : obj_(obj) {}
16 ~ScopedNonPtr() { 15 ~ScopedNonPtr() {
17 cleanup(obj_); 16 cleanup(obj_);
18 } 17 }
19 operator T() const { 18 operator T() const {
20 return obj_; 19 return obj_;
21 } 20 }
22 private: 21 private:
23 T obj_; 22 T obj_;
24 DISALLOW_COPY_AND_ASSIGN(ScopedNonPtr); 23 DISALLOW_COPY_AND_ASSIGN(ScopedNonPtr);
25 }; 24 };
26 25
27 #endif // NATIVE_CLIENT_TESTS_SUBPROCESS_SCOPED_CLEANUP_H_ 26 #endif // NATIVE_CLIENT_TESTS_SUBPROCESS_SCOPED_CLEANUP_H_
OLDNEW
« no previous file with comments | « src/untrusted/init/scoped_lock.h ('k') | src/untrusted/init/simple_lock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698