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

Side by Side Diff: cc/ipc/cc_param_traits.cc

Issue 1996783002: Make cc::SurfaceId unguessable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Ben's comment Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « cc/ipc/cc_param_traits.h ('k') | cc/ipc/cc_param_traits_macros.h » ('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 "cc/ipc/cc_param_traits.h" 5 #include "cc/ipc/cc_param_traits.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "cc/output/compositor_frame.h" 12 #include "cc/output/compositor_frame.h"
13 #include "cc/output/filter_operations.h" 13 #include "cc/output/filter_operations.h"
14 #include "cc/quads/debug_border_draw_quad.h" 14 #include "cc/quads/debug_border_draw_quad.h"
15 #include "cc/quads/draw_quad.h" 15 #include "cc/quads/draw_quad.h"
16 #include "cc/quads/largest_draw_quad.h" 16 #include "cc/quads/largest_draw_quad.h"
17 #include "cc/quads/render_pass_draw_quad.h" 17 #include "cc/quads/render_pass_draw_quad.h"
18 #include "cc/quads/solid_color_draw_quad.h" 18 #include "cc/quads/solid_color_draw_quad.h"
19 #include "cc/quads/surface_draw_quad.h" 19 #include "cc/quads/surface_draw_quad.h"
20 #include "cc/quads/tile_draw_quad.h" 20 #include "cc/quads/tile_draw_quad.h"
21 #include "cc/quads/yuv_video_draw_quad.h" 21 #include "cc/quads/yuv_video_draw_quad.h"
22 #include "cc/surfaces/surface_id.h"
22 #include "third_party/skia/include/core/SkData.h" 23 #include "third_party/skia/include/core/SkData.h"
23 #include "third_party/skia/include/core/SkFlattenableSerialization.h" 24 #include "third_party/skia/include/core/SkFlattenableSerialization.h"
24 #include "third_party/skia/include/core/SkImageFilter.h" 25 #include "third_party/skia/include/core/SkImageFilter.h"
25 #include "third_party/skia/include/core/SkRefCnt.h" 26 #include "third_party/skia/include/core/SkRefCnt.h"
26 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" 27 #include "ui/gfx/ipc/geometry/gfx_param_traits.h"
27 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" 28 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
28 29
29 namespace IPC { 30 namespace IPC {
30 31
31 void ParamTraits<cc::FilterOperation>::GetSize(base::PickleSizer* s, 32 void ParamTraits<cc::FilterOperation>::GetSize(base::PickleSizer* s,
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 case cc::DrawQuad::YUV_VIDEO_CONTENT: 561 case cc::DrawQuad::YUV_VIDEO_CONTENT:
561 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l); 562 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l);
562 break; 563 break;
563 case cc::DrawQuad::INVALID: 564 case cc::DrawQuad::INVALID:
564 break; 565 break;
565 } 566 }
566 } 567 }
567 l->append("])"); 568 l->append("])");
568 } 569 }
569 570
571 void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s,
572 const param_type& p) {
573 GetParamSize(s, p.id_namespace());
574 GetParamSize(s, p.local_id());
575 GetParamSize(s, p.nonce());
576 }
577
578 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) {
579 WriteParam(m, p.id_namespace());
580 WriteParam(m, p.local_id());
581 WriteParam(m, p.nonce());
582 }
583
584 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m,
585 base::PickleIterator* iter,
586 param_type* p) {
587 uint32_t id_namespace;
588 if (!ReadParam(m, iter, &id_namespace))
589 return false;
590
591 uint32_t local_id;
592 if (!ReadParam(m, iter, &local_id))
593 return false;
594
595 uint64_t nonce;
596 if (!ReadParam(m, iter, &nonce))
597 return false;
598
599 *p = cc::SurfaceId(id_namespace, local_id, nonce);
600 return true;
601 }
602
603 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) {
604 l->append("SurfaceId(");
605 LogParam(p.id_namespace(), l);
606 l->append(", ");
607 LogParam(p.local_id(), l);
608 l->append(", ");
609 LogParam(p.nonce(), l);
610 l->append(")");
611 }
612
570 namespace { 613 namespace {
571 enum CompositorFrameType { 614 enum CompositorFrameType {
572 NO_FRAME, 615 NO_FRAME,
573 DELEGATED_FRAME, 616 DELEGATED_FRAME,
574 GL_FRAME, 617 GL_FRAME,
575 }; 618 };
576 } 619 }
577 620
578 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m, 621 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m,
579 const param_type& p) { 622 const param_type& p) {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 949 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
907 #include "cc/ipc/cc_param_traits_macros.h" 950 #include "cc/ipc/cc_param_traits_macros.h"
908 } // namespace IPC 951 } // namespace IPC
909 952
910 // Generate param traits log methods. 953 // Generate param traits log methods.
911 #include "ipc/param_traits_log_macros.h" 954 #include "ipc/param_traits_log_macros.h"
912 namespace IPC { 955 namespace IPC {
913 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 956 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
914 #include "cc/ipc/cc_param_traits_macros.h" 957 #include "cc/ipc/cc_param_traits_macros.h"
915 } // namespace IPC 958 } // namespace IPC
OLDNEW
« no previous file with comments | « cc/ipc/cc_param_traits.h ('k') | cc/ipc/cc_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698