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

Side by Side Diff: chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.mm

Issue 2737373004: Check that a transaction is opened before closing it (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import <AppKit/AppKit.h> 5 #import <AppKit/AppKit.h>
6 #import <Foundation/Foundation.h> 6 #import <Foundation/Foundation.h>
7 7
8 #import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h" 8 #import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h"
9 9
10 @class NSUserNotificationCenter; 10 @class NSUserNotificationCenter;
(...skipping 17 matching lines...) Expand all
28 xpc_transaction_begin(); 28 xpc_transaction_begin();
29 transactionOpen_ = true; 29 transactionOpen_ = true;
30 } 30 }
31 } 31 }
32 32
33 - (void)closeTransactionIfNeeded { 33 - (void)closeTransactionIfNeeded {
34 @synchronized(self) { 34 @synchronized(self) {
35 NSUserNotificationCenter* notificationCenter = 35 NSUserNotificationCenter* notificationCenter =
36 [NSUserNotificationCenter defaultUserNotificationCenter]; 36 [NSUserNotificationCenter defaultUserNotificationCenter];
37 NSUInteger showing = [[notificationCenter deliveredNotifications] count]; 37 NSUInteger showing = [[notificationCenter deliveredNotifications] count];
38 if (showing == 0) { 38 if (showing == 0 && transactionOpen_) {
39 xpc_transaction_end(); 39 xpc_transaction_end();
40 transactionOpen_ = false; 40 transactionOpen_ = false;
41 } 41 }
42 } 42 }
43 } 43 }
44 @end 44 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698