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

Unified Diff: ppapi/proxy/serialized_var.h

Issue 16140011: Don't send PP_Vars/V8 values with cycles across PostMessage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/raw_var_data_unittest.cc ('k') | ppapi/proxy/serialized_var.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
+ 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_;
« no previous file with comments | « ppapi/proxy/raw_var_data_unittest.cc ('k') | ppapi/proxy/serialized_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698