summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
authorrsesek <rsesek@chromium.org>2015-07-22 09:06:20 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-22 16:07:00 +0000
commit787e2b2d0110448a5added6c9aae8fc7f9134144 (patch)
tree3fcf06af87cdc26c0bedce9600d532bb5246f7a1 /base/mac
parent0b866e1ba9b26a8d39247e552ab5f4d62a8e238c (diff)
downloadchromium_src-787e2b2d0110448a5added6c9aae8fc7f9134144.zip
chromium_src-787e2b2d0110448a5added6c9aae8fc7f9134144.tar.gz
chromium_src-787e2b2d0110448a5added6c9aae8fc7f9134144.tar.bz2
Remove base/mac/scoped_nsexception_enabler.h.
Exception fatalisation is now handled via base::mac::CallWithEHFrame, so this file is unnecessary. The base::mac::ScopedNSExceptionEnabler is removed, since instantiating an NSException is no longer fatal (only an uncaught one is). base::mac::RunBlockIgnoringExceptions has been removed where possible or converted to a @try/@catch to swallow any exceptions. BUG=503128 R=shess@chromium.org Review URL: https://codereview.chromium.org/1233983004 Cr-Commit-Position: refs/heads/master@{#339884}
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/scoped_nsexception_enabler.h54
-rw-r--r--base/mac/scoped_nsexception_enabler.mm63
2 files changed, 0 insertions, 117 deletions
diff --git a/base/mac/scoped_nsexception_enabler.h b/base/mac/scoped_nsexception_enabler.h
deleted file mode 100644
index 484dd53..0000000
--- a/base/mac/scoped_nsexception_enabler.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_
-#define BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_
-
-#import <Foundation/Foundation.h>
-
-#include "base/base_export.h"
-#include "base/basictypes.h"
-
-namespace base {
-namespace mac {
-
-// BrowserCrApplication attempts to restrict throwing of NSExceptions
-// because they interact badly with C++ scoping rules. Unfortunately,
-// there are some cases where exceptions must be supported, such as
-// when third-party printer drivers are used. These helpers can be
-// used to enable exceptions for narrow windows.
-
-// Make it easy to safely allow NSException to be thrown in a limited
-// scope. Note that if an exception is thrown, then this object will
-// not be appropriately destructed! If the exception ends up in the
-// top-level event loop, things are cleared in -reportException:. If
-// the exception is caught at a lower level, a higher level scoper
-// should eventually reset things.
-class BASE_EXPORT ScopedNSExceptionEnabler {
- public:
- ScopedNSExceptionEnabler();
- ~ScopedNSExceptionEnabler();
-
- private:
- bool was_enabled_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedNSExceptionEnabler);
-};
-
-// Access the exception setting for the current thread. This is for
-// the support code in BrowserCrApplication, other code should use
-// the scoper.
-BASE_EXPORT bool GetNSExceptionsAllowed();
-BASE_EXPORT void SetNSExceptionsAllowed(bool allowed);
-
-// Executes |block| with fatal-exceptions turned off, and returns the
-// result. If an exception is thrown during the perform, nil is
-// returned.
-typedef id (^BlockReturningId)();
-BASE_EXPORT id RunBlockIgnoringExceptions(BlockReturningId block);
-
-} // namespace mac
-} // namespace base
-
-#endif // BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_
diff --git a/base/mac/scoped_nsexception_enabler.mm b/base/mac/scoped_nsexception_enabler.mm
deleted file mode 100644
index 7b8ad92..0000000
--- a/base/mac/scoped_nsexception_enabler.mm
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "base/mac/scoped_nsexception_enabler.h"
-
-#import "base/lazy_instance.h"
-#import "base/threading/thread_local.h"
-
-// To make the |g_exceptionsAllowed| declaration readable.
-using base::LazyInstance;
-using base::ThreadLocalBoolean;
-
-// When C++ exceptions are disabled, the C++ library defines |try| and
-// |catch| so as to allow exception-expecting C++ code to build properly when
-// language support for exceptions is not present. These macros interfere
-// with the use of |@try| and |@catch| in Objective-C files such as this one.
-// Undefine these macros here, after everything has been #included, since
-// there will be no C++ uses and only Objective-C uses from this point on.
-#undef try
-#undef catch
-
-namespace {
-
-// Whether to allow NSExceptions to be raised on the current thread.
-LazyInstance<ThreadLocalBoolean>::Leaky
- g_exceptionsAllowed = LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
-namespace base {
-namespace mac {
-
-bool GetNSExceptionsAllowed() {
- return g_exceptionsAllowed.Get().Get();
-}
-
-void SetNSExceptionsAllowed(bool allowed) {
- return g_exceptionsAllowed.Get().Set(allowed);
-}
-
-id RunBlockIgnoringExceptions(BlockReturningId block) {
- id ret = nil;
- @try {
- base::mac::ScopedNSExceptionEnabler enable;
- ret = block();
- }
- @catch(id exception) {
- }
- return ret;
-}
-
-ScopedNSExceptionEnabler::ScopedNSExceptionEnabler() {
- was_enabled_ = GetNSExceptionsAllowed();
- SetNSExceptionsAllowed(true);
-}
-
-ScopedNSExceptionEnabler::~ScopedNSExceptionEnabler() {
- SetNSExceptionsAllowed(was_enabled_);
-}
-
-} // namespace mac
-} // namespace base