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

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: 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 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 const static size_t kMaxRenderPasses = 10000;
610
611 size_t num_render_passes;
612 if (!ReadParam(m, iter, &p->size) ||
613 !ReadParam(m, iter, &p->resource_list) ||
614 !ReadParam(m, iter, &num_render_passes) ||
615 num_render_passes > kMaxRenderPasses)
616 return false;
617 for (size_t i = 0; i < num_render_passes; ++i) {
618 scoped_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
619 if (!ReadParam(m, iter, render_pass.get()))
620 return false;
621 p->render_pass_list.append(render_pass.Pass());
622 }
623 return true;
624 }
625
626 void ParamTraits<cc::CompositorFrame>::Log(const param_type& p,
627 std::string* l) {
628 l->append("CompositorFrame(");
629 LogParam(p.size, l);
630 l->append(", ");
631 LogParam(p.resource_list, l);
632 l->append(", [");
633 for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
634 if (i)
635 l->append(", ");
636 LogParam(*p.render_pass_list[i], l);
637 }
638 l->append("])");
639 }
640
577 } // namespace IPC 641 } // 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