Index: ppapi/proxy/serialized_var.cc |
diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc |
index 1217a83ba5cf6b645257a02e11f29fa0c7d74e3a..2642ecf4c171356af1f783ad31c28622a905edcb 100644 |
--- a/ppapi/proxy/serialized_var.cc |
+++ b/ppapi/proxy/serialized_var.cc |
@@ -15,6 +15,11 @@ |
#include "ppapi/shared_impl/var.h" |
#include "ppapi/thunk/enter.h" |
+namespace { |
+const char kSerializationError[] = "Failed to serialize a PP_Var. It may have " |
+ "cycles or be of an unsupported type: "; |
+} // namespace |
+ |
namespace ppapi { |
namespace proxy { |
@@ -107,7 +112,21 @@ void SerializedVar::Inner::WriteToMessage(IPC::Message* m) const { |
DCHECK(!has_been_serialized_); |
has_been_serialized_ = true; |
#endif |
- RawVarDataGraph::Create(var_, instance_)->Write(m); |
+ scoped_ptr<RawVarDataGraph> data = |
+ RawVarDataGraph::Create(var_, instance_, false); |
+ if (data) { |
+ data->Write(m); |
+ } else { |
+ // TODO(raymes): It's not ideal to log here. We should probably propagate |
+ // the error all the way through to the location at which the var is used. |
+ // However, SerializedVar isn't set up to propagate errors well. This case |
+ // should only occur if the the PP_Var passed in is somehow corrupt or a var |
+ // with reference cycles is passed in. |
+ PpapiGlobals::Get()->LogWithSource( |
+ instance_, PP_LOGLEVEL_ERROR, std::string(), |
+ kSerializationError + ppapi::Var::PPVarToLogString(var_)); |
dmichael (off chromium)
2013/06/04 16:59:10
Yeah... this is going to result in sending a mess
raymes
2013/06/04 19:36:06
I actually went down this road first and then back
|
+ RawVarDataGraph::Create(PP_MakeUndefined(), instance_, false)->Write(m); |
+ } |
} |
bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m, |