Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 BASE_TEST_SCOPED_CLASS_SWIZZLER_MAC_H_ | |
| 6 #define BASE_TEST_SCOPED_CLASS_SWIZZLER_MAC_H_ | |
| 7 | |
| 8 #import <objc/runtime.h> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 | |
| 12 namespace base { | |
| 13 | |
| 14 // Within a given scope, replace the selector |selector| on |target| with that | |
|
Robert Sesek
2014/07/21 15:59:01
We have this code also in //chrome/common/mac/objc
Mark Mentovai
2014/07/21 16:09:58
rsesek wrote:
tapted
2014/07/22 12:53:49
Done. I've merged the implementations. Or, more ac
Robert Sesek
2014/07/22 13:59:21
Yes, I like the Donor pattern.
tapted
2014/07/22 23:41:44
Done.
| |
| 15 // from |source|. | |
| 16 class ScopedClassSwizzler { | |
|
Mark Mentovai
2014/07/21 16:09:58
This should say ObjC in its name, and the filename
tapted
2014/07/22 12:53:49
Done (but dropped the _mac - seems more consistent
| |
| 17 public: | |
| 18 ScopedClassSwizzler(Class target, Class source, SEL selector); | |
| 19 ~ScopedClassSwizzler(); | |
| 20 | |
| 21 private: | |
| 22 Method old_selector_impl_; | |
| 23 Method new_selector_impl_; | |
| 24 | |
| 25 DISALLOW_COPY_AND_ASSIGN(ScopedClassSwizzler); | |
| 26 }; | |
| 27 | |
| 28 } // namespace base | |
| 29 | |
| 30 #endif // BASE_TEST_SCOPED_CLASS_SWIZZLER_MAC_H_ | |
| OLD | NEW |