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

Side by Side Diff: content/common/cc_messages.cc

Issue 1142343008: cc: Rework overlays to not use the ResourceProvider and pass texture size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move overlay vars out of DrawQuad::Resources Created 5 years, 6 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
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/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/output/filter_operations.h" 8 #include "cc/output/filter_operations.h"
9 #include "cc/quads/draw_quad.h" 9 #include "cc/quads/draw_quad.h"
10 #include "cc/quads/largest_draw_quad.h" 10 #include "cc/quads/largest_draw_quad.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 847 }
848 848
849 for (size_t i = 0; i < p.count; ++i) { 849 for (size_t i = 0; i < p.count; ++i) {
850 LogParam(p.ids[i], l); 850 LogParam(p.ids[i], l);
851 if (i < (p.count - 1)) 851 if (i < (p.count - 1))
852 l->append(", "); 852 l->append(", ");
853 } 853 }
854 l->append("])"); 854 l->append("])");
855 } 855 }
856 856
857 void ParamTraits<cc::StreamVideoDrawQuad::OverlayResources>::Write(
858 Message* m,
859 const param_type& p) {
860 for (size_t i = 0; i < cc::DrawQuad::Resources::kMaxResourceIdCount; ++i) {
palmer 2015/06/08 21:50:22 I don't know cc well/at all, so this question migh
achaulk 2015/06/08 21:52:46 They're defined as static arrays with that size. I
palmer 2015/06/08 22:28:13 Either way is fine, from a security point of view.
danakj 2015/06/08 22:34:20 The renderer sends them to the browser. If there a
861 WriteParam(m, p.size_in_pixels[i]);
862 WriteParam(m, p.allow_overlay[i]);
863 }
864 }
865
866 bool ParamTraits<cc::StreamVideoDrawQuad::OverlayResources>::Read(
867 const Message* m,
868 base::PickleIterator* iter,
869 param_type* p) {
870 for (size_t i = 0; i < cc::DrawQuad::Resources::kMaxResourceIdCount; ++i) {
871 if (!ReadParam(m, iter, &p->size_in_pixels[i]))
872 return false;
873 if (!ReadParam(m, iter, &p->allow_overlay[i]))
874 return false;
875 }
876 return true;
877 }
878
879 void ParamTraits<cc::StreamVideoDrawQuad::OverlayResources>::Log(
880 const param_type& p,
881 std::string* l) {
882 l->append("StreamVideoDrawQuad::OverlayResources(");
palmer 2015/06/08 21:50:22 Nit: could combine this with the "[" on the next l
883 l->append("[");
884 for (size_t i = 0; i < cc::DrawQuad::Resources::kMaxResourceIdCount; ++i) {
885 LogParam(p.size_in_pixels[i], l);
886 l->append(", ");
887 LogParam(p.allow_overlay[i], l);
888 if (i < (cc::DrawQuad::Resources::kMaxResourceIdCount - 1))
889 l->append(", ");
890 }
891 l->append("])");
892 }
893
894 void ParamTraits<cc::TextureDrawQuad::OverlayResources>::Write(
895 Message* m,
896 const param_type& p) {
897 for (size_t i = 0; i < cc::DrawQuad::Resources::kMaxResourceIdCount; ++i) {
898 WriteParam(m, p.size_in_pixels[i]);
899 WriteParam(m, p.allow_overlay[i]);
900 }
901 }
902
903 bool ParamTraits<cc::TextureDrawQuad::OverlayResources>::Read(
904 const Message* m,
905 base::PickleIterator* iter,
906 param_type* p) {
907 for (size_t i = 0; i < cc::DrawQuad::Resources::kMaxResourceIdCount; ++i) {
908 if (!ReadParam(m, iter, &p->size_in_pixels[i]))
909 return false;
910 if (!ReadParam(m, iter, &p->allow_overlay[i]))
911 return false;
912 }
913 return true;
914 }
915
916 void ParamTraits<cc::TextureDrawQuad::OverlayResources>::Log(
917 const param_type& p,
918 std::string* l) {
919 l->append("TextureDrawQuad::OverlayResources(");
920 l->append("[");
921 for (size_t i = 0; i < cc::DrawQuad::Resources::kMaxResourceIdCount; ++i) {
922 LogParam(p.size_in_pixels[i], l);
923 l->append(", ");
924 LogParam(p.allow_overlay[i], l);
925 if (i < (cc::DrawQuad::Resources::kMaxResourceIdCount - 1))
926 l->append(", ");
927 }
928 l->append("])");
929 }
930
857 } // namespace IPC 931 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698