diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-05 17:19:11 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-05 17:19:11 +0000 |
commit | 56c39f543883334c854502dd92f769de7c85d5bc (patch) | |
tree | 2fb8939b6ed76db292d21b62c9f5422806201040 /ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h | |
parent | 54ccbd1473f09f07a8fd49a58aec05ab10eed465 (diff) | |
download | chromium_src-56c39f543883334c854502dd92f769de7c85d5bc.zip chromium_src-56c39f543883334c854502dd92f769de7c85d5bc.tar.gz chromium_src-56c39f543883334c854502dd92f769de7c85d5bc.tar.bz2 |
Revert 95611 - Always call the class methods to save/restore contexts.
If the current context was ever nil, sending a "restore" message would be a no-op and would likely leave an out-of-scope context as current.
BUG=90140
TEST=repeatedly select items in an open file dialog in column mode; no crash
Review URL: http://codereview.chromium.org/7572031
TBR=avi@chromium.org
Review URL: http://codereview.chromium.org/7541043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h')
-rw-r--r-- | ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h b/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h index 4826bcc..05bf5f6 100644 --- a/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h +++ b/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h @@ -4,27 +4,23 @@ #ifndef UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_ #define UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_ -#pragma once -#include "base/basictypes.h" #include "ui/ui_api.h" +#include "base/basictypes.h" +#include "base/memory/scoped_nsobject.h" -#if defined(__OBJC__) @class NSGraphicsContext; -#else -class NSGraphicsContext; -#endif namespace gfx { -// A class to save/restore the state of the current context. class UI_API ScopedNSGraphicsContextSaveGState { public: - ScopedNSGraphicsContextSaveGState(); + // If |context| is nil, it will use the |+currentContext|. + explicit ScopedNSGraphicsContextSaveGState(NSGraphicsContext* context = nil); ~ScopedNSGraphicsContextSaveGState(); private: - NSGraphicsContext* context_; // weak + scoped_nsobject<NSGraphicsContext> context_; DISALLOW_COPY_AND_ASSIGN(ScopedNSGraphicsContextSaveGState); }; |