summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_message_utils.h
diff options
context:
space:
mode:
authorjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 02:34:56 +0000
committerjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 02:34:56 +0000
commit8e431f2036e4b9bdf4313caf008d6f151a0e0806 (patch)
tree4d8831edd0c9781895ad7b9e29d5f8b87db25dd9 /ipc/ipc_message_utils.h
parent3843c097d729bc7c7f5140908ef570ee61f535db (diff)
downloadchromium_src-8e431f2036e4b9bdf4313caf008d6f151a0e0806.zip
chromium_src-8e431f2036e4b9bdf4313caf008d6f151a0e0806.tar.gz
chromium_src-8e431f2036e4b9bdf4313caf008d6f151a0e0806.tar.bz2
Bundle DidOverscrollParams with the input event ack
Currently, overscroll notifications are always sent as a separate IPC message, regardless of the causal event. Instead, bundle the overscroll metadata with the event ack if the event caused the overscroll, saving an IPC message in the most common overscroll case. BUG=328503 Review URL: https://codereview.chromium.org/281723010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271541 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_message_utils.h')
-rw-r--r--ipc/ipc_message_utils.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 102992d..6bfd103 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