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

Unified Diff: cc/ipc/cc_param_traits.cc

Issue 10915298: Add CCDelegatingRenderer, and corresponding IPCs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang Created 8 years, 2 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 | « cc/ipc/cc_param_traits.h ('k') | cc/ipc/cc_render_pass_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ipc/cc_param_traits.cc
diff --git a/cc/ipc/cc_param_traits.cc b/cc/ipc/cc_param_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9575c01b50e9c93817ced918a02d1f226b968883
--- /dev/null
+++ b/cc/ipc/cc_param_traits.cc
@@ -0,0 +1,82 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/ipc/cc_param_traits.h"
+
+#include "base/stringprintf.h"
+#include "cc/ipc/cc_render_pass_traits.h"
+#include "content/common/view_messages.h"
+
+namespace IPC {
+
+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.resources);
+ WriteParam(m, p.render_passes.size());
+ for (size_t i = 0; i < p.render_passes.size(); ++i)
+ WriteParam(m, *p.render_passes[i]);
+}
+
+bool ParamTraits<cc::CompositorFrame>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
+ size_t render_passes;
+ if (!ReadParam(m, iter, &p->size) ||
+ !ReadParam(m, iter, &p->resources) ||
+ !ReadParam(m, iter, &render_passes))
+ return false;
+ for (size_t i = 0; i < render_passes; ++i) {
+ cc::CCRenderPass* render_pass = ParamTraits<cc::CCRenderPass>::ReadRenderPass(m, iter);
+ if (!render_pass) {
+ // TODO: leak
+ return false;
+ }
+ p->render_passes.push_back(render_pass);
+ }
+ return true;
+}
+
+void ParamTraits<cc::CompositorFrame>::Log(const param_type& p,
+ std::string* l) {
+ LogParam(p.size, l);
+ LogParam(p.resources, l);
+}
+
+void ParamTraits<cc::CompositorFrameAck>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.resources);
+}
+
+bool ParamTraits<cc::CompositorFrameAck>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
+ return ReadParam(m, iter, &p->resources);
+}
+
+void ParamTraits<cc::CompositorFrameAck>::Log(const param_type& p,
+ std::string* l) {
+ LogParam(p.resources, l);
+}
+
+} // namespace IPC
« no previous file with comments | « cc/ipc/cc_param_traits.h ('k') | cc/ipc/cc_render_pass_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698