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

Side by Side Diff: ppapi/shared_impl/ppb_var_impl.cc

Issue 8826011: Remove PP_Module from parameters for PPB_Var.VarFromUtf8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years 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/shared_impl/ppb_var_impl.h ('k') | ppapi/shared_impl/private/net_address_private_impl.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_var_proxy.h" 5 #include "ppapi/shared_impl/ppb_var_impl.h"
6 6
7 #include <limits>
8
9 #include "ppapi/c/ppb_var.h"
7 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
8 #include "ppapi/c/ppb_var.h"
9 #include "ppapi/shared_impl/ppapi_globals.h" 11 #include "ppapi/shared_impl/ppapi_globals.h"
10 #include "ppapi/shared_impl/proxy_lock.h" 12 #include "ppapi/shared_impl/proxy_lock.h"
11 #include "ppapi/shared_impl/var.h" 13 #include "ppapi/shared_impl/var.h"
12 #include "ppapi/shared_impl/var_tracker.h" 14 #include "ppapi/shared_impl/var_tracker.h"
13 15
16 using ppapi::PpapiGlobals;
17 using ppapi::StringVar;
18
14 namespace ppapi { 19 namespace ppapi {
15 namespace proxy {
16
17 namespace {
18
19 // PPP_Var plugin --------------------------------------------------------------
20 20
21 void AddRefVar(PP_Var var) { 21 void AddRefVar(PP_Var var) {
22 ppapi::ProxyAutoLock lock; 22 ppapi::ProxyAutoLock lock;
23 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var); 23 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var);
24 } 24 }
25 25
26 void ReleaseVar(PP_Var var) { 26 void ReleaseVar(PP_Var var) {
27 ppapi::ProxyAutoLock lock; 27 ppapi::ProxyAutoLock lock;
28 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var); 28 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var);
29 } 29 }
30 30
31 PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) { 31 PP_Var VarFromUtf8(const char* data, uint32_t len) {
32 ppapi::ProxyAutoLock lock; 32 ppapi::ProxyAutoLock lock;
33 return StringVar::StringToPPVar(module, data, len); 33 return StringVar::StringToPPVar(data, len);
34 }
35
36 PP_Var VarFromUtf8_1_0(PP_Module /*module*/, const char* data, uint32_t len) {
37 return VarFromUtf8(data, len);
34 } 38 }
35 39
36 const char* VarToUtf8(PP_Var var, uint32_t* len) { 40 const char* VarToUtf8(PP_Var var, uint32_t* len) {
37 ppapi::ProxyAutoLock lock; 41 ppapi::ProxyAutoLock lock;
38 StringVar* str = StringVar::FromPPVar(var); 42 StringVar* str = StringVar::FromPPVar(var);
39 if (str) { 43 if (str) {
40 *len = static_cast<uint32_t>(str->value().size()); 44 *len = static_cast<uint32_t>(str->value().size());
41 return str->value().c_str(); 45 return str->value().c_str();
42 } 46 }
43 *len = 0; 47 *len = 0;
44 return NULL; 48 return NULL;
45 } 49 }
46 50
51 namespace {
47 const PPB_Var var_interface = { 52 const PPB_Var var_interface = {
48 &AddRefVar, 53 &AddRefVar,
49 &ReleaseVar, 54 &ReleaseVar,
50 &VarFromUtf8, 55 &VarFromUtf8,
51 &VarToUtf8 56 &VarToUtf8
52 }; 57 };
53 58
59 const PPB_Var_1_0 var_interface1_0 = {
60 &AddRefVar,
61 &ReleaseVar,
62 &VarFromUtf8_1_0,
63 &VarToUtf8
64 };
54 } // namespace 65 } // namespace
55 66
56 const PPB_Var* GetPPB_Var_Interface() { 67 // static
68 const PPB_Var* PPB_Var_Impl::GetVarInterface() {
57 return &var_interface; 69 return &var_interface;
58 } 70 }
59 71
60 } // namespace proxy 72 // static
73 const PPB_Var_1_0* PPB_Var_Impl::GetVarInterface1_0() {
74 return &var_interface1_0;
75 }
76
61 } // namespace ppapi 77 } // namespace ppapi
78
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_var_impl.h ('k') | ppapi/shared_impl/private/net_address_private_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698