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

Issue 7572031: Always call the class methods to save/restore contexts. (Closed)

Created:
9 years, 4 months ago by Avi (use Gerrit)
Modified:
9 years, 4 months ago
CC:
chromium-reviews, asanka, Randy Smith (Not in Mondays)
Visibility:
Public.

Description

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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=95611 Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=95631 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=95686

Patch Set 1 #

Patch Set 2 : ensure saving before context access #

Total comments: 25

Patch Set 3 : moar #

Patch Set 4 : style nits #

Patch Set 5 : style nits #

Total comments: 2

Patch Set 6 : not paranoia if they really are after you #

Patch Set 7 : nilling out current context #

Patch Set 8 : reword #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+119 lines, -99 lines) Patch
M chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/cocoa/download/download_item_cell.mm View 1 2 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/ui/cocoa/find_bar/find_bar_view.mm View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_view.mm View 1 2 4 chunks +79 lines, -75 lines 0 comments Download
M chrome/default_plugin/plugin_impl_mac.mm View 1 2 3 4 5 6 4 chunks +3 lines, -3 lines 0 comments Download
M ui/base/clipboard/clipboard_mac.mm View 1 2 3 3 chunks +2 lines, -1 line 0 comments Download
M ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h View 1 2 3 4 5 1 chunk +9 lines, -5 lines 0 comments Download
M ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm View 1 2 3 4 5 6 7 1 chunk +19 lines, -7 lines 1 comment Download

Messages

Total messages: 21 (0 generated)
Avi (use Gerrit)
You heard me right! Two reviewers!
9 years, 4 months ago (2011-08-04 22:10:58 UTC) #1
Robert Sesek
http://codereview.chromium.org/7572031/diff/2001/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h File ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h (left): http://codereview.chromium.org/7572031/diff/2001/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h#oldcode23 ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h:23: scoped_nsobject<NSGraphicsContext> context_; So if we were to be paranoid, ...
9 years, 4 months ago (2011-08-04 22:15:44 UTC) #2
Avi (use Gerrit)
http://codereview.chromium.org/7572031/diff/2001/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h File ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h (left): http://codereview.chromium.org/7572031/diff/2001/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h#oldcode23 ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h:23: scoped_nsobject<NSGraphicsContext> context_; You mean before the save context and ...
9 years, 4 months ago (2011-08-04 22:21:03 UTC) #3
Robert Sesek
http://codereview.chromium.org/7572031/diff/2001/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h File ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h (left): http://codereview.chromium.org/7572031/diff/2001/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h#oldcode23 ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h:23: scoped_nsobject<NSGraphicsContext> context_; On 2011/08/04 22:21:03, Avi wrote: > You ...
9 years, 4 months ago (2011-08-04 22:22:13 UTC) #4
Avi (use Gerrit)
But that seems to be the point of the save/restore; see hover_close_button where the scoper ...
9 years, 4 months ago (2011-08-04 22:24:22 UTC) #5
Mark Mentovai
I want more. http://codereview.chromium.org/7572031/diff/2001/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm File chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm (right): http://codereview.chromium.org/7572031/diff/2001/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm#newcode108 chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm:108: CGContextRef cgContext = (CGContextRef)[context graphicsPort]; Does ...
9 years, 4 months ago (2011-08-04 23:20:17 UTC) #6
Mark Mentovai
Fix CL description: Always → Allays.
9 years, 4 months ago (2011-08-04 23:26:49 UTC) #7
Mark Mentovai
rsesek@chromium.org wrote: > No, it'd prevent changing the current context within the scope of the ...
9 years, 4 months ago (2011-08-04 23:30:35 UTC) #8
Avi (use Gerrit)
http://codereview.chromium.org/7572031/diff/2001/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm File chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm (right): http://codereview.chromium.org/7572031/diff/2001/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm#newcode108 chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm:108: CGContextRef cgContext = (CGContextRef)[context graphicsPort]; On 2011/08/04 23:20:17, Mark ...
9 years, 4 months ago (2011-08-05 00:18:50 UTC) #9
Avi (use Gerrit)
ptal
9 years, 4 months ago (2011-08-05 00:23:22 UTC) #10
Mark Mentovai
LGTM If you wanted to add a DCHECK, it would be a DCHECK that [NSGraphicsContext ...
9 years, 4 months ago (2011-08-05 00:58:41 UTC) #11
Robert Sesek
On 2011/08/05 00:58:41, Mark Mentovai wrote: > LGTM > > If you wanted to add ...
9 years, 4 months ago (2011-08-05 01:02:33 UTC) #12
Avi (use Gerrit)
On 2011/08/05 01:02:33, rsesek wrote: > I'm in favor of this. I'm OK with this. ...
9 years, 4 months ago (2011-08-05 01:09:34 UTC) #13
Mark Mentovai
rsesek wrote: > I'm in favor of this. While we *may* want to be able ...
9 years, 4 months ago (2011-08-05 01:12:06 UTC) #14
Mark Mentovai
As an example, be mindful of these two legitimate uses. http://codereview.chromium.org/7572031/diff/7001/chrome/default_plugin/plugin_impl_mac.mm File chrome/default_plugin/plugin_impl_mac.mm (right): http://codereview.chromium.org/7572031/diff/7001/chrome/default_plugin/plugin_impl_mac.mm#newcode146 ...
9 years, 4 months ago (2011-08-05 01:15:44 UTC) #15
Robert Sesek
On 2011/08/05 01:12:06, Mark Mentovai wrote: > rsesek wrote: > > I'm in favor of ...
9 years, 4 months ago (2011-08-05 01:16:59 UTC) #16
Avi (use Gerrit)
ok
9 years, 4 months ago (2011-08-05 01:24:42 UTC) #17
Robert Sesek
LGTM! Thanks.
9 years, 4 months ago (2011-08-05 01:26:37 UTC) #18
Mark Mentovai
LGTM You could have used initializer format to set context_ although it doesn't matter. With ...
9 years, 4 months ago (2011-08-05 01:34:13 UTC) #19
Avi (use Gerrit)
ptal
9 years, 4 months ago (2011-08-05 22:09:23 UTC) #20
Mark Mentovai
9 years, 4 months ago (2011-08-05 22:11:32 UTC) #21
LGTM

http://codereview.chromium.org/7572031/diff/12001/ui/gfx/scoped_ns_graphics_c...
File ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm (right):

http://codereview.chromium.org/7572031/diff/12001/ui/gfx/scoped_ns_graphics_c...
ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm:26: // that stale context
(which is likely been dealloced) to remain current
(which is likely to be dealloced)

Powered by Google App Engine
This is Rietveld 408576698