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

Side by Side Diff: ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h

Issue 7572031: Always call the class methods to save/restore contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ensure saving before context access 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
Mark Mentovai 2011/08/04 23:20:17 See also third_party/WebKit/Source/WebCore/platfor
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 UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_ 5 #ifndef UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_
6 #define UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_ 6 #define UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_
7 7
Mark Mentovai 2011/08/04 23:20:17 Add #pragma once.
Avi (use Gerrit) 2011/08/05 00:18:50 Done.
8 #include "ui/ui_api.h" 8 #include "ui/ui_api.h"
Mark Mentovai 2011/08/04 23:20:17 Sort headers: base < ui.
Avi (use Gerrit) 2011/08/05 00:18:50 Done.
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_nsobject.h"
11 10
12 @class NSGraphicsContext; 11 @class NSGraphicsContext;
Mark Mentovai 2011/08/04 23:20:17 I would do: #if defined(__OBJC__) @class NSGraphi
Avi (use Gerrit) 2011/08/05 00:18:50 Removed; not needed.
13 12
14 namespace gfx { 13 namespace gfx {
15 14
15 // A class to save/restore the state of the current context.
16 class UI_API ScopedNSGraphicsContextSaveGState { 16 class UI_API ScopedNSGraphicsContextSaveGState {
17 public: 17 public:
18 // If |context| is nil, it will use the |+currentContext|. 18 ScopedNSGraphicsContextSaveGState();
19 explicit ScopedNSGraphicsContextSaveGState(NSGraphicsContext* context = nil);
20 ~ScopedNSGraphicsContextSaveGState(); 19 ~ScopedNSGraphicsContextSaveGState();
21 20
22 private:
23 scoped_nsobject<NSGraphicsContext> context_;
Robert Sesek 2011/08/04 22:15:44 So if we were to be paranoid, we'd keep a weak ptr
Avi (use Gerrit) 2011/08/04 22:21:03 You mean before the save context and after the res
Robert Sesek 2011/08/04 22:22:13 No, it'd prevent changing the current context with
24
25 DISALLOW_COPY_AND_ASSIGN(ScopedNSGraphicsContextSaveGState); 21 DISALLOW_COPY_AND_ASSIGN(ScopedNSGraphicsContextSaveGState);
Mark Mentovai 2011/08/04 23:20:17 This needs to be in a private: section.
Avi (use Gerrit) 2011/08/05 00:18:50 Done.
26 }; 22 };
27 23
28 } // namespace gfx 24 } // namespace gfx
29 25
30 #endif // UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_ 26 #endif // UI_GFX_SCOPED_NS_GRAPHICS_CONTEXT_SAVE_GSTATE_MAC_H_
Mark Mentovai 2011/08/04 23:20:17 Additional potential interface abuse occurs in: O
Mark Mentovai 2011/08/04 23:20:17 Also, note http://code.google.com/p/chromium/issue
Avi (use Gerrit) 2011/08/05 00:18:50 For draw routines, AppKit is responsible for setup
Avi (use Gerrit) 2011/08/05 00:18:50 Now it's good.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698