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

Side by Side Diff: base/i18n/icu_util.cc

Issue 156333002: Enable icu_use_data_file_flag on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: icudtl.dat made readable Created 6 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 unified diff | Download patch | Annotate | Revision Log
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 #include "base/i18n/icu_util.h" 5 #include "base/i18n/icu_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 // Chrome doesn't normally shut down ICU, so the mapped data shouldn't ever 88 // Chrome doesn't normally shut down ICU, so the mapped data shouldn't ever
89 // be released. 89 // be released.
90 CR_DEFINE_STATIC_LOCAL(base::MemoryMappedFile, mapped_file, ()); 90 CR_DEFINE_STATIC_LOCAL(base::MemoryMappedFile, mapped_file, ());
91 if (!mapped_file.IsValid()) { 91 if (!mapped_file.IsValid()) {
92 #if !defined(OS_MACOSX) 92 #if !defined(OS_MACOSX)
93 FilePath data_path; 93 FilePath data_path;
94 #if defined(OS_WIN) 94 #if defined(OS_WIN)
95 // The data file will be in the same directory as the current module. 95 // The data file will be in the same directory as the current module.
96 bool path_ok = PathService::Get(base::DIR_MODULE, &data_path); 96 bool path_ok = PathService::Get(base::DIR_MODULE, &data_path);
97 #elif defined(OS_ANDROID)
98 bool path_ok = PathService::Get(base::DIR_ANDROID_APP_DATA, &data_path);
97 #else 99 #else
98 // For now, expect the data file to be alongside the executable. 100 // For now, expect the data file to be alongside the executable.
99 // This is sufficient while we work on unit tests, but will eventually 101 // This is sufficient while we work on unit tests, but will eventually
100 // likely live in a data directory. 102 // likely live in a data directory.
101 bool path_ok = PathService::Get(base::DIR_EXE, &data_path); 103 bool path_ok = PathService::Get(base::DIR_EXE, &data_path);
102 #endif 104 #endif
103 DCHECK(path_ok); 105 DCHECK(path_ok);
104 data_path = data_path.AppendASCII(ICU_UTIL_DATA_FILE_NAME); 106 data_path = data_path.AppendASCII(ICU_UTIL_DATA_FILE_NAME);
107 DVLOG(0) << "Looking for the icudata at " << data_path.AsUTF8Unsafe();
Mark Mentovai 2014/02/10 20:07:13 Necessary, or just spammy? There are already DLOG(
105 #else 108 #else
106 // Assume it is in the framework bundle's Resources directory. 109 // Assume it is in the framework bundle's Resources directory.
107 FilePath data_path = 110 FilePath data_path =
108 base::mac::PathForFrameworkBundleResource(CFSTR(ICU_UTIL_DATA_FILE_NAME)); 111 base::mac::PathForFrameworkBundleResource(CFSTR(ICU_UTIL_DATA_FILE_NAME));
109 if (data_path.empty()) { 112 if (data_path.empty()) {
110 DLOG(ERROR) << ICU_UTIL_DATA_FILE_NAME << " not found in bundle"; 113 DLOG(ERROR) << ICU_UTIL_DATA_FILE_NAME << " not found in bundle";
111 return false; 114 return false;
112 } 115 }
113 #endif // OS check 116 #endif // OS check
114 if (!mapped_file.Initialize(data_path)) { 117 if (!mapped_file.Initialize(data_path)) {
115 DLOG(ERROR) << "Couldn't mmap " << data_path.AsUTF8Unsafe(); 118 DLOG(ERROR) << "Couldn't mmap " << data_path.AsUTF8Unsafe();
116 return false; 119 return false;
117 } 120 }
118 } 121 }
119 UErrorCode err = U_ZERO_ERROR; 122 UErrorCode err = U_ZERO_ERROR;
120 udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err); 123 udata_setCommonData(const_cast<uint8*>(mapped_file.data()), &err);
121 return err == U_ZERO_ERROR; 124 return err == U_ZERO_ERROR;
122 #endif 125 #endif
123 } 126 }
124 127
125 } // namespace i18n 128 } // namespace i18n
126 } // namespace base 129 } // namespace base
OLDNEW
« no previous file with comments | « DEPS ('k') | build/android/pylib/gtest/setup.py » ('j') | build/common.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698