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

Side by Side Diff: services/media/framework/graph.cc

Issue 1822333002: Motown: wholesale clang-format (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: dalesat Created 4 years, 9 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 | « services/media/framework/graph.h ('k') | services/media/framework/lpcm_util.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 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 "services/media/framework/graph.h" 5 #include "services/media/framework/graph.h"
6 6
7 namespace mojo { 7 namespace mojo {
8 namespace media { 8 namespace media {
9 9
10 Graph::Graph() { 10 Graph::Graph() {
11 update_function_ = [this](Stage* stage) { 11 update_function_ = [this](Stage* stage) { engine_.RequestUpdate(stage); };
12 engine_.RequestUpdate(stage);
13 };
14 } 12 }
15 13
16 Graph::~Graph() { 14 Graph::~Graph() {
17 Reset(); 15 Reset();
18 } 16 }
19 17
20 void Graph::RemovePart(PartRef part) { 18 void Graph::RemovePart(PartRef part) {
21 DCHECK(part.valid()); 19 DCHECK(part.valid());
22 20
23 Stage* stage = part.stage_; 21 Stage* stage = part.stage_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (input.connected()) { 53 if (input.connected()) {
56 DisconnectInput(input); 54 DisconnectInput(input);
57 } 55 }
58 56
59 output.actual().Connect(input); 57 output.actual().Connect(input);
60 input.actual().Connect(output); 58 input.actual().Connect(output);
61 59
62 return input.part(); 60 return input.part();
63 } 61 }
64 62
65 PartRef Graph::ConnectParts( 63 PartRef Graph::ConnectParts(PartRef upstream_part, PartRef downstream_part) {
66 PartRef upstream_part,
67 PartRef downstream_part) {
68 DCHECK(upstream_part.valid()); 64 DCHECK(upstream_part.valid());
69 DCHECK(downstream_part.valid()); 65 DCHECK(downstream_part.valid());
70 Connect(upstream_part.output(), downstream_part.input()); 66 Connect(upstream_part.output(), downstream_part.input());
71 return downstream_part; 67 return downstream_part;
72 } 68 }
73 69
74 PartRef Graph::ConnectOutputToPart( 70 PartRef Graph::ConnectOutputToPart(const OutputRef& output,
75 const OutputRef& output, 71 PartRef downstream_part) {
76 PartRef downstream_part) {
77 DCHECK(output.valid()); 72 DCHECK(output.valid());
78 DCHECK(downstream_part.valid()); 73 DCHECK(downstream_part.valid());
79 Connect(output, downstream_part.input()); 74 Connect(output, downstream_part.input());
80 return downstream_part; 75 return downstream_part;
81 } 76 }
82 77
83 PartRef Graph::ConnectPartToInput( 78 PartRef Graph::ConnectPartToInput(PartRef upstream_part,
84 PartRef upstream_part, 79 const InputRef& input) {
85 const InputRef& input) {
86 DCHECK(upstream_part.valid()); 80 DCHECK(upstream_part.valid());
87 DCHECK(input.valid()); 81 DCHECK(input.valid());
88 Connect(upstream_part.output(), input); 82 Connect(upstream_part.output(), input);
89 return input.part(); 83 return input.part();
90 } 84 }
91 85
92 void Graph::DisconnectOutput(const OutputRef& output) { 86 void Graph::DisconnectOutput(const OutputRef& output) {
93 DCHECK(output.valid()); 87 DCHECK(output.valid());
94 88
95 if (!output.connected()) { 89 if (!output.connected()) {
(...skipping 25 matching lines...) Expand all
121 return; 115 return;
122 } 116 }
123 117
124 mate.Disconnect(); 118 mate.Disconnect();
125 input.actual().Disconnect(); 119 input.actual().Disconnect();
126 } 120 }
127 121
128 void Graph::RemovePartsConnectedToPart(PartRef part) { 122 void Graph::RemovePartsConnectedToPart(PartRef part) {
129 DCHECK(part.valid()); 123 DCHECK(part.valid());
130 124
131 std::deque<PartRef> to_remove { part }; 125 std::deque<PartRef> to_remove{part};
132 126
133 while (!to_remove.empty()) { 127 while (!to_remove.empty()) {
134 PartRef part = to_remove.front(); 128 PartRef part = to_remove.front();
135 to_remove.pop_front(); 129 to_remove.pop_front();
136 130
137 for (size_t i = 0; i < part.input_count(); ++i) { 131 for (size_t i = 0; i < part.input_count(); ++i) {
138 to_remove.push_back(part.input(i).part()); 132 to_remove.push_back(part.input(i).part());
139 } 133 }
140 134
141 for (size_t i = 0; i < part.output_count(); ++i) { 135 for (size_t i = 0; i < part.output_count(); ++i) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 sinks_.push_back(stage); 211 sinks_.push_back(stage);
218 } 212 }
219 213
220 stage->SetUpdateCallback(update_function_); 214 stage->SetUpdateCallback(update_function_);
221 215
222 return PartRef(stage); 216 return PartRef(stage);
223 } 217 }
224 218
225 } // namespace media 219 } // namespace media
226 } // namespace mojo 220 } // namespace mojo
OLDNEW
« no previous file with comments | « services/media/framework/graph.h ('k') | services/media/framework/lpcm_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698