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

Unified Diff: chrome/browser/ui/cocoa/notifications/alert_notification_service.mm

Issue 2790683002: [Mac] Set the ptype and pid Crashpad annotations for AlertNotificationService.xpc. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
diff --git a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
index 528e198b6fad9f6c0d3a80010173a5109f479bd5..488006a8abd12f197404953645df20371690619e 100644
--- a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
+++ b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
@@ -4,20 +4,41 @@
#import "chrome/browser/ui/cocoa/notifications/alert_notification_service.h"
+#include <unistd.h>
+
#import "base/mac/scoped_nsobject.h"
+#include "base/strings/string_number_conversions.h"
#import "chrome/browser/ui/cocoa/notifications/notification_builder_mac.h"
#include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h"
#import "chrome/browser/ui/cocoa/notifications/xpc_transaction_handler.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
+#include "third_party/crashpad/crashpad/client/crashpad_info.h"
+#include "third_party/crashpad/crashpad/client/simple_string_dictionary.h"
@class NSUserNotificationCenter;
+namespace {
+
+crashpad::SimpleStringDictionary* GetCrashpadAnnotations() {
+ static crashpad::SimpleStringDictionary* annotations = []() {
+ auto* annotations = new crashpad::SimpleStringDictionary();
+ annotations->SetKeyValue("ptype", "AlertNotificationService.xpc");
+ annotations->SetKeyValue("pid", base::IntToString(getpid()).c_str());
+ return annotations;
+ }();
+ return annotations;
+}
+
+} // namespace
+
@implementation AlertNotificationService {
XPCTransactionHandler* transactionHandler_;
// Ensures that the XPC service has been configured for crash reporting.
// Other messages should not be sent to a new instance of the service
// before -setMachExceptionPort: is called.
+ // Because XPC callouts occur on a concurrent dispatch queue, this must be
+ // accessed in a @synchronized(self) block.
BOOL didSetExceptionPort_;
}
@@ -35,9 +56,18 @@
return;
}
- crashpad::CrashpadClient client;
- didSetExceptionPort_ = client.SetHandlerMachPort(std::move(sendRight));
- DCHECK(didSetExceptionPort_);
+ @synchronized(self) {
+ if (didSetExceptionPort_) {
+ return;
+ }
+
+ crashpad::CrashpadClient client;
+ didSetExceptionPort_ = client.SetHandlerMachPort(std::move(sendRight));
+ DCHECK(didSetExceptionPort_);
+
+ crashpad::CrashpadInfo::GetCrashpadInfo()->set_simple_annotations(
+ GetCrashpadAnnotations());
+ }
}
- (void)deliverNotification:(NSDictionary*)notificationData {
« 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