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

Unified Diff: ipc/ipc_message_utils.h

Issue 281723010: Bundle DidOverscrollParams with the InputEventAck (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 7 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 | « content/renderer/render_widget_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_utils.h
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 102992d45ec6e003bf1a516bdc9b39e002b494f8..6bfd103c6d88423cc3855eefd821c0a07416d4e1 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -14,6 +14,7 @@
#include "base/containers/small_map.h"
#include "base/files/file.h"
#include "base/format_macros.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
@@ -706,6 +707,40 @@ struct ParamTraits<base::SmallMap<NormalMap, kArraySize, EqualKey, MapInit> > {
}
};
+template <class P>
+struct ParamTraits<scoped_ptr<P> > {
+ typedef scoped_ptr<P> param_type;
+ static void Write(Message* m, const param_type& p) {
+ bool valid = !!p;
+ WriteParam(m, valid);
+ if (valid)
+ WriteParam(m, *p);
+ }
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
+ bool valid = false;
+ if (!ReadParam(m, iter, &valid))
+ return false;
+
+ if (!valid) {
+ r->reset();
+ return true;
+ }
+
+ param_type temp(new P());
+ if (!ReadParam(m, iter, temp.get()))
+ return false;
+
+ r->swap(temp);
+ return true;
+ }
+ static void Log(const param_type& p, std::string* l) {
+ if (p)
+ LogParam(*p, l);
+ else
+ l->append("NULL");
+ }
+};
+
// IPC types ParamTraits -------------------------------------------------------
// A ChannelHandle is basically a platform-inspecific wrapper around the
« no previous file with comments | « content/renderer/render_widget_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698