Chromium Code Reviews| Index: ppapi/proxy/serialized_var.h |
| diff --git a/ppapi/proxy/serialized_var.h b/ppapi/proxy/serialized_var.h |
| index 98cafa0dac3afe009b54e821ec53dbaa063fa768..0b8e7966738b71246b6492e5727caf6dbc89a194 100644 |
| --- a/ppapi/proxy/serialized_var.h |
| +++ b/ppapi/proxy/serialized_var.h |
| @@ -80,12 +80,24 @@ class PPAPI_PROXY_EXPORT SerializedVar { |
| void WriteToMessage(IPC::Message* m) const { |
| inner_->WriteToMessage(m); |
| } |
| + // If ReadFromMessage has been called, WriteDataToMessage will write the var |
| + // that has been read from ReadFromMessage back to a message. This is used |
| + // when converting handles for use in NaCl. |
| + void WriteDataToMessage(IPC::Message* m, |
| + const HandleWriter& handle_writer) const { |
|
dmichael (off chromium)
2013/06/18 16:27:02
Style nit: output params should come after input p
raymes
2013/06/18 16:40:20
Ah ok. I'll make this change in a followup CL if t
dmichael (off chromium)
2013/06/18 16:51:34
Okay, sorry I didn't catch that sooner, then.
|
| + inner_->WriteDataToMessage(m, handle_writer); |
| + } |
| bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter) { |
| return inner_->ReadFromMessage(m, iter); |
| } |
| - RawVarDataGraph* raw_var_data() const { |
| - return inner_->raw_var_data(); |
| + bool is_valid_var() const { |
| + return inner_->is_valid_var(); |
| + } |
| + |
| + // Returns the shared memory handles associated with this SerializedVar. |
| + std::vector<SerializedHandle*> GetHandles() const { |
| + return inner_->GetHandles(); |
| } |
| protected: |
| @@ -110,8 +122,13 @@ class PPAPI_PROXY_EXPORT SerializedVar { |
| serialization_rules_ = serialization_rules; |
| } |
| - RawVarDataGraph* raw_var_data() { |
| - return raw_var_data_.get(); |
| + bool is_valid_var() const { |
| + return is_valid_var_; |
| + } |
| + |
| + std::vector<SerializedHandle*> GetHandles() { |
| + return (raw_var_data_ ? raw_var_data_->GetHandles() : |
| + std::vector<SerializedHandle*>()); |
| } |
| // See outer class's declarations above. |
| @@ -124,6 +141,8 @@ class PPAPI_PROXY_EXPORT SerializedVar { |
| void ForceSetVarValueForTest(PP_Var value); |
| void WriteToMessage(IPC::Message* m) const; |
| + void WriteDataToMessage(IPC::Message* m, |
| + const HandleWriter& handle_writer) const; |
| bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter); |
| // Sets the cleanup mode. See the CleanupMode enum below. |
| @@ -162,6 +181,9 @@ class PPAPI_PROXY_EXPORT SerializedVar { |
| CleanupMode cleanup_mode_; |
| + // If the var is not properly serialized, this will be false. |
| + bool is_valid_var_; |
| + |
| #ifndef NDEBUG |
| // When being sent or received over IPC, we should only be serialized or |
| // deserialized once. These flags help us assert this is true. |
| @@ -342,6 +364,7 @@ class PPAPI_PROXY_EXPORT SerializedVarReceiveInput { |
| PP_Var Get(Dispatcher* dispatcher); |
| PP_Var GetForInstance(Dispatcher* dispatcher, PP_Instance instance); |
| + bool is_valid_var() { return serialized_.is_valid_var(); } |
| private: |
| const SerializedVar& serialized_; |