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

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

Issue 9169052: Tweaks to PPB_VarArrayBuffer in preperation for taking out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes based on reviews 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
« no previous file with comments | « ppapi/proxy/plugin_array_buffer_var.cc ('k') | ppapi/shared_impl/var.h » ('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) 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" 9 #include "ppapi/c/dev/ppb_var_array_buffer_dev.h"
10 #include "ppapi/c/ppb_var.h" 10 #include "ppapi/c/ppb_var.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 }; 68 };
69 69
70 70
71 // PPB_VarArrayBuffer_Dev methods ---------------------------------------------- 71 // PPB_VarArrayBuffer_Dev 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 PP_Bool ByteLength(PP_Var array, uint32_t* byte_length) {
79 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array); 79 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
80 if (!buffer) 80 if (!buffer)
81 return 0; 81 return PP_FALSE;
82 return buffer->ByteLength(); 82 *byte_length = buffer->ByteLength();
83 return PP_TRUE;
83 } 84 }
84 85
85 void* Map(PP_Var array) { 86 void* Map(PP_Var array) {
86 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array); 87 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
87 if (!buffer) 88 if (!buffer)
88 return NULL; 89 return NULL;
89 return buffer->Map(); 90 return buffer->Map();
90 } 91 }
91 92
93 void Unmap(PP_Var array) {
94 ArrayBufferVar* buffer = ArrayBufferVar::FromPPVar(array);
95 if (buffer)
96 buffer->Unmap();
97 }
98
92 const PPB_VarArrayBuffer_Dev var_arraybuffer_interface = { 99 const PPB_VarArrayBuffer_Dev var_arraybuffer_interface = {
93 &CreateArrayBufferVar, 100 &CreateArrayBufferVar,
94 &ByteLength, 101 &ByteLength,
95 &Map 102 &Map,
103 &Unmap
96 }; 104 };
97 105
98 } // namespace 106 } // namespace
99 107
100 // static 108 // static
101 const PPB_Var_1_1* PPB_Var_Shared::GetVarInterface1_1() { 109 const PPB_Var_1_1* PPB_Var_Shared::GetVarInterface1_1() {
102 return &var_interface; 110 return &var_interface;
103 } 111 }
104 112
105 // static 113 // static
106 const PPB_Var_1_0* PPB_Var_Shared::GetVarInterface1_0() { 114 const PPB_Var_1_0* PPB_Var_Shared::GetVarInterface1_0() {
107 return &var_interface1_0; 115 return &var_interface1_0;
108 } 116 }
109 117
110 // static 118 // static
111 const PPB_VarArrayBuffer_Dev* PPB_Var_Shared::GetVarArrayBufferInterface() { 119 const PPB_VarArrayBuffer_Dev* PPB_Var_Shared::GetVarArrayBufferInterface() {
112 return &var_arraybuffer_interface; 120 return &var_arraybuffer_interface;
113 } 121 }
114 122
115 } // namespace ppapi 123 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_array_buffer_var.cc ('k') | ppapi/shared_impl/var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698