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

Unified Diff: content/common/cc_messages.cc

Issue 11308306: cc: Add CompositorFrame class with IPC param traits for it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forlanding Created 8 years 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/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/cc_messages.cc
diff --git a/content/common/cc_messages.cc b/content/common/cc_messages.cc
index 166e77a168a2f257ee7b8549de34a7290212ea5f..bcdf0f0f2252c1a4f93e2ce347cbba3645980435 100644
--- a/content/common/cc_messages.cc
+++ b/content/common/cc_messages.cc
@@ -4,6 +4,7 @@
#include "content/common/cc_messages.h"
+#include "cc/compositor_frame.h"
#include "content/public/common/common_param_traits.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebData.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations.h"
@@ -574,4 +575,67 @@ void ParamTraits<cc::RenderPass>::Log(
l->append("])");
}
+void ParamTraits<cc::Mailbox>::Write(Message* m, const param_type& p) {
+ m->WriteBytes(p.name, sizeof(p.name));
+}
+
+bool ParamTraits<cc::Mailbox>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
+ const char* bytes = NULL;
+ if (!m->ReadBytes(iter, &bytes, sizeof(p->name)))
+ return false;
+ DCHECK(bytes);
+ memcpy(p->name, bytes, sizeof(p->name));
+ return true;
+}
+
+void ParamTraits<cc::Mailbox>::Log(const param_type& p, std::string* l) {
+ for (size_t i = 0; i < sizeof(p.name); ++i)
+ *l += base::StringPrintf("%02x", p.name[i]);
+}
+
+void ParamTraits<cc::CompositorFrame>::Write(Message* m, const param_type& p) {
+ WriteParam(m, p.size);
+ WriteParam(m, p.resource_list);
+ WriteParam(m, p.render_pass_list.size());
+ for (size_t i = 0; i < p.render_pass_list.size(); ++i)
+ WriteParam(m, *p.render_pass_list[i]);
+}
+
+bool ParamTraits<cc::CompositorFrame>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
+ const static size_t kMaxRenderPasses = 10000;
+
+ size_t num_render_passes;
+ if (!ReadParam(m, iter, &p->size) ||
+ !ReadParam(m, iter, &p->resource_list) ||
+ !ReadParam(m, iter, &num_render_passes) ||
+ num_render_passes > kMaxRenderPasses)
+ return false;
+ for (size_t i = 0; i < num_render_passes; ++i) {
+ scoped_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
+ if (!ReadParam(m, iter, render_pass.get()))
+ return false;
+ p->render_pass_list.append(render_pass.Pass());
+ }
+ return true;
+}
+
+void ParamTraits<cc::CompositorFrame>::Log(const param_type& p,
+ std::string* l) {
+ l->append("CompositorFrame(");
+ LogParam(p.size, l);
+ l->append(", ");
+ LogParam(p.resource_list, l);
+ l->append(", [");
+ for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
+ if (i)
+ l->append(", ");
+ LogParam(*p.render_pass_list[i], l);
+ }
+ l->append("])");
+}
+
} // namespace IPC
« no previous file with comments | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698