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

Side by Side Diff: base/base_paths_android.cc

Issue 1914983002: Add CHECK in case PathProviderAndroid is failing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Defines base::PathProviderAndroid which replaces base::PathProviderPosix for 5 // Defines base::PathProviderAndroid which replaces base::PathProviderPosix for
6 // Android in base/path_service.cc. 6 // Android in base/path_service.cc.
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
11 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
12 #include "base/android/path_utils.h" 12 #include "base/android/path_utils.h"
13 #include "base/base_paths.h" 13 #include "base/base_paths.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/process/process_metrics.h" 17 #include "base/process/process_metrics.h"
18 18
19 namespace base { 19 namespace base {
20 20
21 bool PathProviderAndroid(int key, FilePath* result) { 21 bool PathProviderAndroid(int key, FilePath* result) {
22 switch (key) { 22 switch (key) {
23 case base::FILE_EXE: { 23 case base::FILE_EXE: {
24 char bin_dir[PATH_MAX + 1]; 24 char bin_dir[PATH_MAX + 1];
25 int bin_dir_size = readlink(kProcSelfExe, bin_dir, PATH_MAX); 25 int bin_dir_size = readlink(kProcSelfExe, bin_dir, PATH_MAX);
26 if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) { 26 if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) {
27 NOTREACHED() << "Unable to resolve " << kProcSelfExe << "."; 27 // TODO(falken): This CHECK is for debugging crbug.com/600226.
28 // Revert to NOTREACHED when the cause of the bug is understood.
29 CHECK(false) << "Unable to resolve " << kProcSelfExe
30 << ". bin_dir_size=" << bin_dir_size
31 << ", errno=" << errno;
Torne 2016/04/25 09:41:54 Use PCHECK here instead of including errno this wa
falken 2016/04/25 12:52:58 Ah, didn't know that existed. Done. I also removed
28 return false; 32 return false;
29 } 33 }
30 bin_dir[bin_dir_size] = 0; 34 bin_dir[bin_dir_size] = 0;
31 *result = FilePath(bin_dir); 35 *result = FilePath(bin_dir);
32 return true; 36 return true;
33 } 37 }
34 case base::FILE_MODULE: 38 case base::FILE_MODULE:
35 // dladdr didn't work in Android as only the file name was returned. 39 // dladdr didn't work in Android as only the file name was returned.
36 NOTIMPLEMENTED(); 40 NOTIMPLEMENTED();
37 return false; 41 return false;
(...skipping 14 matching lines...) Expand all
52 return base::android::GetExternalStorageDirectory(result); 56 return base::android::GetExternalStorageDirectory(result);
53 default: 57 default:
54 // Note: the path system expects this function to override the default 58 // Note: the path system expects this function to override the default
55 // behavior. So no need to log an error if we don't support a given 59 // behavior. So no need to log an error if we don't support a given
56 // path. The system will just use the default. 60 // path. The system will just use the default.
57 return false; 61 return false;
58 } 62 }
59 } 63 }
60 64
61 } // namespace base 65 } // namespace base
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