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

Side by Side Diff: base/base_paths_android.cc

Issue 1959153003: Revert of Add CHECK in case PathProviderAndroid is failing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 // TODO(falken): This PCHECK is for debugging crbug.com/600226. 26 if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) {
27 // Revert to NOTREACHED when the cause of the bug is understood. 27 NOTREACHED() << "Unable to resolve " << kProcSelfExe << ".";
28 PCHECK(bin_dir_size > 0 && bin_dir_size <= PATH_MAX) 28 return false;
29 << "Unable to resolve " << kProcSelfExe 29 }
30 << ". bin_dir_size=" << bin_dir_size;
31 bin_dir[bin_dir_size] = 0; 30 bin_dir[bin_dir_size] = 0;
32 *result = FilePath(bin_dir); 31 *result = FilePath(bin_dir);
33 return true; 32 return true;
34 } 33 }
35 case base::FILE_MODULE: 34 case base::FILE_MODULE:
36 // dladdr didn't work in Android as only the file name was returned. 35 // dladdr didn't work in Android as only the file name was returned.
37 NOTIMPLEMENTED(); 36 NOTIMPLEMENTED();
38 return false; 37 return false;
39 case base::DIR_MODULE: 38 case base::DIR_MODULE:
40 return base::android::GetNativeLibraryDirectory(result); 39 return base::android::GetNativeLibraryDirectory(result);
(...skipping 12 matching lines...) Expand all
53 return base::android::GetExternalStorageDirectory(result); 52 return base::android::GetExternalStorageDirectory(result);
54 default: 53 default:
55 // Note: the path system expects this function to override the default 54 // Note: the path system expects this function to override the default
56 // behavior. So no need to log an error if we don't support a given 55 // behavior. So no need to log an error if we don't support a given
57 // path. The system will just use the default. 56 // path. The system will just use the default.
58 return false; 57 return false;
59 } 58 }
60 } 59 }
61 60
62 } // namespace base 61 } // 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