OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/render_pass.h" | 5 #include "cc/quads/render_pass.h" |
6 | 6 |
| 7 #include "base/debug/trace_event_argument.h" |
7 #include "base/values.h" | 8 #include "base/values.h" |
8 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
9 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
10 #include "cc/output/copy_output_request.h" | 11 #include "cc/output/copy_output_request.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/draw_quad.h" | 14 #include "cc/quads/draw_quad.h" |
14 #include "cc/quads/io_surface_draw_quad.h" | 15 #include "cc/quads/io_surface_draw_quad.h" |
15 #include "cc/quads/picture_draw_quad.h" | 16 #include "cc/quads/picture_draw_quad.h" |
16 #include "cc/quads/render_pass_draw_quad.h" | 17 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 this->id = id; | 151 this->id = id; |
151 this->output_rect = output_rect; | 152 this->output_rect = output_rect; |
152 this->damage_rect = damage_rect; | 153 this->damage_rect = damage_rect; |
153 this->transform_to_root_target = transform_to_root_target; | 154 this->transform_to_root_target = transform_to_root_target; |
154 this->has_transparent_background = has_transparent_background; | 155 this->has_transparent_background = has_transparent_background; |
155 | 156 |
156 DCHECK(quad_list.empty()); | 157 DCHECK(quad_list.empty()); |
157 DCHECK(shared_quad_state_list.empty()); | 158 DCHECK(shared_quad_state_list.empty()); |
158 } | 159 } |
159 | 160 |
160 scoped_ptr<base::Value> RenderPass::AsValue() const { | 161 void RenderPass::AsValueInto(base::debug::TracedValue* value) const { |
161 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 162 value->BeginArray("output_rect"); |
162 value->Set("output_rect", MathUtil::AsValue(output_rect).release()); | 163 MathUtil::AddToTracedValue(output_rect, value); |
163 value->Set("damage_rect", MathUtil::AsValue(damage_rect).release()); | 164 value->EndArray(); |
| 165 |
| 166 value->BeginArray("damage_rect"); |
| 167 MathUtil::AddToTracedValue(damage_rect, value); |
| 168 value->EndArray(); |
| 169 |
164 value->SetBoolean("has_transparent_background", has_transparent_background); | 170 value->SetBoolean("has_transparent_background", has_transparent_background); |
165 value->SetInteger("copy_requests", copy_requests.size()); | 171 value->SetInteger("copy_requests", copy_requests.size()); |
166 scoped_ptr<base::ListValue> shared_states_value(new base::ListValue()); | 172 |
| 173 value->BeginArray("shared_quad_state_list"); |
167 for (size_t i = 0; i < shared_quad_state_list.size(); ++i) { | 174 for (size_t i = 0; i < shared_quad_state_list.size(); ++i) { |
168 shared_states_value->Append(shared_quad_state_list[i]->AsValue().release()); | 175 value->BeginDictionary(); |
| 176 shared_quad_state_list[i]->AsValueInto(value); |
| 177 value->EndDictionary(); |
169 } | 178 } |
170 value->Set("shared_quad_state_list", shared_states_value.release()); | 179 value->EndArray(); |
171 scoped_ptr<base::ListValue> quad_list_value(new base::ListValue()); | 180 |
| 181 value->BeginArray("quad_list"); |
172 for (size_t i = 0; i < quad_list.size(); ++i) { | 182 for (size_t i = 0; i < quad_list.size(); ++i) { |
173 quad_list_value->Append(quad_list[i]->AsValue().release()); | 183 value->BeginDictionary(); |
| 184 quad_list[i]->AsValueInto(value); |
| 185 value->EndDictionary(); |
174 } | 186 } |
175 value->Set("quad_list", quad_list_value.release()); | 187 value->EndArray(); |
176 | 188 |
177 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 189 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
178 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 190 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
179 value.get(), "cc::RenderPass", id.AsTracingId()); | 191 value, |
180 return value.PassAs<base::Value>(); | 192 "cc::RenderPass", |
| 193 id.AsTracingId()); |
181 } | 194 } |
182 | 195 |
183 SharedQuadState* RenderPass::CreateAndAppendSharedQuadState() { | 196 SharedQuadState* RenderPass::CreateAndAppendSharedQuadState() { |
184 shared_quad_state_list.push_back(make_scoped_ptr(new SharedQuadState)); | 197 shared_quad_state_list.push_back(make_scoped_ptr(new SharedQuadState)); |
185 return shared_quad_state_list.back(); | 198 return shared_quad_state_list.back(); |
186 } | 199 } |
187 | 200 |
188 RenderPassDrawQuad* RenderPass::CopyFromAndAppendRenderPassDrawQuad( | 201 RenderPassDrawQuad* RenderPass::CopyFromAndAppendRenderPassDrawQuad( |
189 const RenderPassDrawQuad* quad, | 202 const RenderPassDrawQuad* quad, |
190 const SharedQuadState* shared_quad_state, | 203 const SharedQuadState* shared_quad_state, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 case DrawQuad::RENDER_PASS: | 247 case DrawQuad::RENDER_PASS: |
235 case DrawQuad::INVALID: | 248 case DrawQuad::INVALID: |
236 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 249 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
237 break; | 250 break; |
238 } | 251 } |
239 quad_list.back()->shared_quad_state = shared_quad_state; | 252 quad_list.back()->shared_quad_state = shared_quad_state; |
240 return quad_list.back(); | 253 return quad_list.back(); |
241 } | 254 } |
242 | 255 |
243 } // namespace cc | 256 } // namespace cc |
OLD | NEW |