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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 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 | « base/i18n/icu_string_conversions.cc ('k') | base/i18n/message_formatter.h » ('j') | 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 "base/i18n/icu_util.h" 5 #include "base/i18n/icu_util.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (g_icudtl_mapped_file) { 177 if (g_icudtl_mapped_file) {
178 g_debug_icu_load = 0; // To debug http://crbug.com/445616. 178 g_debug_icu_load = 0; // To debug http://crbug.com/445616.
179 return true; 179 return true;
180 } 180 }
181 if (data_fd == kInvalidPlatformFile) { 181 if (data_fd == kInvalidPlatformFile) {
182 g_debug_icu_load = 1; // To debug http://crbug.com/445616. 182 g_debug_icu_load = 1; // To debug http://crbug.com/445616.
183 LOG(ERROR) << "Invalid file descriptor to ICU data received."; 183 LOG(ERROR) << "Invalid file descriptor to ICU data received.";
184 return false; 184 return false;
185 } 185 }
186 186
187 scoped_ptr<MemoryMappedFile> icudtl_mapped_file(new MemoryMappedFile()); 187 std::unique_ptr<MemoryMappedFile> icudtl_mapped_file(new MemoryMappedFile());
188 if (!icudtl_mapped_file->Initialize(File(data_fd), data_region)) { 188 if (!icudtl_mapped_file->Initialize(File(data_fd), data_region)) {
189 g_debug_icu_load = 2; // To debug http://crbug.com/445616. 189 g_debug_icu_load = 2; // To debug http://crbug.com/445616.
190 LOG(ERROR) << "Couldn't mmap icu data file"; 190 LOG(ERROR) << "Couldn't mmap icu data file";
191 return false; 191 return false;
192 } 192 }
193 g_icudtl_mapped_file = icudtl_mapped_file.release(); 193 g_icudtl_mapped_file = icudtl_mapped_file.release();
194 194
195 UErrorCode err = U_ZERO_ERROR; 195 UErrorCode err = U_ZERO_ERROR;
196 udata_setCommonData(const_cast<uint8_t*>(g_icudtl_mapped_file->data()), &err); 196 udata_setCommonData(const_cast<uint8_t*>(g_icudtl_mapped_file->data()), &err);
197 if (err != U_ZERO_ERROR) { 197 if (err != U_ZERO_ERROR) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 #endif 303 #endif
304 #endif 304 #endif
305 305
306 // To respond to the timezone change properly, the default timezone 306 // To respond to the timezone change properly, the default timezone
307 // cache in ICU has to be populated on starting up. 307 // cache in ICU has to be populated on starting up.
308 // TODO(jungshik): Some callers do not care about tz at all. If necessary, 308 // TODO(jungshik): Some callers do not care about tz at all. If necessary,
309 // add a boolean argument to this function to init'd the default tz only 309 // add a boolean argument to this function to init'd the default tz only
310 // when requested. 310 // when requested.
311 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 311 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
312 if (result) 312 if (result)
313 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); 313 std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
314 #endif 314 #endif
315 return result; 315 return result;
316 } 316 }
317 #endif // !defined(OS_NACL) 317 #endif // !defined(OS_NACL)
318 318
319 void AllowMultipleInitializeCallsForTesting() { 319 void AllowMultipleInitializeCallsForTesting() {
320 #if !defined(NDEBUG) && !defined(OS_NACL) 320 #if !defined(NDEBUG) && !defined(OS_NACL)
321 g_check_called_once = false; 321 g_check_called_once = false;
322 #endif 322 #endif
323 } 323 }
324 324
325 } // namespace i18n 325 } // namespace i18n
326 } // namespace base 326 } // namespace base
OLDNEW
« no previous file with comments | « base/i18n/icu_string_conversions.cc ('k') | base/i18n/message_formatter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698