diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 09:08:15 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 09:08:15 +0000 |
commit | 034fbf874d8f5cfd948e9b46c137b9308503fecf (patch) | |
tree | e0dd91f952058fdda15c20113c5b49fb8452e559 /ppapi | |
parent | e1fdb74d56350c54ec2cb2349eed00f666d6c4ae (diff) | |
download | chromium_src-034fbf874d8f5cfd948e9b46c137b9308503fecf.zip chromium_src-034fbf874d8f5cfd948e9b46c137b9308503fecf.tar.gz chromium_src-034fbf874d8f5cfd948e9b46c137b9308503fecf.tar.bz2 |
Move PPB_VarArray and PPB_VarDictionary out of dev.
Note that this completely removes the dev versions of the interfaces.
The discussion on moving these interfaces to stable happened here: https://codereview.chromium.org/16136009
BUG=236958
Review URL: https://chromiumcodereview.appspot.com/17005006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
27 files changed, 483 insertions, 476 deletions
diff --git a/ppapi/api/dev/ppb_var_array_dev.idl b/ppapi/api/ppb_var_array.idl index 78db3b0..9925e44 100644 --- a/ppapi/api/dev/ppb_var_array_dev.idl +++ b/ppapi/api/ppb_var_array.idl @@ -1,19 +1,19 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* Copyright 2013 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /** - * This file defines the <code>PPB_VarArray_Dev</code> struct providing + * This file defines the <code>PPB_VarArray</code> struct providing * a way to interact with array vars. */ label Chrome { - M27 = 0.1 + M29 = 1.0 }; -[macro="PPB_VAR_ARRAY_DEV_INTERFACE"] -interface PPB_VarArray_Dev { +[macro="PPB_VAR_ARRAY_INTERFACE"] +interface PPB_VarArray { /** * Creates an array var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0. @@ -29,9 +29,10 @@ interface PPB_VarArray_Dev { * @param[in] array An array var. * @param[in] index An index indicating which element to return. * - * @return The element at the specified position. The reference count is - * incremented on behalf of the caller. If <code>index</code> is larger than - * or equal to the array length, an undefined var is returned. + * @return The element at the specified position. The reference count of the + * element returned is incremented on behalf of the caller. If + * <code>index</code> is larger than or equal to the array length, an + * undefined var is returned. */ PP_Var Get([in] PP_Var array, [in] uint32_t index); @@ -66,9 +67,9 @@ interface PPB_VarArray_Dev { * @param[in] array An array var. * @param[in] length The new array length. If <code>length</code> is smaller * than its current value, the array is truncated to the new length; any - * elements that no longer fit are removed. If <code>length</code> is larger - * than its current value, undefined vars are appended to increase the array - * to the specified length. + * elements that no longer fit are removed and the references to them will be + * released. If <code>length</code> is larger than its current value, + * undefined vars are appended to increase the array to the specified length. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ diff --git a/ppapi/api/dev/ppb_var_dictionary_dev.idl b/ppapi/api/ppb_var_dictionary.idl index f3e7407..b4b9c06 100644 --- a/ppapi/api/dev/ppb_var_dictionary_dev.idl +++ b/ppapi/api/ppb_var_dictionary.idl @@ -1,15 +1,15 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* Copyright 2013 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /** - * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing + * This file defines the <code>PPB_VarDictionary</code> struct providing * a way to interact with dictionary vars. */ label Chrome { - M27 = 0.1 + M29 = 1.0 }; /** @@ -17,8 +17,8 @@ label Chrome { * strings while the values can be arbitrary vars. Key comparison is always * done by value instead of by reference. */ -[macro="PPB_VAR_DICTIONARY_DEV_INTERFACE"] -interface PPB_VarDictionary_Dev { +[macro="PPB_VAR_DICTIONARY_INTERFACE"] +interface PPB_VarDictionary { /** * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_DICTIONARY</code>. @@ -35,28 +35,29 @@ interface PPB_VarDictionary_Dev { * @param[in] key A string var. * * @return The value that is associated with <code>key</code>. The reference - * count is incremented on behalf of the caller. If <code>key</code> is not a - * string var, or it doesn't exist in <code>dict</code>, an undefined var is - * returned. + * count of the element returned is incremented on behalf of the caller. If + * <code>key</code> is not a string var, or it doesn't exist in + * <code>dict</code>, an undefined var is returned. */ PP_Var Get([in] PP_Var dict, [in] PP_Var key); /** - * Sets the value associated with the specified key. The dictionary is - * responsible for holding references to its children to keep them alive. + * Sets the value associated with the specified key. * * @param[in] dict A dictionary var. * @param[in] key A string var. If this key hasn't existed in * <code>dict</code>, it is added and associated with <code>value</code>; * otherwise, the previous value is replaced with <code>value</code>. - * @param[in] value The value to set. + * @param[in] value The value to set. The dictionary holds a reference to it + * on success. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); /** - * Deletes the specified key and its associated value, if the key exists. + * Deletes the specified key and its associated value, if the key exists. The + * reference to the element will be released. * * @param[in] dict A dictionary var. * @param[in] key A string var. diff --git a/ppapi/c/dev/ppb_var_array_dev.h b/ppapi/c/ppb_var_array.h index 3ce07fb..615e459 100644 --- a/ppapi/c/dev/ppb_var_array_dev.h +++ b/ppapi/c/ppb_var_array.h @@ -1,24 +1,24 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* Copyright 2013 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -/* From dev/ppb_var_array_dev.idl modified Thu Mar 14 13:41:46 2013. */ +/* From ppb_var_array.idl modified Sun Jun 16 15:37:27 2013. */ -#ifndef PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ -#define PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ +#ifndef PPAPI_C_PPB_VAR_ARRAY_H_ +#define PPAPI_C_PPB_VAR_ARRAY_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_VAR_ARRAY_DEV_INTERFACE_0_1 "PPB_VarArray(Dev);0.1" -#define PPB_VAR_ARRAY_DEV_INTERFACE PPB_VAR_ARRAY_DEV_INTERFACE_0_1 +#define PPB_VAR_ARRAY_INTERFACE_1_0 "PPB_VarArray;1.0" +#define PPB_VAR_ARRAY_INTERFACE PPB_VAR_ARRAY_INTERFACE_1_0 /** * @file - * This file defines the <code>PPB_VarArray_Dev</code> struct providing + * This file defines the <code>PPB_VarArray</code> struct providing * a way to interact with array vars. */ @@ -27,7 +27,7 @@ * @addtogroup Interfaces * @{ */ -struct PPB_VarArray_Dev_0_1 { +struct PPB_VarArray_1_0 { /** * Creates an array var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0. @@ -42,9 +42,10 @@ struct PPB_VarArray_Dev_0_1 { * @param[in] array An array var. * @param[in] index An index indicating which element to return. * - * @return The element at the specified position. The reference count is - * incremented on behalf of the caller. If <code>index</code> is larger than - * or equal to the array length, an undefined var is returned. + * @return The element at the specified position. The reference count of the + * element returned is incremented on behalf of the caller. If + * <code>index</code> is larger than or equal to the array length, an + * undefined var is returned. */ struct PP_Var (*Get)(struct PP_Var array, uint32_t index); /** @@ -76,19 +77,19 @@ struct PPB_VarArray_Dev_0_1 { * @param[in] array An array var. * @param[in] length The new array length. If <code>length</code> is smaller * than its current value, the array is truncated to the new length; any - * elements that no longer fit are removed. If <code>length</code> is larger - * than its current value, undefined vars are appended to increase the array - * to the specified length. + * elements that no longer fit are removed and the references to them will be + * released. If <code>length</code> is larger than its current value, + * undefined vars are appended to increase the array to the specified length. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ PP_Bool (*SetLength)(struct PP_Var array, uint32_t length); }; -typedef struct PPB_VarArray_Dev_0_1 PPB_VarArray_Dev; +typedef struct PPB_VarArray_1_0 PPB_VarArray; /** * @} */ -#endif /* PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ */ +#endif /* PPAPI_C_PPB_VAR_ARRAY_H_ */ diff --git a/ppapi/c/dev/ppb_var_dictionary_dev.h b/ppapi/c/ppb_var_dictionary.h index d601071..712da67 100644 --- a/ppapi/c/dev/ppb_var_dictionary_dev.h +++ b/ppapi/c/ppb_var_dictionary.h @@ -1,24 +1,24 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. +/* Copyright 2013 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -/* From dev/ppb_var_dictionary_dev.idl modified Wed Mar 13 21:47:05 2013. */ +/* From ppb_var_dictionary.idl modified Sat Jun 8 23:03:54 2013. */ -#ifndef PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ -#define PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ +#ifndef PPAPI_C_PPB_VAR_DICTIONARY_H_ +#define PPAPI_C_PPB_VAR_DICTIONARY_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" -#define PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 "PPB_VarDictionary(Dev);0.1" -#define PPB_VAR_DICTIONARY_DEV_INTERFACE PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 +#define PPB_VAR_DICTIONARY_INTERFACE_1_0 "PPB_VarDictionary;1.0" +#define PPB_VAR_DICTIONARY_INTERFACE PPB_VAR_DICTIONARY_INTERFACE_1_0 /** * @file - * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing + * This file defines the <code>PPB_VarDictionary</code> struct providing * a way to interact with dictionary vars. */ @@ -32,7 +32,7 @@ * strings while the values can be arbitrary vars. Key comparison is always * done by value instead of by reference. */ -struct PPB_VarDictionary_Dev_0_1 { +struct PPB_VarDictionary_1_0 { /** * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to * <code>PP_VARTYPE_DICTIONARY</code>. @@ -48,26 +48,27 @@ struct PPB_VarDictionary_Dev_0_1 { * @param[in] key A string var. * * @return The value that is associated with <code>key</code>. The reference - * count is incremented on behalf of the caller. If <code>key</code> is not a - * string var, or it doesn't exist in <code>dict</code>, an undefined var is - * returned. + * count of the element returned is incremented on behalf of the caller. If + * <code>key</code> is not a string var, or it doesn't exist in + * <code>dict</code>, an undefined var is returned. */ struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key); /** - * Sets the value associated with the specified key. The dictionary is - * responsible for holding references to its children to keep them alive. + * Sets the value associated with the specified key. * * @param[in] dict A dictionary var. * @param[in] key A string var. If this key hasn't existed in * <code>dict</code>, it is added and associated with <code>value</code>; * otherwise, the previous value is replaced with <code>value</code>. - * @param[in] value The value to set. + * @param[in] value The value to set. The dictionary holds a reference to it + * on success. * * @return A <code>PP_Bool</code> indicating whether the operation succeeds. */ PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value); /** - * Deletes the specified key and its associated value, if the key exists. + * Deletes the specified key and its associated value, if the key exists. The + * reference to the element will be released. * * @param[in] dict A dictionary var. * @param[in] key A string var. @@ -97,10 +98,10 @@ struct PPB_VarDictionary_Dev_0_1 { struct PP_Var (*GetKeys)(struct PP_Var dict); }; -typedef struct PPB_VarDictionary_Dev_0_1 PPB_VarDictionary_Dev; +typedef struct PPB_VarDictionary_1_0 PPB_VarDictionary; /** * @} */ -#endif /* PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ */ +#endif /* PPAPI_C_PPB_VAR_DICTIONARY_H_ */ diff --git a/ppapi/cpp/dev/var_array_dev.cc b/ppapi/cpp/dev/var_array_dev.cc deleted file mode 100644 index 247e9c4..0000000 --- a/ppapi/cpp/dev/var_array_dev.cc +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/dev/var_array_dev.h" - -#include "ppapi/c/dev/ppb_var_array_dev.h" -#include "ppapi/cpp/logging.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_VarArray_Dev_0_1>() { - return PPB_VAR_ARRAY_DEV_INTERFACE_0_1; -} - -} // namespace - -VarArray_Dev::VarArray_Dev() : Var(Null()) { - if (has_interface<PPB_VarArray_Dev_0_1>()) - var_ = get_interface<PPB_VarArray_Dev_0_1>()->Create(); - else - PP_NOTREACHED(); -} - -VarArray_Dev::VarArray_Dev(const Var& var) : Var(var) { - if (!var.is_array()) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarArray_Dev::VarArray_Dev(const PP_Var& var) : Var(var) { - if (var.type != PP_VARTYPE_ARRAY) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarArray_Dev::VarArray_Dev(const VarArray_Dev& other) : Var(other) { -} - -VarArray_Dev::~VarArray_Dev() { -} - -VarArray_Dev& VarArray_Dev::operator=(const VarArray_Dev& other) { - Var::operator=(other); - return *this; -} - -Var& VarArray_Dev::operator=(const Var& other) { - if (other.is_array()) { - Var::operator=(other); - } else { - PP_NOTREACHED(); - Var::operator=(Var(Null())); - } - return *this; -} - -Var VarArray_Dev::Get(uint32_t index) const { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return Var(); - - return Var(PASS_REF, get_interface<PPB_VarArray_Dev_0_1>()->Get(var_, index)); -} - -PP_Bool VarArray_Dev::Set(uint32_t index, const Var& value) { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarArray_Dev_0_1>()->Set(var_, index, - value.pp_var()); -} - -uint32_t VarArray_Dev::GetLength() const { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return 0; - - return get_interface<PPB_VarArray_Dev_0_1>()->GetLength(var_); -} - -PP_Bool VarArray_Dev::SetLength(uint32_t length) { - if (!has_interface<PPB_VarArray_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarArray_Dev_0_1>()->SetLength(var_, length); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/var_dictionary_dev.cc b/ppapi/cpp/dev/var_dictionary_dev.cc deleted file mode 100644 index 8fa3f6c..0000000 --- a/ppapi/cpp/dev/var_dictionary_dev.cc +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/dev/var_dictionary_dev.h" - -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" -#include "ppapi/cpp/logging.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_VarDictionary_Dev_0_1>() { - return PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1; -} - -} // namespace - -VarDictionary_Dev::VarDictionary_Dev() : Var(Null()) { - if (has_interface<PPB_VarDictionary_Dev_0_1>()) - var_ = get_interface<PPB_VarDictionary_Dev_0_1>()->Create(); - else - PP_NOTREACHED(); -} - -VarDictionary_Dev::VarDictionary_Dev(const Var& var) : Var(var) { - if (!var.is_dictionary()) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarDictionary_Dev::VarDictionary_Dev(const PP_Var& var) : Var(var) { - if (var.type != PP_VARTYPE_DICTIONARY) { - PP_NOTREACHED(); - - // This takes care of releasing the reference that this object holds. - Var::operator=(Var(Null())); - } -} - -VarDictionary_Dev::VarDictionary_Dev(const VarDictionary_Dev& other) - : Var(other) { -} - -VarDictionary_Dev::~VarDictionary_Dev() { -} - -VarDictionary_Dev& VarDictionary_Dev::operator=( - const VarDictionary_Dev& other) { - Var::operator=(other); - return *this; -} - -Var& VarDictionary_Dev::operator=(const Var& other) { - if (other.is_dictionary()) { - Var::operator=(other); - } else { - PP_NOTREACHED(); - Var::operator=(Var(Null())); - } - return *this; -} - -Var VarDictionary_Dev::Get(const Var& key) const { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return Var(); - - return Var( - PASS_REF, - get_interface<PPB_VarDictionary_Dev_0_1>()->Get(var_, key.pp_var())); -} - -PP_Bool VarDictionary_Dev::Set(const Var& key, const Var& value) { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarDictionary_Dev_0_1>()->Set(var_, key.pp_var(), - value.pp_var()); -} - -void VarDictionary_Dev::Delete(const Var& key) { - if (has_interface<PPB_VarDictionary_Dev_0_1>()) - get_interface<PPB_VarDictionary_Dev_0_1>()->Delete(var_, key.pp_var()); -} - -PP_Bool VarDictionary_Dev::HasKey(const Var& key) const { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return PP_FALSE; - - return get_interface<PPB_VarDictionary_Dev_0_1>()->HasKey(var_, key.pp_var()); -} - -VarArray_Dev VarDictionary_Dev::GetKeys() const { - if (!has_interface<PPB_VarDictionary_Dev_0_1>()) - return VarArray_Dev(); - - Var result(PASS_REF, - get_interface<PPB_VarDictionary_Dev_0_1>()->GetKeys(var_)); - if (result.is_array()) - return VarArray_Dev(result); - else - return VarArray_Dev(); -} - -} // namespace pp diff --git a/ppapi/cpp/extensions/dev/alarms_dev.cc b/ppapi/cpp/extensions/dev/alarms_dev.cc index 94baf47..1cf8464 100644 --- a/ppapi/cpp/extensions/dev/alarms_dev.cc +++ b/ppapi/cpp/extensions/dev/alarms_dev.cc @@ -5,11 +5,11 @@ #include "ppapi/cpp/extensions/dev/alarms_dev.h" #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/extensions/to_var_converter.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { @@ -41,7 +41,7 @@ bool Alarm_Dev::Populate(const PP_Ext_Alarms_Alarm_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = name.Populate(dict); result = scheduled_time.Populate(dict) && result; result = period_in_minutes.Populate(dict) && result; @@ -50,7 +50,7 @@ bool Alarm_Dev::Populate(const PP_Ext_Alarms_Alarm_Dev& value) { } Var Alarm_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = name.AddTo(&dict); result = scheduled_time.AddTo(&dict) && result; @@ -78,7 +78,7 @@ bool AlarmCreateInfo_Dev::Populate( if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = when.Populate(dict); result = delay_in_minutes.Populate(dict) && result; result = period_in_minutes.Populate(dict) && result; @@ -87,7 +87,7 @@ bool AlarmCreateInfo_Dev::Populate( } Var AlarmCreateInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = when.MayAddTo(&dict); result = delay_in_minutes.MayAddTo(&dict) && result; diff --git a/ppapi/cpp/extensions/dev/socket_dev.cc b/ppapi/cpp/extensions/dev/socket_dev.cc index 558f01e..a2c9e7f 100644 --- a/ppapi/cpp/extensions/dev/socket_dev.cc +++ b/ppapi/cpp/extensions/dev/socket_dev.cc @@ -76,14 +76,14 @@ bool CreateInfo_Dev::Populate(const PP_Ext_Socket_CreateInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = socket_id.Populate(dict); return result; } Var CreateInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = socket_id.AddTo(&dict); // Suppress unused variable warnings. @@ -108,7 +108,7 @@ bool AcceptInfo_Dev::Populate(const PP_Ext_Socket_AcceptInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = result_code.Populate(dict); result = socket_id.Populate(dict) && result; @@ -116,7 +116,7 @@ bool AcceptInfo_Dev::Populate(const PP_Ext_Socket_AcceptInfo_Dev& value) { } Var AcceptInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = result_code.AddTo(&dict); result = socket_id.MayAddTo(&dict) && result; @@ -140,7 +140,7 @@ bool ReadInfo_Dev::Populate(const PP_Ext_Socket_ReadInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = result_code.Populate(dict); result = data.Populate(dict) && result; @@ -148,7 +148,7 @@ bool ReadInfo_Dev::Populate(const PP_Ext_Socket_ReadInfo_Dev& value) { } Var ReadInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = result_code.AddTo(&dict); result = data.AddTo(&dict) && result; @@ -170,14 +170,14 @@ bool WriteInfo_Dev::Populate(const PP_Ext_Socket_WriteInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = bytes_written.Populate(dict); return result; } Var WriteInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = bytes_written.AddTo(&dict); // Suppress unused variable warnings. @@ -206,7 +206,7 @@ bool RecvFromInfo_Dev::Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = result_code.Populate(dict); result = data.Populate(dict) && result; result = address.Populate(dict) && result; @@ -216,7 +216,7 @@ bool RecvFromInfo_Dev::Populate(const PP_Ext_Socket_RecvFromInfo_Dev& value) { } Var RecvFromInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = result_code.AddTo(&dict); result = data.AddTo(&dict) && result; @@ -250,7 +250,7 @@ bool SocketInfo_Dev::Populate(const PP_Ext_Socket_SocketInfo_Dev& value) { if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = socket_type.Populate(dict); result = connected.Populate(dict) && result; result = peer_address.Populate(dict) && result; @@ -262,7 +262,7 @@ bool SocketInfo_Dev::Populate(const PP_Ext_Socket_SocketInfo_Dev& value) { } Var SocketInfo_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = socket_type.AddTo(&dict); result = connected.AddTo(&dict) && result; @@ -291,7 +291,7 @@ bool NetworkInterface_Dev::Populate( if (value.type != PP_VARTYPE_DICTIONARY) return false; - VarDictionary_Dev dict(value); + VarDictionary dict(value); bool result = name.Populate(dict); result = address.Populate(dict) && result; @@ -299,7 +299,7 @@ bool NetworkInterface_Dev::Populate( } Var NetworkInterface_Dev::CreateVar() const { - VarDictionary_Dev dict; + VarDictionary dict; bool result = name.AddTo(&dict); result = address.AddTo(&dict) && result; diff --git a/ppapi/cpp/extensions/dev/socket_dev.h b/ppapi/cpp/extensions/dev/socket_dev.h index 95e78d3..b6ac7b5 100644 --- a/ppapi/cpp/extensions/dev/socket_dev.h +++ b/ppapi/cpp/extensions/dev/socket_dev.h @@ -9,12 +9,12 @@ #include <vector> #include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/dict_field.h" #include "ppapi/cpp/extensions/ext_output_traits.h" #include "ppapi/cpp/instance_handle.h" #include "ppapi/cpp/var.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -50,7 +50,7 @@ class SocketType_Dev { static const char* const kUdp; }; -typedef VarDictionary_Dev CreateOptions_Dev; +typedef VarDictionary CreateOptions_Dev; class CreateInfo_Dev { public: diff --git a/ppapi/cpp/extensions/dict_field.h b/ppapi/cpp/extensions/dict_field.h index 5a085c3a..f332014 100644 --- a/ppapi/cpp/extensions/dict_field.h +++ b/ppapi/cpp/extensions/dict_field.h @@ -8,11 +8,11 @@ #include <string> #include "ppapi/c/pp_bool.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/from_var_converter.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/extensions/to_var_converter.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -33,15 +33,15 @@ class DictField { const T& operator()() const { return value_; } // Adds this field to the dictionary var. - bool AddTo(VarDictionary_Dev* dict) const { + bool AddTo(VarDictionary* dict) const { if (!dict) return false; internal::ToVarConverter<T> converter(value_); - return PP_ToBool(dict->Set(Var(key_), converter.var())); + return dict->Set(Var(key_), converter.var()); } - bool Populate(const VarDictionary_Dev& dict) { + bool Populate(const VarDictionary& dict) { Var value_var = dict.Get(Var(key_)); if (value_var.is_undefined()) return false; @@ -72,17 +72,17 @@ class OptionalDictField { const Optional<T>& operator()() const { return value_; } // Adds this field to the dictionary var, if |value| has been set. - bool MayAddTo(VarDictionary_Dev* dict) const { + bool MayAddTo(VarDictionary* dict) const { if (!dict) return false; if (!value_.IsSet()) return true; internal::ToVarConverter<T> converter(*value_); - return PP_ToBool(dict->Set(Var(key_), converter.var())); + return dict->Set(Var(key_), converter.var()); } - bool Populate(const VarDictionary_Dev& dict) { + bool Populate(const VarDictionary& dict) { Var value_var = dict.Get(Var(key_)); internal::FromVarConverter<Optional<T> > converter(value_var.pp_var()); value_.Swap(&converter.value()); diff --git a/ppapi/cpp/extensions/ext_output_traits.h b/ppapi/cpp/extensions/ext_output_traits.h index 9c1cb2a..08dc744c 100644 --- a/ppapi/cpp/extensions/ext_output_traits.h +++ b/ppapi/cpp/extensions/ext_output_traits.h @@ -8,11 +8,11 @@ #include <vector> #include "ppapi/c/pp_var.h" -#include "ppapi/cpp/dev/var_array_dev.h" #include "ppapi/cpp/extensions/from_var_converter.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/pass_ref.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" namespace pp { namespace ext { @@ -92,7 +92,7 @@ class ArrayVarOutputAdapterWithStorage { Var var(PASS_REF, pp_var_); pp_var_ = PP_MakeUndefined(); if (var.is_array()) { - VarArray_Dev array(var); + VarArray array(var); uint32_t length = array.GetLength(); output_storage_.reserve(length); diff --git a/ppapi/cpp/extensions/from_var_converter.h b/ppapi/cpp/extensions/from_var_converter.h index 094f0c4..06ae0df 100644 --- a/ppapi/cpp/extensions/from_var_converter.h +++ b/ppapi/cpp/extensions/from_var_converter.h @@ -8,12 +8,12 @@ #include <string> #include "ppapi/c/pp_var.h" -#include "ppapi/cpp/dev/var_array_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -173,8 +173,8 @@ class FromVarConverter<Var> : public FromVarConverterBase<Var> { }; template <> -class FromVarConverter<VarArray_Dev> - : public FromVarConverterBase<VarArray_Dev> { +class FromVarConverter<VarArray> + : public FromVarConverterBase<VarArray> { public: FromVarConverter() { } @@ -187,13 +187,13 @@ class FromVarConverter<VarArray_Dev> } void Set(const PP_Var& var) { - FromVarConverterBase<VarArray_Dev>::value_ = Var(var); + FromVarConverterBase<VarArray>::value_ = Var(var); } }; template <> -class FromVarConverter<VarDictionary_Dev> - : public FromVarConverterBase<VarDictionary_Dev> { +class FromVarConverter<VarDictionary> + : public FromVarConverterBase<VarDictionary> { public: FromVarConverter() { } @@ -206,7 +206,7 @@ class FromVarConverter<VarDictionary_Dev> } void Set(const PP_Var& var) { - FromVarConverterBase<VarDictionary_Dev>::value_ = Var(var); + FromVarConverterBase<VarDictionary>::value_ = Var(var); } }; diff --git a/ppapi/cpp/extensions/to_var_converter.h b/ppapi/cpp/extensions/to_var_converter.h index 5913652..e384999 100644 --- a/ppapi/cpp/extensions/to_var_converter.h +++ b/ppapi/cpp/extensions/to_var_converter.h @@ -8,11 +8,11 @@ #include <string> #include "ppapi/c/pp_var.h" -#include "ppapi/cpp/dev/var_array_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/extensions/optional.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" namespace pp { namespace ext { @@ -120,7 +120,7 @@ class ToVarConverter<Var> : public ToVarConverterBase { }; template <> -class ToVarConverter<VarArray_Dev> : public ToVarConverterBase { +class ToVarConverter<VarArray> : public ToVarConverterBase { public: explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) { } @@ -130,7 +130,7 @@ class ToVarConverter<VarArray_Dev> : public ToVarConverterBase { }; template <> -class ToVarConverter<VarDictionary_Dev> : public ToVarConverterBase { +class ToVarConverter<VarDictionary> : public ToVarConverterBase { public: explicit ToVarConverter(const Var& object) : ToVarConverterBase(object) { } diff --git a/ppapi/cpp/var_array.cc b/ppapi/cpp/var_array.cc new file mode 100644 index 0000000..7a504e7 --- /dev/null +++ b/ppapi/cpp/var_array.cc @@ -0,0 +1,96 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/var_array.h" + +#include "ppapi/c/ppb_var_array.h" +#include "ppapi/cpp/logging.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_VarArray_1_0>() { + return PPB_VAR_ARRAY_INTERFACE_1_0; +} + +} // namespace + +VarArray::VarArray() : Var(Null()) { + if (has_interface<PPB_VarArray_1_0>()) + var_ = get_interface<PPB_VarArray_1_0>()->Create(); + else + PP_NOTREACHED(); +} + +VarArray::VarArray(const Var& var) : Var(var) { + if (!var.is_array()) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarArray::VarArray(const PP_Var& var) : Var(var) { + if (var.type != PP_VARTYPE_ARRAY) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarArray::VarArray(const VarArray& other) : Var(other) { +} + +VarArray::~VarArray() { +} + +VarArray& VarArray::operator=(const VarArray& other) { + Var::operator=(other); + return *this; +} + +Var& VarArray::operator=(const Var& other) { + if (other.is_array()) { + Var::operator=(other); + } else { + PP_NOTREACHED(); + Var::operator=(Var(Null())); + } + return *this; +} + +Var VarArray::Get(uint32_t index) const { + if (!has_interface<PPB_VarArray_1_0>()) + return Var(); + + return Var(PASS_REF, get_interface<PPB_VarArray_1_0>()->Get(var_, index)); +} + +bool VarArray::Set(uint32_t index, const Var& value) { + if (!has_interface<PPB_VarArray_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarArray_1_0>()->Set(var_, index, + value.pp_var())); +} + +uint32_t VarArray::GetLength() const { + if (!has_interface<PPB_VarArray_1_0>()) + return 0; + + return get_interface<PPB_VarArray_1_0>()->GetLength(var_); +} + +bool VarArray::SetLength(uint32_t length) { + if (!has_interface<PPB_VarArray_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarArray_1_0>()->SetLength(var_, length)); +} + +} // namespace pp diff --git a/ppapi/cpp/dev/var_array_dev.h b/ppapi/cpp/var_array.h index 17a3277..49373ff 100644 --- a/ppapi/cpp/dev/var_array_dev.h +++ b/ppapi/cpp/var_array.h @@ -1,9 +1,9 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ -#define PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ +#ifndef PPAPI_CPP_VAR_ARRAY_H_ +#define PPAPI_CPP_VAR_ARRAY_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_stdint.h" @@ -14,38 +14,38 @@ namespace pp { -class VarArray_Dev : public Var { +class VarArray : public Var { public: /// Constructs a new array var. - VarArray_Dev(); + VarArray(); - /// Constructs a <code>VarArray_Dev</code> given a var for which is_array() is + /// Constructs a <code>VarArray</code> given a var for which is_array() is /// true. This will refer to the same array var, but allow you to access /// methods specific to arrays. /// /// @param[in] var An array var. - explicit VarArray_Dev(const Var& var); + explicit VarArray(const Var& var); - /// Constructs a <code>VarArray_Dev</code> given a <code>PP_Var</code> of type + /// Constructs a <code>VarArray</code> given a <code>PP_Var</code> of type /// PP_VARTYPE_ARRAY. /// /// @param[in] var A <code>PP_Var</code> of type PP_VARTYPE_ARRAY. - explicit VarArray_Dev(const PP_Var& var); + explicit VarArray(const PP_Var& var); /// Copy constructor. - VarArray_Dev(const VarArray_Dev& other); + VarArray(const VarArray& other); - virtual ~VarArray_Dev(); + virtual ~VarArray(); /// Assignment operator. - VarArray_Dev& operator=(const VarArray_Dev& other); + VarArray& operator=(const VarArray& other); /// The <code>Var</code> assignment operator is overridden here so that we can - /// check for assigning a non-array var to a <code>VarArray_Dev</code>. + /// check for assigning a non-array var to a <code>VarArray</code>. /// /// @param[in] other The array var to be assigned. /// - /// @return The resulting <code>VarArray_Dev</code> (as a <code>Var</code>&). + /// @return The resulting <code>VarArray</code> (as a <code>Var</code>&). virtual Var& operator=(const Var& other); /// Gets an element from the array. @@ -65,8 +65,8 @@ class VarArray_Dev : public Var { /// type <code>PP_VARTYPE_UNDEFINED</code>. /// @param[in] value The value to set. /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool Set(uint32_t index, const Var& value); + /// @return A <code>bool</code> indicating whether the operation succeeds. + bool Set(uint32_t index, const Var& value); /// Gets the array length. /// @@ -81,10 +81,10 @@ class VarArray_Dev : public Var { /// than its current value, undefined vars are appended to increase the array /// to the specified length. /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool SetLength(uint32_t length); + /// @return A <code>bool</code> indicating whether the operation succeeds. + bool SetLength(uint32_t length); }; } // namespace pp -#endif // PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ +#endif // PPAPI_CPP_VAR_ARRAY_H_ diff --git a/ppapi/cpp/var_dictionary.cc b/ppapi/cpp/var_dictionary.cc new file mode 100644 index 0000000..600b1f2 --- /dev/null +++ b/ppapi/cpp/var_dictionary.cc @@ -0,0 +1,111 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/var_dictionary.h" + +#include "ppapi/c/ppb_var_dictionary.h" +#include "ppapi/cpp/logging.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_VarDictionary_1_0>() { + return PPB_VAR_DICTIONARY_INTERFACE_1_0; +} + +} // namespace + +VarDictionary::VarDictionary() : Var(Null()) { + if (has_interface<PPB_VarDictionary_1_0>()) + var_ = get_interface<PPB_VarDictionary_1_0>()->Create(); + else + PP_NOTREACHED(); +} + +VarDictionary::VarDictionary(const Var& var) : Var(var) { + if (!var.is_dictionary()) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarDictionary::VarDictionary(const PP_Var& var) : Var(var) { + if (var.type != PP_VARTYPE_DICTIONARY) { + PP_NOTREACHED(); + + // This takes care of releasing the reference that this object holds. + Var::operator=(Var(Null())); + } +} + +VarDictionary::VarDictionary(const VarDictionary& other) + : Var(other) { +} + +VarDictionary::~VarDictionary() { +} + +VarDictionary& VarDictionary::operator=( + const VarDictionary& other) { + Var::operator=(other); + return *this; +} + +Var& VarDictionary::operator=(const Var& other) { + if (other.is_dictionary()) { + Var::operator=(other); + } else { + PP_NOTREACHED(); + Var::operator=(Var(Null())); + } + return *this; +} + +Var VarDictionary::Get(const Var& key) const { + if (!has_interface<PPB_VarDictionary_1_0>()) + return Var(); + + return Var( + PASS_REF, + get_interface<PPB_VarDictionary_1_0>()->Get(var_, key.pp_var())); +} + +bool VarDictionary::Set(const Var& key, const Var& value) { + if (!has_interface<PPB_VarDictionary_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarDictionary_1_0>()->Set( + var_, key.pp_var(), value.pp_var())); +} + +void VarDictionary::Delete(const Var& key) { + if (has_interface<PPB_VarDictionary_1_0>()) + get_interface<PPB_VarDictionary_1_0>()->Delete(var_, key.pp_var()); +} + +bool VarDictionary::HasKey(const Var& key) const { + if (!has_interface<PPB_VarDictionary_1_0>()) + return false; + + return PP_ToBool(get_interface<PPB_VarDictionary_1_0>()->HasKey( + var_, key.pp_var())); +} + +VarArray VarDictionary::GetKeys() const { + if (!has_interface<PPB_VarDictionary_1_0>()) + return VarArray(); + + Var result(PASS_REF, + get_interface<PPB_VarDictionary_1_0>()->GetKeys(var_)); + if (result.is_array()) + return VarArray(result); + else + return VarArray(); +} + +} // namespace pp diff --git a/ppapi/cpp/dev/var_dictionary_dev.h b/ppapi/cpp/var_dictionary.h index 2b2e79d..1c5bd2b 100644 --- a/ppapi/cpp/dev/var_dictionary_dev.h +++ b/ppapi/cpp/var_dictionary.h @@ -1,52 +1,52 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ -#define PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ +#ifndef PPAPI_CPP_VAR_DICTIONARY_H_ +#define PPAPI_CPP_VAR_DICTIONARY_H_ #include "ppapi/c/pp_bool.h" -#include "ppapi/cpp/dev/var_array_dev.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" /// @file /// This file defines the API for interacting with dictionary vars. namespace pp { -class VarDictionary_Dev : public Var { +class VarDictionary : public Var { public: /// Constructs a new dictionary var. - VarDictionary_Dev(); + VarDictionary(); - /// Constructs a <code>VarDictionary_Dev</code> given a var for which + /// Constructs a <code>VarDictionary</code> given a var for which /// is_dictionary() is true. This will refer to the same dictionary var, but /// allow you to access methods specific to dictionary. /// /// @param[in] var A dictionary var. - explicit VarDictionary_Dev(const Var& var); + explicit VarDictionary(const Var& var); - /// Constructs a <code>VarDictionary_Dev</code> given a <code>PP_Var</code> + /// Constructs a <code>VarDictionary</code> given a <code>PP_Var</code> /// of type PP_VARTYPE_DICTIONARY. /// /// @param[in] var A <code>PP_Var</code> of type PP_VARTYPE_DICTIONARY. - explicit VarDictionary_Dev(const PP_Var& var); + explicit VarDictionary(const PP_Var& var); /// Copy constructor. - VarDictionary_Dev(const VarDictionary_Dev& other); + VarDictionary(const VarDictionary& other); - virtual ~VarDictionary_Dev(); + virtual ~VarDictionary(); /// Assignment operator. - VarDictionary_Dev& operator=(const VarDictionary_Dev& other); + VarDictionary& operator=(const VarDictionary& other); /// The <code>Var</code> assignment operator is overridden here so that we can /// check for assigning a non-dictionary var to a - /// <code>VarDictionary_Dev</code>. + /// <code>VarDictionary</code>. /// /// @param[in] other The dictionary var to be assigned. /// - /// @return The resulting <code>VarDictionary_Dev</code> (as a + /// @return The resulting <code>VarDictionary</code> (as a /// <code>Var</code>&). virtual Var& operator=(const Var& other); @@ -66,8 +66,8 @@ class VarDictionary_Dev : public Var { /// previous value is replaced with <code>value</code>. /// @param[in] value The value to set. /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool Set(const Var& key, const Var& value); + /// @return A <code>bool</code> indicating whether the operation succeeds. + bool Set(const Var& key, const Var& value); /// Deletes the specified key and its associated value, if the key exists. /// @@ -78,16 +78,16 @@ class VarDictionary_Dev : public Var { /// /// @param[in] key A string var. /// - /// @return A <code>PP_Bool</code> indicating whether the key exists. - PP_Bool HasKey(const Var& key) const; + /// @return A <code>bool</code> indicating whether the key exists. + bool HasKey(const Var& key) const; /// Gets all the keys in the dictionary. /// /// @return An array var which contains all the keys of the dictionary. /// The elements are string vars. Returns an empty array var if failed. - VarArray_Dev GetKeys() const; + VarArray GetKeys() const; }; } // namespace pp -#endif // PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ +#endif // PPAPI_CPP_VAR_DICTIONARY_H_ diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 4363aaa..8e1d9dd 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -31,8 +31,6 @@ #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_udp_socket_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" -#include "ppapi/c/dev/ppb_var_array_dev.h" -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppb_view_dev.h" @@ -72,7 +70,9 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppp_graphics_3d.h" @@ -164,7 +164,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLRequestInfo_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0; @@ -214,8 +216,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Trace_Event_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16; @@ -1102,6 +1102,35 @@ static const char* Pnacl_M18_PPB_Var_VarToUtf8(struct PP_Var* var, uint32_t* len /* End wrapper methods for PPB_Var_1_1 */ +/* Begin wrapper methods for PPB_VarArray_1_0 */ + +static void Pnacl_M29_PPB_VarArray_Create(struct PP_Var* _struct_result) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + *_struct_result = iface->Create(); +} + +static void Pnacl_M29_PPB_VarArray_Get(struct PP_Var* _struct_result, struct PP_Var* array, uint32_t index) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + *_struct_result = iface->Get(*array, index); +} + +static PP_Bool Pnacl_M29_PPB_VarArray_Set(struct PP_Var* array, uint32_t index, struct PP_Var* value) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + return iface->Set(*array, index, *value); +} + +static uint32_t Pnacl_M29_PPB_VarArray_GetLength(struct PP_Var* array) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + return iface->GetLength(*array); +} + +static PP_Bool Pnacl_M29_PPB_VarArray_SetLength(struct PP_Var* array, uint32_t length) { + const struct PPB_VarArray_1_0 *iface = Pnacl_WrapperInfo_PPB_VarArray_1_0.real_iface; + return iface->SetLength(*array, length); +} + +/* End wrapper methods for PPB_VarArray_1_0 */ + /* Begin wrapper methods for PPB_VarArrayBuffer_1_0 */ static void Pnacl_M18_PPB_VarArrayBuffer_Create(struct PP_Var* _struct_result, uint32_t size_in_bytes) { @@ -1126,6 +1155,40 @@ static void Pnacl_M18_PPB_VarArrayBuffer_Unmap(struct PP_Var* array) { /* End wrapper methods for PPB_VarArrayBuffer_1_0 */ +/* Begin wrapper methods for PPB_VarDictionary_1_0 */ + +static void Pnacl_M29_PPB_VarDictionary_Create(struct PP_Var* _struct_result) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + *_struct_result = iface->Create(); +} + +static void Pnacl_M29_PPB_VarDictionary_Get(struct PP_Var* _struct_result, struct PP_Var* dict, struct PP_Var* key) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + *_struct_result = iface->Get(*dict, *key); +} + +static PP_Bool Pnacl_M29_PPB_VarDictionary_Set(struct PP_Var* dict, struct PP_Var* key, struct PP_Var* value) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + return iface->Set(*dict, *key, *value); +} + +static void Pnacl_M29_PPB_VarDictionary_Delete(struct PP_Var* dict, struct PP_Var* key) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + iface->Delete(*dict, *key); +} + +static PP_Bool Pnacl_M29_PPB_VarDictionary_HasKey(struct PP_Var* dict, struct PP_Var* key) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + return iface->HasKey(*dict, *key); +} + +static void Pnacl_M29_PPB_VarDictionary_GetKeys(struct PP_Var* _struct_result, struct PP_Var* dict) { + const struct PPB_VarDictionary_1_0 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_1_0.real_iface; + *_struct_result = iface->GetKeys(*dict); +} + +/* End wrapper methods for PPB_VarDictionary_1_0 */ + /* Not generating wrapper methods for PPB_View_1_0 */ /* Not generating wrapper methods for PPB_View_1_1 */ @@ -2075,69 +2138,6 @@ static void Pnacl_M17_PPB_URLUtil_Dev_GetPluginInstanceURL(struct PP_Var* _struc /* End wrapper methods for PPB_URLUtil_Dev_0_6 */ -/* Begin wrapper methods for PPB_VarArray_Dev_0_1 */ - -static void Pnacl_M27_PPB_VarArray_Dev_Create(struct PP_Var* _struct_result) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - *_struct_result = iface->Create(); -} - -static void Pnacl_M27_PPB_VarArray_Dev_Get(struct PP_Var* _struct_result, struct PP_Var* array, uint32_t index) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - *_struct_result = iface->Get(*array, index); -} - -static PP_Bool Pnacl_M27_PPB_VarArray_Dev_Set(struct PP_Var* array, uint32_t index, struct PP_Var* value) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - return iface->Set(*array, index, *value); -} - -static uint32_t Pnacl_M27_PPB_VarArray_Dev_GetLength(struct PP_Var* array) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - return iface->GetLength(*array); -} - -static PP_Bool Pnacl_M27_PPB_VarArray_Dev_SetLength(struct PP_Var* array, uint32_t length) { - const struct PPB_VarArray_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1.real_iface; - return iface->SetLength(*array, length); -} - -/* End wrapper methods for PPB_VarArray_Dev_0_1 */ - -/* Begin wrapper methods for PPB_VarDictionary_Dev_0_1 */ - -static void Pnacl_M27_PPB_VarDictionary_Dev_Create(struct PP_Var* _struct_result) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - *_struct_result = iface->Create(); -} - -static void Pnacl_M27_PPB_VarDictionary_Dev_Get(struct PP_Var* _struct_result, struct PP_Var* dict, struct PP_Var* key) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - *_struct_result = iface->Get(*dict, *key); -} - -static PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_Set(struct PP_Var* dict, struct PP_Var* key, struct PP_Var* value) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - return iface->Set(*dict, *key, *value); -} - -static void Pnacl_M27_PPB_VarDictionary_Dev_Delete(struct PP_Var* dict, struct PP_Var* key) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - iface->Delete(*dict, *key); -} - -static PP_Bool Pnacl_M27_PPB_VarDictionary_Dev_HasKey(struct PP_Var* dict, struct PP_Var* key) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - return iface->HasKey(*dict, *key); -} - -static void Pnacl_M27_PPB_VarDictionary_Dev_GetKeys(struct PP_Var* _struct_result, struct PP_Var* dict) { - const struct PPB_VarDictionary_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1.real_iface; - *_struct_result = iface->GetKeys(*dict); -} - -/* End wrapper methods for PPB_VarDictionary_Dev_0_1 */ - /* Begin wrapper methods for PPB_VideoCapture_Dev_0_2 */ static PP_Resource Pnacl_M19_PPB_VideoCapture_Dev_Create(PP_Instance instance) { @@ -4121,6 +4121,14 @@ struct PPB_Var_1_1 Pnacl_Wrappers_PPB_Var_1_1 = { .VarToUtf8 = (const char* (*)(struct PP_Var var, uint32_t* len))&Pnacl_M18_PPB_Var_VarToUtf8 }; +struct PPB_VarArray_1_0 Pnacl_Wrappers_PPB_VarArray_1_0 = { + .Create = (struct PP_Var (*)(void))&Pnacl_M29_PPB_VarArray_Create, + .Get = (struct PP_Var (*)(struct PP_Var array, uint32_t index))&Pnacl_M29_PPB_VarArray_Get, + .Set = (PP_Bool (*)(struct PP_Var array, uint32_t index, struct PP_Var value))&Pnacl_M29_PPB_VarArray_Set, + .GetLength = (uint32_t (*)(struct PP_Var array))&Pnacl_M29_PPB_VarArray_GetLength, + .SetLength = (PP_Bool (*)(struct PP_Var array, uint32_t length))&Pnacl_M29_PPB_VarArray_SetLength +}; + struct PPB_VarArrayBuffer_1_0 Pnacl_Wrappers_PPB_VarArrayBuffer_1_0 = { .Create = (struct PP_Var (*)(uint32_t size_in_bytes))&Pnacl_M18_PPB_VarArrayBuffer_Create, .ByteLength = (PP_Bool (*)(struct PP_Var array, uint32_t* byte_length))&Pnacl_M18_PPB_VarArrayBuffer_ByteLength, @@ -4128,6 +4136,15 @@ struct PPB_VarArrayBuffer_1_0 Pnacl_Wrappers_PPB_VarArrayBuffer_1_0 = { .Unmap = (void (*)(struct PP_Var array))&Pnacl_M18_PPB_VarArrayBuffer_Unmap }; +struct PPB_VarDictionary_1_0 Pnacl_Wrappers_PPB_VarDictionary_1_0 = { + .Create = (struct PP_Var (*)(void))&Pnacl_M29_PPB_VarDictionary_Create, + .Get = (struct PP_Var (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M29_PPB_VarDictionary_Get, + .Set = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key, struct PP_Var value))&Pnacl_M29_PPB_VarDictionary_Set, + .Delete = (void (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M29_PPB_VarDictionary_Delete, + .HasKey = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M29_PPB_VarDictionary_HasKey, + .GetKeys = (struct PP_Var (*)(struct PP_Var dict))&Pnacl_M29_PPB_VarDictionary_GetKeys +}; + /* Not generating wrapper interface for PPB_View_1_0 */ /* Not generating wrapper interface for PPB_View_1_1 */ @@ -4412,23 +4429,6 @@ struct PPB_URLUtil_Dev_0_6 Pnacl_Wrappers_PPB_URLUtil_Dev_0_6 = { .GetPluginInstanceURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_URLUtil_Dev_GetPluginInstanceURL }; -struct PPB_VarArray_Dev_0_1 Pnacl_Wrappers_PPB_VarArray_Dev_0_1 = { - .Create = (struct PP_Var (*)(void))&Pnacl_M27_PPB_VarArray_Dev_Create, - .Get = (struct PP_Var (*)(struct PP_Var array, uint32_t index))&Pnacl_M27_PPB_VarArray_Dev_Get, - .Set = (PP_Bool (*)(struct PP_Var array, uint32_t index, struct PP_Var value))&Pnacl_M27_PPB_VarArray_Dev_Set, - .GetLength = (uint32_t (*)(struct PP_Var array))&Pnacl_M27_PPB_VarArray_Dev_GetLength, - .SetLength = (PP_Bool (*)(struct PP_Var array, uint32_t length))&Pnacl_M27_PPB_VarArray_Dev_SetLength -}; - -struct PPB_VarDictionary_Dev_0_1 Pnacl_Wrappers_PPB_VarDictionary_Dev_0_1 = { - .Create = (struct PP_Var (*)(void))&Pnacl_M27_PPB_VarDictionary_Dev_Create, - .Get = (struct PP_Var (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_Get, - .Set = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key, struct PP_Var value))&Pnacl_M27_PPB_VarDictionary_Dev_Set, - .Delete = (void (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_Delete, - .HasKey = (PP_Bool (*)(struct PP_Var dict, struct PP_Var key))&Pnacl_M27_PPB_VarDictionary_Dev_HasKey, - .GetKeys = (struct PP_Var (*)(struct PP_Var dict))&Pnacl_M27_PPB_VarDictionary_Dev_GetKeys -}; - struct PPB_VideoCapture_Dev_0_2 Pnacl_Wrappers_PPB_VideoCapture_Dev_0_2 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_VideoCapture_Dev_Create, .IsVideoCapture = (PP_Bool (*)(PP_Resource video_capture))&Pnacl_M19_PPB_VideoCapture_Dev_IsVideoCapture, @@ -5103,12 +5103,24 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_1 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_1_0 = { + .iface_macro = PPB_VAR_ARRAY_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArray_1_0, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0 = { .iface_macro = PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArrayBuffer_1_0, .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_1_0 = { + .iface_macro = PPB_VAR_DICTIONARY_INTERFACE_1_0, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarDictionary_1_0, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_0 = { .iface_macro = PPB_VIEW_INTERFACE_1_0, .wrapped_iface = NULL /* Still need slot for real_iface */, @@ -5403,18 +5415,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1 = { - .iface_macro = PPB_VAR_ARRAY_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarArray_Dev_0_1, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1 = { - .iface_macro = PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VarDictionary_Dev_0_1, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2 = { .iface_macro = PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoCapture_Dev_0_2, @@ -5862,7 +5862,9 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0, &Pnacl_WrapperInfo_PPB_Var_1_0, &Pnacl_WrapperInfo_PPB_Var_1_1, + &Pnacl_WrapperInfo_PPB_VarArray_1_0, &Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0, + &Pnacl_WrapperInfo_PPB_VarDictionary_1_0, &Pnacl_WrapperInfo_PPB_View_1_0, &Pnacl_WrapperInfo_PPB_View_1_1, &Pnacl_WrapperInfo_PPB_WebSocket_1_0, @@ -5906,8 +5908,6 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_TrueTypeFont_Dev_0_1, &Pnacl_WrapperInfo_PPB_UDPSocket_Dev_0_1, &Pnacl_WrapperInfo_PPB_URLUtil_Dev_0_6, - &Pnacl_WrapperInfo_PPB_VarArray_Dev_0_1, - &Pnacl_WrapperInfo_PPB_VarDictionary_Dev_0_1, &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2, &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3, &Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16, diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index a93bbce..06ff1c4 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -47,7 +47,9 @@ 'c/ppb_url_request_info.h', 'c/ppb_url_response_info.h', 'c/ppb_var.h', + 'c/ppb_var_array.h', 'c/ppb_var_array_buffer.h', + 'c/ppb_var_dictionary.h', 'c/ppb_view.h', 'c/ppb_websocket.h', 'c/ppp.h', @@ -80,8 +82,6 @@ 'c/dev/ppb_truetype_font_dev.h', 'c/dev/ppb_udp_socket_dev.h', 'c/dev/ppb_url_util_dev.h', - 'c/dev/ppb_var_array_dev.h', - 'c/dev/ppb_var_dictionary_dev.h', 'c/dev/ppb_video_decoder_dev.h', 'c/dev/ppb_widget_dev.h', 'c/dev/ppb_zoom_dev.h', @@ -203,8 +203,12 @@ 'cpp/url_response_info.h', 'cpp/var.cc', 'cpp/var.h', + 'cpp/var_array.cc', + 'cpp/var_array.h', 'cpp/var_array_buffer.cc', 'cpp/var_array_buffer.h', + 'cpp/var_dictionary.cc', + 'cpp/var_dictionary.h', 'cpp/view.cc', 'cpp/view.h', 'cpp/websocket.cc', @@ -255,10 +259,6 @@ 'cpp/dev/udp_socket_dev.h', 'cpp/dev/url_util_dev.cc', 'cpp/dev/url_util_dev.h', - 'cpp/dev/var_array_dev.cc', - 'cpp/dev/var_array_dev.h', - 'cpp/dev/var_dictionary_dev.cc', - 'cpp/dev/var_dictionary_dev.h', 'cpp/dev/video_capture_client_dev.cc', 'cpp/dev/video_capture_client_dev.h', 'cpp/dev/video_capture_dev.cc', diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index 122e96a..e88a6e3 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -30,9 +30,7 @@ #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_udp_socket_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" -#include "ppapi/c/dev/ppb_var_array_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" #include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h" @@ -57,7 +55,9 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp_instance.h" diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index da9bf57..95e0108 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -34,9 +34,7 @@ #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_udp_socket_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" -#include "ppapi/c/dev/ppb_var_array_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/dev/ppb_widget_dev.h" @@ -91,7 +89,9 @@ #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_graphics_3d.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index f41b1b5..9f6bc7d 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -31,8 +31,6 @@ #include "ppapi/cpp/dev/text_input_dev.h" #include "ppapi/cpp/dev/udp_socket_dev.h" #include "ppapi/cpp/dev/url_util_dev.h" -#include "ppapi/cpp/dev/var_array_dev.h" -#include "ppapi/cpp/dev/var_dictionary_dev.h" #include "ppapi/cpp/dev/video_decoder_dev.h" #include "ppapi/cpp/dev/view_dev.h" #include "ppapi/cpp/dev/widget_client_dev.h" @@ -75,7 +73,9 @@ #include "ppapi/cpp/url_request_info.h" #include "ppapi/cpp/url_response_info.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" #include "ppapi/cpp/websocket.h" #include "ppapi/utility/completion_callback_factory.h" #include "ppapi/utility/completion_callback_factory_thread_traits.h" diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc index 944b5614..36101fb 100644 --- a/ppapi/tests/test_post_message.cc +++ b/ppapi/tests/test_post_message.cc @@ -12,7 +12,9 @@ #include "ppapi/c/pp_var.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/var.h" +#include "ppapi/cpp/var_array.h" #include "ppapi/cpp/var_array_buffer.h" +#include "ppapi/cpp/var_dictionary.h" #include "ppapi/tests/pp_thread.h" #include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" @@ -82,8 +84,8 @@ bool VarsEqual(const pp::Var& expected, if (expected.is_number()) { return fabs(expected.AsDouble() - actual.AsDouble()) < 1.0e-4; } else if (expected.is_array()) { - pp::VarArray_Dev expected_array(expected); - pp::VarArray_Dev actual_array(actual); + pp::VarArray expected_array(expected); + pp::VarArray actual_array(actual); if (expected_array.GetLength() != actual_array.GetLength()) return false; for (uint32_t i = 0; i < expected_array.GetLength(); ++i) { @@ -92,15 +94,15 @@ bool VarsEqual(const pp::Var& expected, } return true; } else if (expected.is_dictionary()) { - pp::VarDictionary_Dev expected_dict(expected); - pp::VarDictionary_Dev actual_dict(actual); + pp::VarDictionary expected_dict(expected); + pp::VarDictionary actual_dict(actual); if (expected_dict.GetKeys().GetLength() != actual_dict.GetKeys().GetLength()) { return false; } for (uint32_t i = 0; i < expected_dict.GetKeys().GetLength(); ++i) { pp::Var key = expected_dict.GetKeys().Get(i); - if (actual_dict.HasKey(key) == PP_FALSE) + if (!actual_dict.HasKey(key)) return false; if (!VarsEqual(expected_dict.Get(key), actual_dict.Get(key), visited_ids)) return false; @@ -448,7 +450,7 @@ std::string TestPostMessage::TestSendingArray() { WaitForMessages(); ASSERT_TRUE(ClearListeners()); - pp::VarArray_Dev array; + pp::VarArray array; array.Set(0, pp::Var(kTestBool)); array.Set(1, pp::Var(kTestString)); // Purposely leave index 2 empty. @@ -491,7 +493,7 @@ std::string TestPostMessage::TestSendingDictionary() { WaitForMessages(); ASSERT_TRUE(ClearListeners()); - pp::VarDictionary_Dev dictionary; + pp::VarDictionary dictionary; dictionary.Set(pp::Var("foo"), pp::Var(kTestBool)); dictionary.Set(pp::Var("bar"), pp::Var(kTestString)); dictionary.Set(pp::Var("abc"), pp::Var(kTestInt)); @@ -537,14 +539,14 @@ std::string TestPostMessage::TestSendingComplexVar() { ASSERT_TRUE(ClearListeners()); pp::Var string(kTestString); - pp::VarDictionary_Dev dictionary; + pp::VarDictionary dictionary; dictionary.Set(pp::Var("foo"), pp::Var(kTestBool)); dictionary.Set(pp::Var("bar"), string); dictionary.Set(pp::Var("abc"), pp::Var(kTestInt)); dictionary.Set(pp::Var("def"), pp::Var()); // Reference to array. - pp::VarArray_Dev array; + pp::VarArray array; array.Set(0, pp::Var(kTestBool)); array.Set(1, string); // Purposely leave index 2 empty (which will place an undefined var there). @@ -562,7 +564,7 @@ std::string TestPostMessage::TestSendingComplexVar() { ASSERT_EQ(message_data_.size(), 0); ASSERT_EQ(WaitForMessages(), 1); ASSERT_TRUE(message_data_.back().is_dictionary()); - pp::VarDictionary_Dev result(message_data_.back()); + pp::VarDictionary result(message_data_.back()); ASSERT_TRUE(VarsEqual(dictionary, message_data_.back())); WaitForMessages(); @@ -571,7 +573,7 @@ std::string TestPostMessage::TestSendingComplexVar() { // Set up a (dictionary -> array -> dictionary) cycle. Cycles shouldn't be // transmitted. - pp::VarArray_Dev array2; + pp::VarArray array2; array2.Set(0, dictionary); dictionary.Set(pp::Var("array2"), array2); diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 344e2ba..514cd36 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -46,9 +46,6 @@ PROXIED_IFACE(NoAPIName, PPB_TRUETYPEFONT_DEV_INTERFACE_0_1, PPB_TrueTypeFont_Dev_0_1) PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_DEV_INTERFACE_0_1, PPB_UDPSocket_Dev_0_1) -PROXIED_IFACE(NoAPIName, PPB_VAR_ARRAY_DEV_INTERFACE_0_1, PPB_VarArray_Dev_0_1) -PROXIED_IFACE(NoAPIName, PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1, - PPB_VarDictionary_Dev_0_1) PROXIED_IFACE(NoAPIName, PPB_VIEW_DEV_INTERFACE_0_1, PPB_View_Dev_0_1) UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2) diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h index ddfe2ca..bc621d4 100644 --- a/ppapi/thunk/interfaces_ppb_public_stable.h +++ b/ppapi/thunk/interfaces_ppb_public_stable.h @@ -77,6 +77,9 @@ PROXIED_IFACE(NoAPIName, PPB_URLREQUESTINFO_INTERFACE_1_0, PPB_URLRequestInfo_1_0) PROXIED_IFACE(NoAPIName, PPB_URLRESPONSEINFO_INTERFACE_1_0, PPB_URLResponseInfo_1_0) +PROXIED_IFACE(NoAPIName, PPB_VAR_ARRAY_INTERFACE_1_0, PPB_VarArray_1_0) +PROXIED_IFACE(NoAPIName, PPB_VAR_DICTIONARY_INTERFACE_1_0, + PPB_VarDictionary_1_0) PROXIED_IFACE(NoAPIName, PPB_WEBSOCKET_INTERFACE_1_0, PPB_WebSocket_1_0) // Note: PPB_Var and PPB_VarArrayBuffer are special and registered manually. diff --git a/ppapi/thunk/ppb_var_array_thunk.cc b/ppapi/thunk/ppb_var_array_thunk.cc index 7321424..9ab52ac 100644 --- a/ppapi/thunk/ppb_var_array_thunk.cc +++ b/ppapi/thunk/ppb_var_array_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/c/dev/ppb_var_array_dev.h" +#include "ppapi/c/ppb_var_array.h" #include "ppapi/shared_impl/array_var.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/thunk/thunk.h" @@ -56,7 +56,7 @@ PP_Bool SetLength(PP_Var array, uint32_t length) { return array_var->SetLength(length); } -const PPB_VarArray_Dev_0_1 g_ppb_vararray_0_1_thunk = { +const PPB_VarArray_1_0 g_ppb_vararray_1_0_thunk = { &Create, &Get, &Set, @@ -66,8 +66,8 @@ const PPB_VarArray_Dev_0_1 g_ppb_vararray_0_1_thunk = { } // namespace -const PPB_VarArray_Dev_0_1* GetPPB_VarArray_Dev_0_1_Thunk() { - return &g_ppb_vararray_0_1_thunk; +const PPB_VarArray_1_0* GetPPB_VarArray_1_0_Thunk() { + return &g_ppb_vararray_1_0_thunk; } } // namespace thunk diff --git a/ppapi/thunk/ppb_var_dictionary_thunk.cc b/ppapi/thunk/ppb_var_dictionary_thunk.cc index 25a8224..f2ace65 100644 --- a/ppapi/thunk/ppb_var_dictionary_thunk.cc +++ b/ppapi/thunk/ppb_var_dictionary_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/c/dev/ppb_var_dictionary_dev.h" +#include "ppapi/c/ppb_var_dictionary.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_var.h" #include "ppapi/shared_impl/dictionary_var.h" @@ -67,7 +67,7 @@ PP_Var GetKeys(PP_Var dict) { return dict_var->GetKeys(); } -const PPB_VarDictionary_Dev_0_1 g_ppb_vardictionary_0_1_thunk = { +const PPB_VarDictionary_1_0 g_ppb_vardictionary_1_0_thunk = { &Create, &Get, &Set, @@ -78,8 +78,8 @@ const PPB_VarDictionary_Dev_0_1 g_ppb_vardictionary_0_1_thunk = { } // namespace -const PPB_VarDictionary_Dev_0_1* GetPPB_VarDictionary_Dev_0_1_Thunk() { - return &g_ppb_vardictionary_0_1_thunk; +const PPB_VarDictionary_1_0* GetPPB_VarDictionary_1_0_Thunk() { + return &g_ppb_vardictionary_1_0_thunk; } } // namespace thunk |