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

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

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak found by Linux ASAN Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/quads/draw_quad.h ('k') | cc/quads/io_surface_draw_quad.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/quads/draw_quad.h" 5 #include "cc/quads/draw_quad.h"
6 6
7 #include "base/debug/trace_event_argument.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/values.h" 9 #include "base/values.h"
9 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
10 #include "cc/debug/traced_value.h" 11 #include "cc/debug/traced_value.h"
11 #include "cc/quads/checkerboard_draw_quad.h" 12 #include "cc/quads/checkerboard_draw_quad.h"
12 #include "cc/quads/debug_border_draw_quad.h" 13 #include "cc/quads/debug_border_draw_quad.h"
13 #include "cc/quads/io_surface_draw_quad.h" 14 #include "cc/quads/io_surface_draw_quad.h"
14 #include "cc/quads/picture_draw_quad.h" 15 #include "cc/quads/picture_draw_quad.h"
15 #include "cc/quads/render_pass_draw_quad.h" 16 #include "cc/quads/render_pass_draw_quad.h"
16 #include "cc/quads/solid_color_draw_quad.h" 17 #include "cc/quads/solid_color_draw_quad.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 this->needs_blending = needs_blending; 50 this->needs_blending = needs_blending;
50 this->shared_quad_state = shared_quad_state; 51 this->shared_quad_state = shared_quad_state;
51 52
52 DCHECK(shared_quad_state); 53 DCHECK(shared_quad_state);
53 DCHECK(material != INVALID); 54 DCHECK(material != INVALID);
54 } 55 }
55 56
56 DrawQuad::~DrawQuad() { 57 DrawQuad::~DrawQuad() {
57 } 58 }
58 59
59 scoped_ptr<base::Value> DrawQuad::AsValue() const { 60 void DrawQuad::AsValueInto(base::debug::TracedValue* value) const {
60 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
61 value->SetInteger("material", material); 61 value->SetInteger("material", material);
62 value->Set("shared_state", 62 TracedValue::SetIDRef(shared_quad_state, value, "shared_state");
63 TracedValue::CreateIDRef(shared_quad_state).release());
64 63
65 value->Set("content_space_rect", MathUtil::AsValue(rect).release()); 64 value->BeginArray("content_space_rect");
65 MathUtil::AddToTracedValue(rect, value);
66 value->EndArray();
67
66 bool rect_is_clipped; 68 bool rect_is_clipped;
67 gfx::QuadF rect_as_target_space_quad = MathUtil::MapQuad( 69 gfx::QuadF rect_as_target_space_quad = MathUtil::MapQuad(
68 shared_quad_state->content_to_target_transform, 70 shared_quad_state->content_to_target_transform,
69 gfx::QuadF(rect), 71 gfx::QuadF(rect),
70 &rect_is_clipped); 72 &rect_is_clipped);
71 value->Set("rect_as_target_space_quad", 73 value->BeginArray("rect_as_target_space_quad");
72 MathUtil::AsValue(rect_as_target_space_quad).release()); 74 MathUtil::AddToTracedValue(rect_as_target_space_quad, value);
75 value->EndArray();
76
73 value->SetBoolean("rect_is_clipped", rect_is_clipped); 77 value->SetBoolean("rect_is_clipped", rect_is_clipped);
74 78
75 value->Set("content_space_opaque_rect", 79 value->BeginArray("content_space_opaque_rect");
76 MathUtil::AsValue(opaque_rect).release()); 80 MathUtil::AddToTracedValue(opaque_rect, value);
81 value->EndArray();
82
77 bool opaque_rect_is_clipped; 83 bool opaque_rect_is_clipped;
78 gfx::QuadF opaque_rect_as_target_space_quad = MathUtil::MapQuad( 84 gfx::QuadF opaque_rect_as_target_space_quad = MathUtil::MapQuad(
79 shared_quad_state->content_to_target_transform, 85 shared_quad_state->content_to_target_transform,
80 gfx::QuadF(opaque_rect), 86 gfx::QuadF(opaque_rect),
81 &opaque_rect_is_clipped); 87 &opaque_rect_is_clipped);
82 value->Set("opaque_rect_as_target_space_quad", 88 value->BeginArray("opaque_rect_as_target_space_quad");
83 MathUtil::AsValue(opaque_rect_as_target_space_quad).release()); 89 MathUtil::AddToTracedValue(opaque_rect_as_target_space_quad, value);
90 value->EndArray();
91
84 value->SetBoolean("opaque_rect_is_clipped", opaque_rect_is_clipped); 92 value->SetBoolean("opaque_rect_is_clipped", opaque_rect_is_clipped);
85 93
86 value->Set("content_space_visible_rect", 94 value->BeginArray("content_space_visible_rect");
87 MathUtil::AsValue(visible_rect).release()); 95 MathUtil::AddToTracedValue(visible_rect, value);
96 value->EndArray();
97
88 bool visible_rect_is_clipped; 98 bool visible_rect_is_clipped;
89 gfx::QuadF visible_rect_as_target_space_quad = MathUtil::MapQuad( 99 gfx::QuadF visible_rect_as_target_space_quad = MathUtil::MapQuad(
90 shared_quad_state->content_to_target_transform, 100 shared_quad_state->content_to_target_transform,
91 gfx::QuadF(visible_rect), 101 gfx::QuadF(visible_rect),
92 &visible_rect_is_clipped); 102 &visible_rect_is_clipped);
93 value->Set("visible_rect_as_target_space_quad", 103
94 MathUtil::AsValue(visible_rect_as_target_space_quad).release()); 104 value->BeginArray("visible_rect_as_target_space_quad");
105 MathUtil::AddToTracedValue(visible_rect_as_target_space_quad, value);
106 value->EndArray();
107
95 value->SetBoolean("visible_rect_is_clipped", visible_rect_is_clipped); 108 value->SetBoolean("visible_rect_is_clipped", visible_rect_is_clipped);
96 109
97 value->SetBoolean("needs_blending", needs_blending); 110 value->SetBoolean("needs_blending", needs_blending);
98 value->SetBoolean("should_draw_with_blending", ShouldDrawWithBlending()); 111 value->SetBoolean("should_draw_with_blending", ShouldDrawWithBlending());
99 ExtendValue(value.get()); 112 ExtendValue(value);
100 return value.PassAs<base::Value>();
101 } 113 }
102 114
103 } // namespace cc 115 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/draw_quad.h ('k') | cc/quads/io_surface_draw_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698