Chromium Code Reviews| 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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "testing/platform_test.h" | 9 #include "testing/platform_test.h" |
| 10 | 10 |
| 11 // This test verifies assumptions about the murky world of interaction between | 11 // This test verifies assumptions about the murky world of interaction between |
| 12 // C++ objects and blocks. Just to make sure. | 12 // C++ objects and blocks. Just to make sure. |
| 13 // This class should not use ARC. When everything is ARC, it can be removed. | |
|
sdefresne
2017/02/13 14:15:57
This is my first time looking at this file (since
sdefresne
2017/02/14 10:04:24
As discussed on hangouts, remove this comment and
| |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 class RefCountedObject : public base::RefCounted<RefCountedObject> { | 17 class RefCountedObject : public base::RefCounted<RefCountedObject> { |
| 17 public: | 18 public: |
| 18 RefCountedObject() {} | 19 RefCountedObject() {} |
| 19 | 20 |
| 20 // Refcount is private in the superclass, fake it by counting how many times | 21 // Refcount is private in the superclass, fake it by counting how many times |
| 21 // release can be called until there is one count left, then retain the count | 22 // release can be called until there is one count left, then retain the count |
| 22 // back. | 23 // back. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 vector.push_back(22); | 92 vector.push_back(22); |
| 92 stack_block(); | 93 stack_block(); |
| 93 heap_block = [stack_block copy]; | 94 heap_block = [stack_block copy]; |
| 94 stack_block(); | 95 stack_block(); |
| 95 } | 96 } |
| 96 heap_block(); | 97 heap_block(); |
| 97 [heap_block release]; | 98 [heap_block release]; |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace | 101 } // namespace |
| OLD | NEW |