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

Side by Side Diff: mojo/icu/icu.cc

Issue 2010853002: Delete //mojo/icu. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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 | « mojo/icu/icu.h ('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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/icu/icu.h"
6
7 #include "mojo/icu/constants.h"
8 #include "mojo/public/cpp/application/application_impl.h"
9 #include "mojo/services/icu_data/interfaces/icu_data.mojom.h"
10 #include "third_party/icu/source/common/unicode/putil.h"
11 #include "third_party/icu/source/common/unicode/udata.h"
12
13 #if !defined(OS_ANDROID)
14 #include "base/i18n/icu_util.h"
15 #endif
16
17 namespace mojo {
18 namespace icu {
19 namespace {
20
21 class Callback {
22 public:
23 void Run(mojo::ScopedSharedBufferHandle handle) const {
24 void* ptr = nullptr;
25 mojo::MapBuffer(handle.get(), 0, kDataSize, &ptr,
26 MOJO_MAP_BUFFER_FLAG_NONE);
27 UErrorCode err = U_ZERO_ERROR;
28 udata_setCommonData(ptr, &err);
29 // Leak the handle because we never unmap the buffer.
30 (void)handle.release();
31 };
32 };
33
34 } // namespace
35
36 void Initialize(ApplicationImpl* app) {
37 #if !defined(OS_ANDROID)
38 // On desktop platforms, the icu data table is stored in a file on disk, which
39 // can be loaded using base.
40 base::i18n::InitializeICU();
41 return;
42 #endif
43
44 icu_data::ICUDataPtr icu_data;
45 app->ConnectToService("mojo:icu_data", &icu_data);
46 icu_data->Map(kDataHash, Callback());
47 icu_data.WaitForIncomingResponse();
48 }
49
50 } // namespace icu
51 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/icu/icu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698