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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/cc_messages.h" 5 #include "content/common/cc_messages.h"
6 6
7 #include "cc/compositor_frame.h"
7 #include "content/public/common/common_param_traits.h" 8 #include "content/public/common/common_param_traits.h"
8 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
10 #include "ui/gfx/transform.h" 11 #include "ui/gfx/transform.h"
11 12
12 namespace IPC { 13 namespace IPC {
13 14
14 void ParamTraits<WebKit::WebData>::Write(Message* m, const param_type& p) { 15 void ParamTraits<WebKit::WebData>::Write(Message* m, const param_type& p) {
15 if (p.isEmpty()) { 16 if (p.isEmpty()) {
16 m->WriteData(NULL, 0); 17 m->WriteData(NULL, 0);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 case cc::DrawQuad::YUV_VIDEO_CONTENT: 568 case cc::DrawQuad::YUV_VIDEO_CONTENT:
568 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l); 569 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l);
569 break; 570 break;
570 case cc::DrawQuad::INVALID: 571 case cc::DrawQuad::INVALID:
571 break; 572 break;
572 } 573 }
573 } 574 }
574 l->append("])"); 575 l->append("])");
575 } 576 }
576 577
578 void ParamTraits<cc::Mailbox>::Write(Message* m, const param_type& p) {
579 m->WriteBytes(p.name, sizeof(p.name));
580 }
581
582 bool ParamTraits<cc::Mailbox>::Read(const Message* m,
583 PickleIterator* iter,
584 param_type* p) {
585 const char* bytes = NULL;
586 if (!m->ReadBytes(iter, &bytes, sizeof(p->name)))
587 return false;
588 DCHECK(bytes);
589 memcpy(p->name, bytes, sizeof(p->name));
590 return true;
591 }
592
593 void ParamTraits<cc::Mailbox>::Log(const param_type& p, std::string* l) {
594 for (size_t i = 0; i < sizeof(p.name); ++i)
595 *l += base::StringPrintf("%02x", p.name[i]);
596 }
597
598 void ParamTraits<cc::CompositorFrame>::Write(Message* m, const param_type& p) {
599 WriteParam(m, p.size);
600 WriteParam(m, p.resource_list);
601 WriteParam(m, p.render_pass_list.size());
602 for (size_t i = 0; i < p.render_pass_list.size(); ++i)
603 WriteParam(m, *p.render_pass_list[i]);
604 }
605
606 bool ParamTraits<cc::CompositorFrame>::Read(const Message* m,
607 PickleIterator* iter,
608 param_type* p) {
609 size_t num_render_passes;
610 if (!ReadParam(m, iter, &p->size) ||
611 !ReadParam(m, iter, &p->resource_list) ||
612 !ReadParam(m, iter, &num_render_passes))
jschuh 2012/12/03 19:37:24 Please add a sane upper bound on num_renderer_pass
613 return false;
614 for (size_t i = 0; i < num_render_passes; ++i) {
615 scoped_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
616 if (!ReadParam(m, iter, render_pass.get()))
617 return false;
618 p->render_pass_list.append(render_pass.Pass());
619 }
620 return true;
621 }
622
623 void ParamTraits<cc::CompositorFrame>::Log(const param_type& p,
624 std::string* l) {
625 l->append("CompositorFrame(");
626 LogParam(p.size, l);
627 l->append(", ");
628 LogParam(p.resource_list, l);
629 l->append(", [");
630 for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
631 if (i)
632 l->append(", ");
633 LogParam(*p.render_pass_list[i], l);
634 }
635 l->append("])");
636 }
637
577 } // namespace IPC 638 } // namespace IPC
OLDNEW
« 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