Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: base/mac/scoped_nsexception_enabler.h

Issue 7474010: mac: Components build for base, easy part (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/mac/scoped_nsautorelease_pool.h ('k') | base/mach_ipc_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/base_api.h"
9 #include "base/basictypes.h" 10 #include "base/basictypes.h"
10 11
11 namespace base { 12 namespace base {
12 namespace mac { 13 namespace mac {
13 14
14 // BrowserCrApplication attempts to restrict throwing of NSExceptions 15 // BrowserCrApplication attempts to restrict throwing of NSExceptions
15 // because they interact badly with C++ scoping rules. Unfortunately, 16 // because they interact badly with C++ scoping rules. Unfortunately,
16 // there are some cases where exceptions must be supported, such as 17 // there are some cases where exceptions must be supported, such as
17 // when third-party printer drivers are used. These helpers can be 18 // when third-party printer drivers are used. These helpers can be
18 // used to enable exceptions for narrow windows. 19 // used to enable exceptions for narrow windows.
19 20
20 // Make it easy to safely allow NSException to be thrown in a limited 21 // Make it easy to safely allow NSException to be thrown in a limited
21 // scope. Note that if an exception is thrown, then this object will 22 // scope. Note that if an exception is thrown, then this object will
22 // not be appropriately destructed! If the exception ends up in the 23 // not be appropriately destructed! If the exception ends up in the
23 // top-level event loop, things are cleared in -reportException:. If 24 // top-level event loop, things are cleared in -reportException:. If
24 // the exception is caught at a lower level, a higher level scoper 25 // the exception is caught at a lower level, a higher level scoper
25 // should eventually reset things. 26 // should eventually reset things.
26 class ScopedNSExceptionEnabler { 27 class BASE_API ScopedNSExceptionEnabler {
27 public: 28 public:
28 ScopedNSExceptionEnabler(); 29 ScopedNSExceptionEnabler();
29 ~ScopedNSExceptionEnabler(); 30 ~ScopedNSExceptionEnabler();
30 31
31 private: 32 private:
32 bool was_enabled_; 33 bool was_enabled_;
33 34
34 DISALLOW_COPY_AND_ASSIGN(ScopedNSExceptionEnabler); 35 DISALLOW_COPY_AND_ASSIGN(ScopedNSExceptionEnabler);
35 }; 36 };
36 37
37 // Access the exception setting for the current thread. This is for 38 // Access the exception setting for the current thread. This is for
38 // the support code in BrowserCrApplication, other code should use 39 // the support code in BrowserCrApplication, other code should use
39 // the scoper. 40 // the scoper.
40 bool GetNSExceptionsAllowed(); 41 BASE_API bool GetNSExceptionsAllowed();
41 void SetNSExceptionsAllowed(bool allowed); 42 BASE_API void SetNSExceptionsAllowed(bool allowed);
42 43
43 } // namespace mac 44 } // namespace mac
44 } // namespace base 45 } // namespace base
45 46
46 #endif // BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_ 47 #endif // BASE_MAC_SCOPED_NSEXCEPTION_ENABLER_H_
OLDNEW
« no previous file with comments | « base/mac/scoped_nsautorelease_pool.h ('k') | base/mach_ipc_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698