OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "gpu/command_buffer/service/gpu_tracer.h" | 5 #include "gpu/command_buffer/service/gpu_tracer.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 bool GPUTracer::EndDecoding() { | 191 bool GPUTracer::EndDecoding() { |
192 if (!gpu_executing_) | 192 if (!gpu_executing_) |
193 return false; | 193 return false; |
194 | 194 |
195 // End Trace for all active markers | 195 // End Trace for all active markers |
196 if (IsTracing()) { | 196 if (IsTracing()) { |
197 for (int n = 0; n < NUM_TRACER_SOURCES; n++) { | 197 for (int n = 0; n < NUM_TRACER_SOURCES; n++) { |
198 for (size_t i = 0; i < markers_[n].size(); i++) { | 198 for (size_t i = 0; i < markers_[n].size(); i++) { |
199 if (markers_[n][i].trace_) { | 199 if (markers_[n][i].trace_.get()) { |
200 markers_[n][i].trace_->End(); | 200 markers_[n][i].trace_->End(); |
201 if (markers_[n][i].trace_->IsEnabled()) | 201 if (markers_[n][i].trace_->IsEnabled()) |
202 traces_.push_back(markers_[n][i].trace_); | 202 traces_.push_back(markers_[n][i].trace_); |
203 markers_[n][i].trace_ = 0; | 203 markers_[n][i].trace_ = 0; |
204 } | 204 } |
205 } | 205 } |
206 } | 206 } |
207 IssueProcessTask(); | 207 IssueProcessTask(); |
208 } | 208 } |
209 | 209 |
(...skipping 27 matching lines...) Expand all Loading... |
237 bool GPUTracer::End(GpuTracerSource source) { | 237 bool GPUTracer::End(GpuTracerSource source) { |
238 if (!gpu_executing_) | 238 if (!gpu_executing_) |
239 return false; | 239 return false; |
240 | 240 |
241 DCHECK(source >= 0 && source < NUM_TRACER_SOURCES); | 241 DCHECK(source >= 0 && source < NUM_TRACER_SOURCES); |
242 | 242 |
243 // Pop last marker with matching 'source' | 243 // Pop last marker with matching 'source' |
244 if (!markers_[source].empty()) { | 244 if (!markers_[source].empty()) { |
245 if (IsTracing()) { | 245 if (IsTracing()) { |
246 scoped_refptr<GPUTrace> trace = markers_[source].back().trace_; | 246 scoped_refptr<GPUTrace> trace = markers_[source].back().trace_; |
247 if (trace) { | 247 if (trace.get()) { |
248 trace->End(); | 248 trace->End(); |
249 if (trace->IsEnabled()) | 249 if (trace->IsEnabled()) |
250 traces_.push_back(trace); | 250 traces_.push_back(trace); |
251 IssueProcessTask(); | 251 IssueProcessTask(); |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 markers_[source].pop_back(); | 255 markers_[source].pop_back(); |
256 return true; | 256 return true; |
257 } | 257 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 process_posted_ = true; | 341 process_posted_ = true; |
342 base::MessageLoop::current()->PostDelayedTask( | 342 base::MessageLoop::current()->PostDelayedTask( |
343 FROM_HERE, | 343 FROM_HERE, |
344 base::Bind(&GPUTracer::Process, base::AsWeakPtr(this)), | 344 base::Bind(&GPUTracer::Process, base::AsWeakPtr(this)), |
345 base::TimeDelta::FromMilliseconds(kProcessInterval)); | 345 base::TimeDelta::FromMilliseconds(kProcessInterval)); |
346 } | 346 } |
347 | 347 |
348 } // namespace gles2 | 348 } // namespace gles2 |
349 } // namespace gpu | 349 } // namespace gpu |
OLD | NEW |