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

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

Issue 20667002: cc: Add frame data to LTHI tracing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix names, rebase on top of HashPair patch Created 7 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
OLDNEW
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/values.h"
8 #include "cc/base/math_util.h"
9 #include "cc/debug/traced_value.h"
7 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
8 #include "cc/quads/draw_quad.h" 11 #include "cc/quads/draw_quad.h"
9 #include "cc/quads/shared_quad_state.h" 12 #include "cc/quads/shared_quad_state.h"
10 13
11 namespace cc { 14 namespace cc {
12 15
16 void* RenderPass::Id::AsTracingId() const {
17 return reinterpret_cast<void*>(base::HashPair(layer_id, index));
danakj 2013/08/06 19:30:34 can sizeof(size_t) be > sizeof(void*) ?
piman 2013/08/06 23:31:11 In theory, yes. In practice, size_t has to be the
18 }
19
13 scoped_ptr<RenderPass> RenderPass::Create() { 20 scoped_ptr<RenderPass> RenderPass::Create() {
14 return make_scoped_ptr(new RenderPass); 21 return make_scoped_ptr(new RenderPass);
15 } 22 }
16 23
17 RenderPass::RenderPass() 24 RenderPass::RenderPass()
18 : id(Id(-1, -1)), 25 : id(Id(-1, -1)),
19 has_transparent_background(true), 26 has_transparent_background(true),
20 has_occlusion_from_outside_target_surface(false) {} 27 has_occlusion_from_outside_target_surface(false) {}
21 28
22 RenderPass::~RenderPass() {} 29 RenderPass::~RenderPass() {
30 // Snapshot was created in cc.debug category, but only if cc.debug.quads is on
31 // as well.
32 bool enabled;
33 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
34 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), &enabled);
35 if (enabled) {
36 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
37 "cc::RenderPass",
38 id.AsTracingId());
39 }
40 }
23 41
24 scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const { 42 scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const {
25 scoped_ptr<RenderPass> copy_pass(Create()); 43 scoped_ptr<RenderPass> copy_pass(Create());
26 copy_pass->SetAll(new_id, 44 copy_pass->SetAll(new_id,
27 output_rect, 45 output_rect,
28 damage_rect, 46 damage_rect,
29 transform_to_root_target, 47 transform_to_root_target,
30 has_transparent_background, 48 has_transparent_background,
31 has_occlusion_from_outside_target_surface); 49 has_occlusion_from_outside_target_surface);
32 return copy_pass.Pass(); 50 return copy_pass.Pass();
(...skipping 29 matching lines...) Expand all
62 this->damage_rect = damage_rect; 80 this->damage_rect = damage_rect;
63 this->transform_to_root_target = transform_to_root_target; 81 this->transform_to_root_target = transform_to_root_target;
64 this->has_transparent_background = has_transparent_background; 82 this->has_transparent_background = has_transparent_background;
65 this->has_occlusion_from_outside_target_surface = 83 this->has_occlusion_from_outside_target_surface =
66 has_occlusion_from_outside_target_surface; 84 has_occlusion_from_outside_target_surface;
67 85
68 DCHECK(quad_list.empty()); 86 DCHECK(quad_list.empty());
69 DCHECK(shared_quad_state_list.empty()); 87 DCHECK(shared_quad_state_list.empty());
70 } 88 }
71 89
90 scoped_ptr<base::Value> RenderPass::AsValue() const {
91 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
92 value->Set("output_rect", MathUtil::AsValue(output_rect).release());
93 value->Set("damage_rect", MathUtil::AsValue(damage_rect).release());
94 value->SetBoolean("has_transparent_background", has_transparent_background);
95 value->SetBoolean("has_occlusion_from_outside_target_surface",
96 has_occlusion_from_outside_target_surface);
97 value->SetInteger("copy_requests", copy_requests.size());
98 scoped_ptr<base::ListValue> shared_states_value(new base::ListValue());
99 for (size_t i = 0; i < shared_quad_state_list.size(); ++i) {
100 shared_states_value->Append(shared_quad_state_list[i]->AsValue().release());
101 }
102 value->Set("shared_quad_state_list", shared_states_value.release());
103 scoped_ptr<base::ListValue> quad_list_value(new base::ListValue());
104 for (size_t i = 0; i < quad_list.size(); ++i) {
105 quad_list_value->Append(quad_list[i]->AsValue().release());
106 }
107 value->Set("quad_list", quad_list_value.release());
108
109 TracedValue::MakeDictIntoImplicitSnapshot(
110 value.get(), "cc::RenderPass", id.AsTracingId());
111 return value.PassAs<base::Value>();
112 }
113
72 } // namespace cc 114 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698