| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/c/pp_var.h" | 5 #include "ppapi/c/pp_var.h" |
| 6 #include "ppapi/shared_impl/char_set_impl.h" | 6 #include "ppapi/shared_impl/ppb_char_set_shared.h" |
| 7 #include "ppapi/thunk/thunk.h" | 7 #include "ppapi/thunk/thunk.h" |
| 8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 9 | 9 |
| 10 namespace ppapi { | 10 namespace ppapi { |
| 11 namespace thunk { | 11 namespace thunk { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 char* UTF16ToCharSet(PP_Instance instance, | 15 char* UTF16ToCharSet(PP_Instance instance, |
| 16 const uint16_t* utf16, uint32_t utf16_len, | 16 const uint16_t* utf16, uint32_t utf16_len, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 // shared_impl. That would be more consistent, and we may want to do that if | 27 // shared_impl. That would be more consistent, and we may want to do that if |
| 28 // this file is autogenerated in the future. For now, however, it's less code | 28 // this file is autogenerated in the future. For now, however, it's less code |
| 29 // to just call the shared_impl code directly here. | 29 // to just call the shared_impl code directly here. |
| 30 | 30 |
| 31 // We validate the instance just to make sure we can make changes in the | 31 // We validate the instance just to make sure we can make changes in the |
| 32 // future and assume people pass proper instances. | 32 // future and assume people pass proper instances. |
| 33 EnterInstance enter(instance); | 33 EnterInstance enter(instance); |
| 34 if (enter.failed()) | 34 if (enter.failed()) |
| 35 return NULL; | 35 return NULL; |
| 36 | 36 |
| 37 return CharSetImpl::UTF16ToCharSet(utf16, utf16_len, output_char_set, | 37 return PPB_CharSet_Shared::UTF16ToCharSet(utf16, utf16_len, output_char_set, |
| 38 on_error, output_length); | 38 on_error, output_length); |
| 39 } | 39 } |
| 40 | 40 |
| 41 uint16_t* CharSetToUTF16(PP_Instance instance, | 41 uint16_t* CharSetToUTF16(PP_Instance instance, |
| 42 const char* input, uint32_t input_len, | 42 const char* input, uint32_t input_len, |
| 43 const char* input_char_set, | 43 const char* input_char_set, |
| 44 PP_CharSet_ConversionError on_error, | 44 PP_CharSet_ConversionError on_error, |
| 45 uint32_t* output_length) { | 45 uint32_t* output_length) { |
| 46 // We validate the instance just to make sure we can make changes in the | 46 // We validate the instance just to make sure we can make changes in the |
| 47 // future and assume people pass proper instances. | 47 // future and assume people pass proper instances. |
| 48 EnterInstance enter(instance); | 48 EnterInstance enter(instance); |
| 49 if (enter.failed()) | 49 if (enter.failed()) |
| 50 return NULL; | 50 return NULL; |
| 51 | 51 |
| 52 return CharSetImpl::CharSetToUTF16(input, input_len, input_char_set, | 52 return PPB_CharSet_Shared::CharSetToUTF16(input, input_len, input_char_set, |
| 53 on_error, output_length); | 53 on_error, output_length); |
| 54 } | 54 } |
| 55 | 55 |
| 56 PP_Var GetDefaultCharSet(PP_Instance instance) { | 56 PP_Var GetDefaultCharSet(PP_Instance instance) { |
| 57 EnterInstance enter(instance); | 57 EnterInstance enter(instance); |
| 58 if (enter.failed()) | 58 if (enter.failed()) |
| 59 return PP_MakeUndefined(); | 59 return PP_MakeUndefined(); |
| 60 return enter.functions()->GetDefaultCharSet(instance); | 60 return enter.functions()->GetDefaultCharSet(instance); |
| 61 } | 61 } |
| 62 | 62 |
| 63 const PPB_CharSet_Dev g_ppb_char_set_thunk = { | 63 const PPB_CharSet_Dev g_ppb_char_set_thunk = { |
| 64 &UTF16ToCharSet, | 64 &UTF16ToCharSet, |
| 65 &CharSetToUTF16, | 65 &CharSetToUTF16, |
| 66 &GetDefaultCharSet | 66 &GetDefaultCharSet |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace | 69 } // namespace |
| 70 | 70 |
| 71 const PPB_CharSet_Dev* GetPPB_CharSet_Dev_Thunk() { | 71 const PPB_CharSet_Dev* GetPPB_CharSet_Dev_Thunk() { |
| 72 return &g_ppb_char_set_thunk; | 72 return &g_ppb_char_set_thunk; |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace thunk | 75 } // namespace thunk |
| 76 } // namespace ppapi | 76 } // namespace ppapi |
| OLD | NEW |