how about
```
// TODO(jondong): For now we only support StringValue to transfer using
// shared memory when its size exceeds threshold, we will add support
// for other type of Value later.
if (msg->GetType() != base::Value::TYPE_STRING ||
    static_cast<base::StringValue*>(msg.get())->GetString()->length() < kLargeThresholdBytes) {
  base::ListValue wrapped_msg;
  wrapped_msg.Append(msg.release());
  Send(new XWalkExtensionClientMsg_PostMessageToJS(instance_id, wrapped_msg));
  return;
}

<your_shared_memory_code>
```