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

Side by Side Diff: ui/base/resource/resource_bundle_android.cc

Issue 2298513002: 🔖 Remove unmapped histogram ResourceBundle.LoadLocaleResourcesError (Closed)
Patch Set: remove other histogram Created 4 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
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | 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 #include "ui/base/resource/resource_bundle_android.h" 5 #include "ui/base/resource/resource_bundle_android.h"
6 6
7 #include "base/android/apk_assets.h" 7 #include "base/android/apk_assets.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h"
12 #include "base/path_service.h" 11 #include "base/path_service.h"
13 #include "jni/ResourceBundle_jni.h" 12 #include "jni/ResourceBundle_jni.h"
14 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/resource/data_pack.h" 14 #include "ui/base/resource/data_pack.h"
16 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/base/ui_base_paths.h" 16 #include "ui/base/ui_base_paths.h"
18 17
19 namespace ui { 18 namespace ui {
20 19
21 namespace { 20 namespace {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return std::string(); 101 return std::string();
103 } 102 }
104 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; 103 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
105 g_locale_pack_fd = base::File(locale_file_path, flags).TakePlatformFile(); 104 g_locale_pack_fd = base::File(locale_file_path, flags).TakePlatformFile();
106 g_locale_pack_region = base::MemoryMappedFile::Region::kWholeFile; 105 g_locale_pack_region = base::MemoryMappedFile::Region::kWholeFile;
107 } 106 }
108 107
109 std::unique_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); 108 std::unique_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P));
110 if (!data_pack->LoadFromFileRegion(base::File(g_locale_pack_fd), 109 if (!data_pack->LoadFromFileRegion(base::File(g_locale_pack_fd),
111 g_locale_pack_region)) { 110 g_locale_pack_region)) {
112 UMA_HISTOGRAM_ENUMERATION("ResourceBundle.LoadLocaleResourcesError",
113 logging::GetLastSystemErrorCode(), 16000);
114 LOG(ERROR) << "failed to load locale.pak"; 111 LOG(ERROR) << "failed to load locale.pak";
115 NOTREACHED(); 112 NOTREACHED();
116 return std::string(); 113 return std::string();
117 } 114 }
118 115
119 locale_resources_data_.reset(data_pack.release()); 116 locale_resources_data_.reset(data_pack.release());
120 return app_locale; 117 return app_locale;
121 } 118 }
122 119
123 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { 120 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 base::android::ScopedJavaLocalRef<jstring> ret = 160 base::android::ScopedJavaLocalRef<jstring> ret =
164 Java_ResourceBundle_getLocalePakResourcePath( 161 Java_ResourceBundle_getLocalePakResourcePath(
165 env, base::android::ConvertUTF8ToJavaString(env, locale)); 162 env, base::android::ConvertUTF8ToJavaString(env, locale));
166 if (ret.obj() == nullptr) { 163 if (ret.obj() == nullptr) {
167 return std::string(); 164 return std::string();
168 } 165 }
169 return base::android::ConvertJavaStringToUTF8(env, ret.obj()); 166 return base::android::ConvertJavaStringToUTF8(env, ret.obj());
170 } 167 }
171 168
172 } // namespace ui 169 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698