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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 2695923008: Add a temporary crash key to debug nib loading issues. (Closed)
Patch Set: Use stat() to test for the nib's existence and include error in the crash key Created 3 years, 10 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 | chrome/common/crash_keys.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
index 2ab43137c90eec2e8a2a4f3dd3c826f2a42eee9a..0ca5ca8feb798fd732006ce7623c267ea613fbb6 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -6,6 +6,7 @@
#include <algorithm>
Robert Sesek 2017/02/16 00:25:16 #include <sys/stat.h>
Sidney San Martín 2017/02/16 02:17:42 Done.
+#include "base/debug/crash_logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
@@ -52,6 +53,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
+#include "chrome/common/crash_keys.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
@@ -252,6 +254,21 @@ class NotificationBridge : public AppMenuIconController::Delegate {
}
- (void)viewDidLoad {
+ base::debug::ScopedCrashKey nib_crash_key{
Robert Sesek 2017/02/16 00:25:16 naming: nibCrashKey
Sidney San Martín 2017/02/16 02:17:42 Done.
+ crash_keys::mac::kToolbarNibInfo, [&] {
+ auto nibPath =
+ [self.nibBundle pathForResource:@"Toolbar" ofType:@"nib"];
+ struct stat sb;
+ stat(nibPath.UTF8String, &sb);
Robert Sesek 2017/02/16 00:25:16 fileSystemRepresentation
Sidney San Martín 2017/02/16 02:17:42 Done.
+ auto nibErrno = errno;
Robert Sesek 2017/02/16 00:25:16 errno here may be something unrelated if stat retu
Sidney San Martín 2017/02/16 02:17:42 Done.
+ auto closestPath = nibPath;
+ while (closestPath && stat(closestPath.UTF8String, &sb) != 0) {
+ closestPath = [closestPath stringByDeletingLastPathComponent];
+ }
+ return [NSString stringWithFormat:@"errno: %d nib: %@ closest: %@",
+ nibErrno, nibPath, closestPath];
+ }().UTF8String};
+
// When linking and running on 10.10+, both -awakeFromNib and -viewDidLoad may
// be called, don't initialize twice.
if (locationBarView_) {
« no previous file with comments | « no previous file | chrome/common/crash_keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698