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

Side by Side Diff: ppapi/proxy/ppb_char_set_proxy.cc

Issue 7349016: Added versioning for PPB_Core::MemAlloc and MemFree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes based on comments from dmichael Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/example/example.cc ('k') | ppapi/proxy/ppb_core_proxy.cc » ('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) 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/proxy/ppb_char_set_proxy.h" 5 #include "ppapi/proxy/ppb_char_set_proxy.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "ppapi/c/dev/ppb_char_set_dev.h" 8 #include "ppapi/c/dev/ppb_char_set_dev.h"
9 #include "ppapi/c/ppb_core.h" 9 #include "ppapi/c/dev/ppb_memory_dev.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
11 #include "ppapi/proxy/ppapi_messages.h" 11 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/proxy/serialized_var.h" 12 #include "ppapi/proxy/serialized_var.h"
13 #include "ppapi/shared_impl/char_set_impl.h" 13 #include "ppapi/shared_impl/char_set_impl.h"
14 #include "ppapi/thunk/enter.h" 14 #include "ppapi/thunk/enter.h"
15 #include "ppapi/thunk/thunk.h" 15 #include "ppapi/thunk/thunk.h"
16 16
17 namespace pp { 17 namespace pp {
18 namespace proxy { 18 namespace proxy {
19 19
20 namespace { 20 namespace {
21 21
22 const PPB_Core* GetCoreInterface() { 22 const PPB_Memory_Dev* GetMemoryDevInterface() {
23 return static_cast<const PPB_Core*>( 23 return static_cast<const PPB_Memory_Dev*>(
24 PluginDispatcher::GetInterfaceFromDispatcher(PPB_CORE_INTERFACE)); 24 PluginDispatcher::GetInterfaceFromDispatcher(PPB_MEMORY_DEV_INTERFACE));
25 } 25 }
26 26
27 InterfaceProxy* CreateCharSetProxy(Dispatcher* dispatcher, 27 InterfaceProxy* CreateCharSetProxy(Dispatcher* dispatcher,
28 const void* target_interface) { 28 const void* target_interface) {
29 return new PPB_CharSet_Proxy(dispatcher, target_interface); 29 return new PPB_CharSet_Proxy(dispatcher, target_interface);
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher, 34 PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher,
(...skipping 21 matching lines...) Expand all
56 return this; 56 return this;
57 } 57 }
58 58
59 char* PPB_CharSet_Proxy::UTF16ToCharSet( 59 char* PPB_CharSet_Proxy::UTF16ToCharSet(
60 PP_Instance instance, 60 PP_Instance instance,
61 const uint16_t* utf16, uint32_t utf16_len, 61 const uint16_t* utf16, uint32_t utf16_len,
62 const char* output_char_set, 62 const char* output_char_set,
63 PP_CharSet_ConversionError on_error, 63 PP_CharSet_ConversionError on_error,
64 uint32_t* output_length) { 64 uint32_t* output_length) {
65 return ppapi::CharSetImpl::UTF16ToCharSet( 65 return ppapi::CharSetImpl::UTF16ToCharSet(
66 GetCoreInterface(), utf16, utf16_len, output_char_set, on_error, 66 GetMemoryDevInterface(), utf16, utf16_len, output_char_set, on_error,
67 output_length); 67 output_length);
68 } 68 }
69 69
70 uint16_t* PPB_CharSet_Proxy::CharSetToUTF16( 70 uint16_t* PPB_CharSet_Proxy::CharSetToUTF16(
71 PP_Instance instance, 71 PP_Instance instance,
72 const char* input, uint32_t input_len, 72 const char* input, uint32_t input_len,
73 const char* input_char_set, 73 const char* input_char_set,
74 PP_CharSet_ConversionError on_error, 74 PP_CharSet_ConversionError on_error,
75 uint32_t* output_length) { 75 uint32_t* output_length) {
76 return ppapi::CharSetImpl::CharSetToUTF16( 76 return ppapi::CharSetImpl::CharSetToUTF16(
77 GetCoreInterface(), input, input_len, input_char_set, on_error, 77 GetMemoryDevInterface(), input, input_len, input_char_set, on_error,
78 output_length); 78 output_length);
79 } 79 }
80 80
81 PP_Var PPB_CharSet_Proxy::GetDefaultCharSet(PP_Instance instance) { 81 PP_Var PPB_CharSet_Proxy::GetDefaultCharSet(PP_Instance instance) {
82 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 82 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
83 if (!dispatcher) 83 if (!dispatcher)
84 return PP_MakeUndefined(); 84 return PP_MakeUndefined();
85 85
86 ReceiveSerializedVarReturnValue result; 86 ReceiveSerializedVarReturnValue result;
87 dispatcher->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet( 87 dispatcher->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet(
(...skipping 15 matching lines...) Expand all
103 PP_Instance instance, 103 PP_Instance instance,
104 SerializedVarReturnValue result) { 104 SerializedVarReturnValue result) {
105 ppapi::thunk::EnterFunctionNoLock<ppapi::thunk::PPB_CharSet_FunctionAPI> 105 ppapi::thunk::EnterFunctionNoLock<ppapi::thunk::PPB_CharSet_FunctionAPI>
106 enter(instance, true); 106 enter(instance, true);
107 if (enter.succeeded()) 107 if (enter.succeeded())
108 result.Return(dispatcher(), enter.functions()->GetDefaultCharSet(instance)); 108 result.Return(dispatcher(), enter.functions()->GetDefaultCharSet(instance));
109 } 109 }
110 110
111 } // namespace proxy 111 } // namespace proxy
112 } // namespace pp 112 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/example/example.cc ('k') | ppapi/proxy/ppb_core_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698