| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // 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 | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" | 
| 6 | 6 | 
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" | 
| 8 #include "base/bind.h" | 8 #include "base/bind.h" | 
| 9 #include "base/callback.h" | 9 #include "base/callback.h" | 
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" | 
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 662     inline void operator()(int* x) { delete x; } | 662     inline void operator()(int* x) { delete x; } | 
| 663   }; | 663   }; | 
| 664   scoped_ptr<int, CustomDeleter> x(new int); | 664   scoped_ptr<int, CustomDeleter> x(new int); | 
| 665   EXPECT_DEATH(x.reset(x.get()), ""); | 665   EXPECT_DEATH(x.reset(x.get()), ""); | 
| 666 } | 666 } | 
| 667 #endif | 667 #endif | 
| 668 | 668 | 
| 669 TEST(ScopedPtrTest, SelfResetWithCustomDeleterOptOut) { | 669 TEST(ScopedPtrTest, SelfResetWithCustomDeleterOptOut) { | 
| 670   // A custom deleter should be able to opt out of self-reset abort behavior. | 670   // A custom deleter should be able to opt out of self-reset abort behavior. | 
| 671   struct NoOpDeleter { | 671   struct NoOpDeleter { | 
|  | 672 #if !defined(NDEBUG) | 
| 672     typedef void AllowSelfReset; | 673     typedef void AllowSelfReset; | 
|  | 674 #endif | 
| 673     inline void operator()(int*) {} | 675     inline void operator()(int*) {} | 
| 674   }; | 676   }; | 
| 675   scoped_ptr<int> owner(new int); | 677   scoped_ptr<int> owner(new int); | 
| 676   scoped_ptr<int, NoOpDeleter> x(owner.get()); | 678   scoped_ptr<int, NoOpDeleter> x(owner.get()); | 
| 677   x.reset(x.get()); | 679   x.reset(x.get()); | 
| 678 } | 680 } | 
| OLD | NEW | 
|---|