| OLD | NEW | 
|---|
| 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_ | 
| OLD | NEW | 
|---|