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

Unified Diff: ppapi/thunk/ppb_char_set_thunk.cc

Issue 9348069: Move the charset inteface to "trusted" (we can't implement this efficiently (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/thunk/ppb_char_set_thunk.cc
diff --git a/ppapi/thunk/ppb_char_set_thunk.cc b/ppapi/thunk/ppb_char_set_thunk.cc
index c5cb1de0e9df791610ad8df460441fc52261f061..a663c55dd4a0d57f1ac2042a8e58449c8295ef63 100644
--- a/ppapi/thunk/ppb_char_set_thunk.cc
+++ b/ppapi/thunk/ppb_char_set_thunk.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "ppapi/c/pp_var.h"
-#include "ppapi/shared_impl/ppb_char_set_shared.h"
+#include "ppapi/shared_impl/private/ppb_char_set_shared.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/enter.h"
@@ -12,11 +12,27 @@ namespace thunk {
namespace {
-char* UTF16ToCharSet(PP_Instance instance,
- const uint16_t* utf16, uint32_t utf16_len,
- const char* output_char_set,
- PP_CharSet_ConversionError on_error,
- uint32_t* output_length) {
+char* UTF16ToCharSetDeprecated(PP_Instance instance,
+ const uint16_t* utf16, uint32_t utf16_len,
+ const char* output_char_set,
+ PP_CharSet_ConversionError on_error,
+ uint32_t* output_length) {
+ // We validate the instance just to make sure we can make changes in the
+ // future and assume people pass proper instances.
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return NULL;
+
+ return PPB_CharSet_Shared::UTF16ToCharSetDeprecated(
+ utf16, utf16_len, output_char_set, on_error, output_length);
+}
+
+PP_Bool UTF16ToCharSet(const uint16_t utf16[],
+ uint32_t utf16_len,
+ const char* output_char_set,
+ PP_CharSet_Trusted_ConversionError on_error,
+ char* output_buffer,
+ uint32_t* output_length) {
// This interface is a bit odd because it contains a function
// (GetDefaultCharSet) that must be called on the instance object and
// proxied, but the rest of the functions are implemented in the plugin
@@ -27,30 +43,35 @@ char* UTF16ToCharSet(PP_Instance instance,
// shared_impl. That would be more consistent, and we may want to do that if
// this file is autogenerated in the future. For now, however, it's less code
// to just call the shared_impl code directly here.
+ return PPB_CharSet_Shared::UTF16ToCharSet(
+ utf16, utf16_len, output_char_set, on_error,
+ output_buffer, output_length);
+}
+uint16_t* CharSetToUTF16Deprecated(PP_Instance instance,
+ const char* input, uint32_t input_len,
+ const char* input_char_set,
+ PP_CharSet_ConversionError on_error,
+ uint32_t* output_length) {
// We validate the instance just to make sure we can make changes in the
// future and assume people pass proper instances.
EnterInstance enter(instance);
if (enter.failed())
return NULL;
- return PPB_CharSet_Shared::UTF16ToCharSet(utf16, utf16_len, output_char_set,
- on_error, output_length);
+ return PPB_CharSet_Shared::CharSetToUTF16Deprecated(
+ input, input_len, input_char_set, on_error, output_length);
}
-uint16_t* CharSetToUTF16(PP_Instance instance,
- const char* input, uint32_t input_len,
- const char* input_char_set,
- PP_CharSet_ConversionError on_error,
- uint32_t* output_length) {
- // We validate the instance just to make sure we can make changes in the
- // future and assume people pass proper instances.
- EnterInstance enter(instance);
- if (enter.failed())
- return NULL;
-
- return PPB_CharSet_Shared::CharSetToUTF16(input, input_len, input_char_set,
- on_error, output_length);
+PP_Bool CharSetToUTF16(const char* input,
+ uint32_t input_len,
+ const char* input_char_set,
+ PP_CharSet_Trusted_ConversionError on_error,
+ uint16_t* output_buffer,
+ uint32_t* output_utf16_length) {
+ return PPB_CharSet_Shared::CharSetToUTF16(
+ input, input_len, input_char_set, on_error,
+ output_buffer, output_utf16_length);
}
PP_Var GetDefaultCharSet(PP_Instance instance) {
@@ -61,6 +82,12 @@ PP_Var GetDefaultCharSet(PP_Instance instance) {
}
const PPB_CharSet_Dev g_ppb_char_set_thunk = {
+ &UTF16ToCharSetDeprecated,
+ &CharSetToUTF16Deprecated,
+ &GetDefaultCharSet
+};
+
+const PPB_CharSet_Trusted_1_0 g_ppb_char_set_trusted_thunk = {
&UTF16ToCharSet,
&CharSetToUTF16,
&GetDefaultCharSet
@@ -72,5 +99,9 @@ const PPB_CharSet_Dev_0_4* GetPPB_CharSet_Dev_0_4_Thunk() {
return &g_ppb_char_set_thunk;
}
+const PPB_CharSet_Trusted_1_0* GetPPB_CharSet_Trusted_1_0_Thunk() {
+ return &g_ppb_char_set_trusted_thunk;
+}
+
} // namespace thunk
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698