// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef PPAPI_PROXY_RAW_VAR_DATA_H_ #define PPAPI_PROXY_RAW_VAR_DATA_H_ #include <stddef.h> #include <stdint.h> #include <memory> #include <vector> #include "base/functional/callback.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_var.h" #include "ppapi/proxy/ppapi_param_traits.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/proxy/serialized_handle.h" namespace base { class Pickle; class PickleIterator; } namespace IPC { class Message; } namespace ppapi { namespace proxy { class RawVarData; HandleWriter; // Contains the data associated with a graph of connected PP_Vars. Useful for // serializing/deserializing a graph of PP_Vars. First we compute the transitive // closure of the given PP_Var to find all PP_Vars which are referenced by that // var. A RawVarData object is created for each of these vars. We then write // data contained in each RawVarData to the message. The format looks like this: // idx | size | (number of vars in the graph) // 0 | var type | // | var data | // 1 | var type | // | var data | // 2 | var type | // | var data | // | .... | // // Vars that reference other vars (such as Arrays or Dictionaries) use indices // into the message to denote which PP_Var is pointed to. class PPAPI_PROXY_EXPORT RawVarDataGraph { … }; // Abstract base class for the data contained in a PP_Var. class RawVarData { … }; // A RawVarData class for PP_Vars which are value types. class BasicRawVarData : public RawVarData { … }; // A RawVarData class for string PP_Vars. class StringRawVarData : public RawVarData { … }; // A RawVarData class for array buffer PP_Vars. class ArrayBufferRawVarData : public RawVarData { … }; // A RawVarData class for array PP_Vars. class ArrayRawVarData : public RawVarData { … }; // A RawVarData class for dictionary PP_Vars. class DictionaryRawVarData : public RawVarData { … }; // A RawVarData class for resource PP_Vars. // This class does not hold a reference on the PP_Resource that is being // serialized. If sending a resource from the plugin to the host, the plugin // should not release the ResourceVar before sending the serialized message to // the host, and the host should immediately consume the ResourceVar before // processing further messages. class ResourceRawVarData : public RawVarData { … }; } // namespace proxy } // namespace ppapi #endif // PPAPI_PROXY_RAW_VAR_DATA_H_