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

Side by Side Diff: cc/quads/largest_draw_quad.cc

Issue 2324723002: Speed up quad deserialization. (Closed)
Patch Set: comment added Created 4 years, 3 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/quads/largest_draw_quad.h ('k') | cc/quads/render_pass.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quads/largest_draw_quad.h" 5 #include "cc/quads/largest_draw_quad.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "cc/quads/debug_border_draw_quad.h" 11 #include "cc/quads/debug_border_draw_quad.h"
12 #include "cc/quads/picture_draw_quad.h" 12 #include "cc/quads/picture_draw_quad.h"
13 #include "cc/quads/render_pass_draw_quad.h" 13 #include "cc/quads/render_pass_draw_quad.h"
14 #include "cc/quads/solid_color_draw_quad.h" 14 #include "cc/quads/solid_color_draw_quad.h"
15 #include "cc/quads/stream_video_draw_quad.h" 15 #include "cc/quads/stream_video_draw_quad.h"
16 #include "cc/quads/surface_draw_quad.h" 16 #include "cc/quads/surface_draw_quad.h"
17 #include "cc/quads/texture_draw_quad.h" 17 #include "cc/quads/texture_draw_quad.h"
18 #include "cc/quads/tile_draw_quad.h" 18 #include "cc/quads/tile_draw_quad.h"
19 #include "cc/quads/yuv_video_draw_quad.h" 19 #include "cc/quads/yuv_video_draw_quad.h"
20 20
21 namespace { 21 namespace {
22 const size_t kLargestDrawQuadSize = 22 const size_t kLargestDrawQuadSize = sizeof(cc::YUVVideoDrawQuad);
23 sizeof(cc::YUVVideoDrawQuad) + sizeof(gfx::ColorSpace);
24 } // namespace 23 } // namespace
25 24
26 namespace cc { 25 namespace cc {
27 26
28 size_t LargestDrawQuadSize() { 27 size_t LargestDrawQuadSubclassSize() {
29 // Currently the largest quad is either a RenderPassDrawQuad or a 28 // Currently the largest quad is either a RenderPassDrawQuad or a
30 // StreamVideoDrawQuad depends on hardware structure. 29 // StreamVideoDrawQuad depends on hardware structure.
31 30
32 // Use compile assert to make sure largest is actually larger than all other 31 // Use compile assert to make sure largest is actually larger than all other
33 // type of draw quads. 32 // type of draw quads.
34 static_assert(sizeof(DebugBorderDrawQuad) <= kLargestDrawQuadSize, 33 static_assert(sizeof(DebugBorderDrawQuad) <= kLargestDrawQuadSize,
35 "Largest Draw Quad size needs update. DebugBorderDrawQuad is " 34 "Largest Draw Quad size needs update. DebugBorderDrawQuad is "
36 "currently largest."); 35 "currently largest.");
37 static_assert(sizeof(PictureDrawQuad) <= kLargestDrawQuadSize, 36 static_assert(sizeof(PictureDrawQuad) <= kLargestDrawQuadSize,
38 "Largest Draw Quad size needs update. PictureDrawQuad is " 37 "Largest Draw Quad size needs update. PictureDrawQuad is "
(...skipping 10 matching lines...) Expand all
49 static_assert(sizeof(TileDrawQuad) <= kLargestDrawQuadSize, 48 static_assert(sizeof(TileDrawQuad) <= kLargestDrawQuadSize,
50 "Largest Draw Quad size needs update. TileDrawQuad is " 49 "Largest Draw Quad size needs update. TileDrawQuad is "
51 "currently largest."); 50 "currently largest.");
52 static_assert(sizeof(YUVVideoDrawQuad) <= kLargestDrawQuadSize, 51 static_assert(sizeof(YUVVideoDrawQuad) <= kLargestDrawQuadSize,
53 "Largest Draw Quad size needs update. YUVVideoDrawQuad is " 52 "Largest Draw Quad size needs update. YUVVideoDrawQuad is "
54 "currently largest."); 53 "currently largest.");
55 54
56 return kLargestDrawQuadSize; 55 return kLargestDrawQuadSize;
57 } 56 }
58 57
58 size_t LargestDrawQuadSerializedSize() {
59 return std::max<size_t>(kLargestDrawQuadSize,
60 sizeof(YUVVideoDrawQuad) + sizeof(gfx::ColorSpace));
61 }
62
59 } // namespace cc 63 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/largest_draw_quad.h ('k') | cc/quads/render_pass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698