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/cpp/dev | |
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/cpp/dev')
-rw-r--r-- | ppapi/cpp/dev/var_array_dev.cc | 96 | ||||
-rw-r--r-- | ppapi/cpp/dev/var_array_dev.h | 90 | ||||
-rw-r--r-- | ppapi/cpp/dev/var_dictionary_dev.cc | 110 | ||||
-rw-r--r-- | ppapi/cpp/dev/var_dictionary_dev.h | 93 |
4 files changed, 0 insertions, 389 deletions
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_array_dev.h b/ppapi/cpp/dev/var_array_dev.h deleted file mode 100644 index 17a3277..0000000 --- a/ppapi/cpp/dev/var_array_dev.h +++ /dev/null @@ -1,90 +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. - -#ifndef PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ -#define PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/cpp/var.h" - -/// @file -/// This file defines the API for interacting with array vars. - -namespace pp { - -class VarArray_Dev : public Var { - public: - /// Constructs a new array var. - VarArray_Dev(); - - /// Constructs a <code>VarArray_Dev</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); - - /// Constructs a <code>VarArray_Dev</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); - - /// Copy constructor. - VarArray_Dev(const VarArray_Dev& other); - - virtual ~VarArray_Dev(); - - /// Assignment operator. - VarArray_Dev& operator=(const VarArray_Dev& 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>. - /// - /// @param[in] other The array var to be assigned. - /// - /// @return The resulting <code>VarArray_Dev</code> (as a <code>Var</code>&). - virtual Var& operator=(const Var& other); - - /// Gets an element from the array. - /// - /// @param[in] index An index indicating which element to return. - /// - /// @return The element at the specified position. If <code>index</code> is - /// larger than or equal to the array length, an undefined var is returned. - Var Get(uint32_t index) const; - - /// Sets the value of an element in the array. - /// - /// @param[in] index An index indicating which element to modify. If - /// <code>index</code> is larger than or equal to the array length, the length - /// is updated to be <code>index</code> + 1. Any position in the array that - /// hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of - /// 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); - - /// Gets the array length. - /// - /// @return The array length. - uint32_t GetLength() const; - - /// Sets the array length. - /// - /// @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. - /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool SetLength(uint32_t length); -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ 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/dev/var_dictionary_dev.h b/ppapi/cpp/dev/var_dictionary_dev.h deleted file mode 100644 index 2b2e79d..0000000 --- a/ppapi/cpp/dev/var_dictionary_dev.h +++ /dev/null @@ -1,93 +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. - -#ifndef PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ -#define PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/cpp/dev/var_array_dev.h" -#include "ppapi/cpp/var.h" - -/// @file -/// This file defines the API for interacting with dictionary vars. - -namespace pp { - -class VarDictionary_Dev : public Var { - public: - /// Constructs a new dictionary var. - VarDictionary_Dev(); - - /// Constructs a <code>VarDictionary_Dev</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); - - /// Constructs a <code>VarDictionary_Dev</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); - - /// Copy constructor. - VarDictionary_Dev(const VarDictionary_Dev& other); - - virtual ~VarDictionary_Dev(); - - /// Assignment operator. - VarDictionary_Dev& operator=(const VarDictionary_Dev& 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>. - /// - /// @param[in] other The dictionary var to be assigned. - /// - /// @return The resulting <code>VarDictionary_Dev</code> (as a - /// <code>Var</code>&). - virtual Var& operator=(const Var& other); - - /// Gets the value associated with the specified key. - /// - /// @param[in] key A string var. - /// - /// @return The value that is associated with <code>key</code>. If - /// <code>key</code> is not a string var, or it doesn't exist in the - /// dictionary, an undefined var is returned. - Var Get(const Var& key) const; - - /// Sets the value associated with the specified key. - /// - /// @param[in] key A string var. If this key hasn't existed in the dictionary, - /// 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. - /// - /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. - PP_Bool Set(const Var& key, const Var& value); - - /// Deletes the specified key and its associated value, if the key exists. - /// - /// @param[in] key A string var. - void Delete(const Var& key); - - /// Checks whether a key exists. - /// - /// @param[in] key A string var. - /// - /// @return A <code>PP_Bool</code> indicating whether the key exists. - PP_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; -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_ |