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

Side by Side Diff: content/common/sandbox_mac.mm

Issue 7849011: Refactor Mac crash key reporting - move to base/mac/crash_logging.{h,mm} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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.
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 #include "content/common/sandbox_mac.h" 5 #include "content/common/sandbox_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #import <OpenGL/OpenGL.h> 8 #import <OpenGL/OpenGL.h>
9 9
10 extern "C" { 10 extern "C" {
11 #include <sandbox.h> 11 #include <sandbox.h>
12 } 12 }
13 #include <signal.h> 13 #include <signal.h>
14 #include <sys/param.h> 14 #include <sys/param.h>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/file_util.h" 18 #include "base/file_util.h"
19 #include "base/mac/crash_logging.h"
19 #include "base/mac/mac_util.h" 20 #include "base/mac/mac_util.h"
20 #include "base/rand_util_c.h" 21 #include "base/rand_util_c.h"
21 #include "base/mac/scoped_cftyperef.h" 22 #include "base/mac/scoped_cftyperef.h"
22 #include "base/mac/scoped_nsautorelease_pool.h" 23 #include "base/mac/scoped_nsautorelease_pool.h"
23 #include "base/string16.h" 24 #include "base/string16.h"
24 #include "base/string_util.h" 25 #include "base/string_util.h"
25 #include "base/stringprintf.h" 26 #include "base/stringprintf.h"
26 #include "base/sys_info.h" 27 #include "base/sys_info.h"
27 #include "base/sys_string_conversions.h" 28 #include "base/sys_string_conversions.h"
28 #include "base/utf_string_conversions.h" 29 #include "base/utf_string_conversions.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 << " " 553 << " "
553 << error_buff; 554 << error_buff;
554 sandbox_free_error(error_buff); 555 sandbox_free_error(error_buff);
555 return success; 556 return success;
556 } 557 }
557 558
558 // static 559 // static
559 void Sandbox::GetCanonicalSandboxPath(FilePath* path) { 560 void Sandbox::GetCanonicalSandboxPath(FilePath* path) {
560 int fd = HANDLE_EINTR(open(path->value().c_str(), O_RDONLY)); 561 int fd = HANDLE_EINTR(open(path->value().c_str(), O_RDONLY));
561 if (fd < 0) { 562 if (fd < 0) {
563 base::mac::SetCrashKeyValue(
564 @"errno", [NSString stringWithFormat:@"%d", errno]);
565 base::mac::SetCrashKeyValue(@"homedir", NSHomeDirectory());
566
562 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " 567 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: "
563 << path->value(); 568 << path->value();
564 return; 569 return;
565 } 570 }
566 file_util::ScopedFD file_closer(&fd); 571 file_util::ScopedFD file_closer(&fd);
567 572
568 FilePath::CharType canonical_path[MAXPATHLEN]; 573 FilePath::CharType canonical_path[MAXPATHLEN];
569 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { 574 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) {
570 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " 575 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: "
571 << path->value(); 576 << path->value();
572 return; 577 return;
573 } 578 }
574 579
575 *path = FilePath(canonical_path); 580 *path = FilePath(canonical_path);
576 } 581 }
577 582
578 } // namespace sandbox 583 } // namespace sandbox
OLDNEW
« chrome/common/child_process_logging_mac.mm ('K') | « chrome/common/mac/objc_zombie.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698