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

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

Issue 9107046: PPAPI: Move PPB_ArrayBuffer out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gyp file, use 1_0 Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/shared_impl/ppb_var_shared.h" 5 #include "ppapi/shared_impl/ppb_var_shared.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ppapi/c/dev/ppb_var_array_buffer_dev.h"
10 #include "ppapi/c/ppb_var.h" 9 #include "ppapi/c/ppb_var.h"
10 #include "ppapi/c/ppb_var_array_buffer.h"
11 #include "ppapi/c/pp_var.h" 11 #include "ppapi/c/pp_var.h"
12 #include "ppapi/shared_impl/ppapi_globals.h" 12 #include "ppapi/shared_impl/ppapi_globals.h"
13 #include "ppapi/shared_impl/proxy_lock.h" 13 #include "ppapi/shared_impl/proxy_lock.h"
14 #include "ppapi/shared_impl/var.h" 14 #include "ppapi/shared_impl/var.h"
15 #include "ppapi/shared_impl/var_tracker.h" 15 #include "ppapi/shared_impl/var_tracker.h"
16 16
17 using ppapi::PpapiGlobals; 17 using ppapi::PpapiGlobals;
18 using ppapi::StringVar; 18 using ppapi::StringVar;
19 19
20 namespace ppapi { 20 namespace ppapi {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 }; 61 };
62 62
63 const PPB_Var_1_0 var_interface1_0 = { 63 const PPB_Var_1_0 var_interface1_0 = {
64 &AddRefVar, 64 &AddRefVar,
65 &ReleaseVar, 65 &ReleaseVar,
66 &VarFromUtf8_1_0, 66 &VarFromUtf8_1_0,
67 &VarToUtf8 67 &VarToUtf8
68 }; 68 };
69 69
70 70
71 // PPB_VarArrayBuffer_Dev methods ---------------------------------------------- 71 // PPB_VarArrayBuffer methods --------------------------------------------------
72 72
73 PP_Var CreateArrayBufferVar(uint32_t size_in_bytes) { 73 PP_Var CreateArrayBufferVar(uint32_t size_in_bytes) {
74 return PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( 74 return PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
75 size_in_bytes); 75 size_in_bytes);
76 } 76 }
77 77
78 uint32_t ByteLength(PP_Var array) { 78 uint32_t ByteLength(PP_Var array) {
79 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array); 79 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
80 if (!buffer) 80 if (!buffer)
81 return 0; 81 return 0;
82 return buffer->ByteLength(); 82 return buffer->ByteLength();
83 } 83 }
84 84
85 void* Map(PP_Var array) { 85 void* Map(PP_Var array) {
86 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array); 86 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
87 if (!buffer) 87 if (!buffer)
88 return NULL; 88 return NULL;
89 return buffer->Map(); 89 return buffer->Map();
90 } 90 }
91 91
92 const PPB_VarArrayBuffer_Dev var_arraybuffer_interface = { 92 const PPB_VarArrayBuffer_1_0 var_arraybuffer_interface = {
93 &CreateArrayBufferVar, 93 &CreateArrayBufferVar,
94 &ByteLength, 94 &ByteLength,
95 &Map 95 &Map
96 }; 96 };
97 97
98 } // namespace 98 } // namespace
99 99
100 // static 100 // static
101 const PPB_Var_1_1* PPB_Var_Shared::GetVarInterface1_1() { 101 const PPB_Var_1_1* PPB_Var_Shared::GetVarInterface1_1() {
102 return &var_interface; 102 return &var_interface;
103 } 103 }
104 104
105 // static 105 // static
106 const PPB_Var_1_0* PPB_Var_Shared::GetVarInterface1_0() { 106 const PPB_Var_1_0* PPB_Var_Shared::GetVarInterface1_0() {
107 return &var_interface1_0; 107 return &var_interface1_0;
108 } 108 }
109 109
110 // static 110 // static
111 const PPB_VarArrayBuffer_Dev* PPB_Var_Shared::GetVarArrayBufferInterface() { 111 const PPB_VarArrayBuffer_1_0* PPB_Var_Shared::GetVarArrayBufferInterface1_0() {
112 return &var_arraybuffer_interface; 112 return &var_arraybuffer_interface;
113 } 113 }
114 114
115 } // namespace ppapi 115 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698