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

Side by Side Diff: cc/ipc/render_pass_struct_traits.cc

Issue 2136313002: Fix --use-mus-in-renderer for mus+ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ipc/render_pass_struct_traits.h" 5 #include "cc/ipc/render_pass_struct_traits.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 #include "cc/ipc/shared_quad_state_struct_traits.h" 8 #include "cc/ipc/shared_quad_state_struct_traits.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 11
12 // static 12 // static
13 void* StructTraits<cc::mojom::RenderPass, std::unique_ptr<cc::RenderPass>>:: 13 void* StructTraits<cc::mojom::RenderPass, std::unique_ptr<cc::RenderPass>>::
14 SetUpContext(const std::unique_ptr<cc::RenderPass>& input) { 14 SetUpContext(const std::unique_ptr<cc::RenderPass>& input) {
15 DCHECK_GT(input->quad_list.size(), 0u);
Fady Samuel 2016/07/13 14:48:47 A question for piman@: Are empty quad lists consid
Peng 2016/07/13 15:01:13 Sure. I will ask piman@ review this CL too.
16 std::unique_ptr<mojo::Array<uint32_t>> sqs_references( 15 std::unique_ptr<mojo::Array<uint32_t>> sqs_references(
17 new mojo::Array<uint32_t>(input->quad_list.size())); 16 new mojo::Array<uint32_t>(input->quad_list.size()));
18 cc::SharedQuadStateList::ConstIterator sqs_iter = 17 cc::SharedQuadStateList::ConstIterator sqs_iter =
19 input->shared_quad_state_list.begin(); 18 input->shared_quad_state_list.begin();
20 for (auto it = input->quad_list.begin(); it != input->quad_list.end(); ++it) { 19 for (auto it = input->quad_list.begin(); it != input->quad_list.end(); ++it) {
21 if ((*it)->shared_quad_state != *sqs_iter) 20 if ((*it)->shared_quad_state != *sqs_iter)
22 ++sqs_iter; 21 ++sqs_iter;
23 (*sqs_references)[it.index()] = 22 (*sqs_references)[it.index()] =
24 base::checked_cast<uint32_t>(sqs_iter.index()); 23 base::checked_cast<uint32_t>(sqs_iter.index());
25 DCHECK_NE(nullptr, (*it)->shared_quad_state); 24 DCHECK_NE(nullptr, (*it)->shared_quad_state);
26 DCHECK_EQ(*sqs_iter, (*it)->shared_quad_state); 25 DCHECK_EQ(*sqs_iter, (*it)->shared_quad_state);
27 } 26 }
28 DCHECK_EQ(input->shared_quad_state_list.size() - 1, sqs_iter.index());
Fady Samuel 2016/07/13 14:48:47 I'd like to preserve this DCHECK if shared_quad_st
Peng 2016/07/13 15:01:13 Done.
29 return sqs_references.release(); 27 return sqs_references.release();
30 } 28 }
31 29
32 // static 30 // static
33 void StructTraits<cc::mojom::RenderPass, std::unique_ptr<cc::RenderPass>>:: 31 void StructTraits<cc::mojom::RenderPass, std::unique_ptr<cc::RenderPass>>::
34 TearDownContext(const std::unique_ptr<cc::RenderPass>& input, 32 TearDownContext(const std::unique_ptr<cc::RenderPass>& input,
35 void* context) { 33 void* context) {
36 // static_cast to ensure the destructor is called. 34 // static_cast to ensure the destructor is called.
37 delete static_cast<mojo::Array<uint32_t>*>(context); 35 delete static_cast<mojo::Array<uint32_t>*>(context);
38 } 36 }
(...skipping 29 matching lines...) Expand all
68 if (shared_quad_state_references[it.index()] != sqs_iter.index()) 66 if (shared_quad_state_references[it.index()] != sqs_iter.index())
69 return false; 67 return false;
70 (*it)->shared_quad_state = *sqs_iter; 68 (*it)->shared_quad_state = *sqs_iter;
71 if (!(*it)->shared_quad_state) 69 if (!(*it)->shared_quad_state)
72 return false; 70 return false;
73 } 71 }
74 return sqs_iter.index() == (*out)->shared_quad_state_list.size() - 1; 72 return sqs_iter.index() == (*out)->shared_quad_state_list.size() - 1;
75 } 73 }
76 74
77 } // namespace mojo 75 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698