Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ | 5 #ifndef BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ |
| 6 #define BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ | 6 #define BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Foundation/Foundation.h> | |
| 10 | |
| 9 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 10 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 11 | 13 |
| 12 namespace base { | 14 namespace base { |
| 13 namespace mac { | 15 namespace mac { |
| 14 | 16 |
| 15 // BrowserCrApplication attempts to restrict throwing of NSExceptions | 17 // BrowserCrApplication attempts to restrict throwing of NSExceptions |
| 16 // because they interact badly with C++ scoping rules. Unfortunately, | 18 // because they interact badly with C++ scoping rules. Unfortunately, |
| 17 // there are some cases where exceptions must be supported, such as | 19 // there are some cases where exceptions must be supported, such as |
| 18 // when third-party printer drivers are used. These helpers can be | 20 // when third-party printer drivers are used. These helpers can be |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 34 | 36 |
| 35 DISALLOW_COPY_AND_ASSIGN(ScopedNSExceptionEnabler); | 37 DISALLOW_COPY_AND_ASSIGN(ScopedNSExceptionEnabler); |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 // Access the exception setting for the current thread. This is for | 40 // Access the exception setting for the current thread. This is for |
| 39 // the support code in BrowserCrApplication, other code should use | 41 // the support code in BrowserCrApplication, other code should use |
| 40 // the scoper. | 42 // the scoper. |
| 41 BASE_EXPORT bool GetNSExceptionsAllowed(); | 43 BASE_EXPORT bool GetNSExceptionsAllowed(); |
| 42 BASE_EXPORT void SetNSExceptionsAllowed(bool allowed); | 44 BASE_EXPORT void SetNSExceptionsAllowed(bool allowed); |
| 43 | 45 |
| 46 // Calls [target performSelector:sel] with fatal-exceptions turned | |
|
Nico
2011/12/09 22:01:07
// Calls -performSelector:sel …
| |
| 47 // off, and returns the result. If an exception is thrown during the | |
| 48 // perform, nil is returned. | |
| 49 BASE_EXPORT id PerformSelectorIgnoringExceptions(NSObject* target, SEL sel); | |
|
Scott Hess - ex-Googler
2011/12/09 01:46:28
I wanted to have:
@implementation NSObject (AddlS
| |
| 50 | |
| 44 } // namespace mac | 51 } // namespace mac |
| 45 } // namespace base | 52 } // namespace base |
| 46 | 53 |
| 47 #endif // BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ | 54 #endif // BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ |
| OLD | NEW |