OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "mojo/icu/icu.h" | 5 #include "mojo/icu/icu.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application_impl.h" | 7 #include "mojo/public/cpp/application/application_impl.h" |
8 #include "services/icu_data/icu_data.mojom.h" | 8 #include "services/icu_data/icu_data.mojom.h" |
9 #include "third_party/icu/source/common/unicode/putil.h" | 9 #include "third_party/icu/source/common/unicode/putil.h" |
10 #include "third_party/icu/source/common/unicode/udata.h" | 10 #include "third_party/icu/source/common/unicode/udata.h" |
11 | 11 |
12 #if !defined(OS_ANDROID) | 12 #if !defined(OS_ANDROID) |
13 #include "base/i18n/icu_util.h" | 13 #include "base/i18n/icu_util.h" |
14 #endif | 14 #endif |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace icu { | 17 namespace icu { |
18 namespace { | 18 namespace { |
19 | 19 |
20 // These values are for Android arm32. | 20 // These values are for Android arm32. |
21 const char kDataHash[] = "750429c6b974f0207c476910cb688f08936317aa"; | 21 const char kDataHash[] = "3ef55e413a9d429e404e10fe8ec566009d3889f3"; |
22 const int64_t kDataSize = 6038640; | 22 const int64_t kDataSize = 6037440; |
23 | 23 |
24 class Callback { | 24 class Callback { |
25 public: | 25 public: |
26 void Run(mojo::ScopedSharedBufferHandle handle) const { | 26 void Run(mojo::ScopedSharedBufferHandle handle) const { |
27 void* ptr = nullptr; | 27 void* ptr = nullptr; |
28 mojo::MapBuffer(handle.get(), 0, kDataSize, &ptr, | 28 mojo::MapBuffer(handle.get(), 0, kDataSize, &ptr, |
29 MOJO_MAP_BUFFER_FLAG_NONE); | 29 MOJO_MAP_BUFFER_FLAG_NONE); |
30 UErrorCode err = U_ZERO_ERROR; | 30 UErrorCode err = U_ZERO_ERROR; |
31 udata_setCommonData(ptr, &err); | 31 udata_setCommonData(ptr, &err); |
32 // Leak the handle because we never unmap the buffer. | 32 // Leak the handle because we never unmap the buffer. |
(...skipping 11 matching lines...) Expand all Loading... |
44 #endif | 44 #endif |
45 | 45 |
46 icu_data::ICUDataPtr icu_data; | 46 icu_data::ICUDataPtr icu_data; |
47 app->ConnectToService("mojo:icu_data", &icu_data); | 47 app->ConnectToService("mojo:icu_data", &icu_data); |
48 icu_data->Map(kDataHash, Callback()); | 48 icu_data->Map(kDataHash, Callback()); |
49 icu_data.WaitForIncomingMethodCall(); | 49 icu_data.WaitForIncomingMethodCall(); |
50 } | 50 } |
51 | 51 |
52 } // namespace icu | 52 } // namespace icu |
53 } // namespace mojo | 53 } // namespace mojo |
OLD | NEW |