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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 GPUTrace::GPUTrace(scoped_refptr<Outputter> outputter, | 84 GPUTrace::GPUTrace(scoped_refptr<Outputter> outputter, |
85 gfx::GPUTimingClient* gpu_timing_client, | 85 gfx::GPUTimingClient* gpu_timing_client, |
86 const std::string& category, | 86 const std::string& category, |
87 const std::string& name, | 87 const std::string& name, |
88 const bool enabled) | 88 const bool enabled) |
89 : category_(category), | 89 : category_(category), |
90 name_(name), | 90 name_(name), |
91 outputter_(outputter), | 91 outputter_(outputter), |
92 enabled_(enabled) { | 92 enabled_(enabled) { |
93 if (gpu_timing_client->IsAvailable()) { | 93 if (gpu_timing_client->IsAvailable() && |
| 94 gpu_timing_client->IsTimerOffsetAvailable()) { |
94 gpu_timer_ = gpu_timing_client->CreateGPUTimer(); | 95 gpu_timer_ = gpu_timing_client->CreateGPUTimer(); |
95 } | 96 } |
96 } | 97 } |
97 | 98 |
98 GPUTrace::~GPUTrace() { | 99 GPUTrace::~GPUTrace() { |
99 } | 100 } |
100 | 101 |
101 void GPUTrace::Start(bool trace_service) { | 102 void GPUTrace::Start(bool trace_service) { |
102 if (trace_service) { | 103 if (trace_service) { |
103 outputter_->TraceServiceBegin(category_, name_); | 104 outputter_->TraceServiceBegin(category_, name_); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 void GPUTracer::IssueProcessTask() { | 330 void GPUTracer::IssueProcessTask() { |
330 if (traces_.empty() || process_posted_) | 331 if (traces_.empty() || process_posted_) |
331 return; | 332 return; |
332 | 333 |
333 process_posted_ = true; | 334 process_posted_ = true; |
334 PostTask(); | 335 PostTask(); |
335 } | 336 } |
336 | 337 |
337 } // namespace gles2 | 338 } // namespace gles2 |
338 } // namespace gpu | 339 } // namespace gpu |
OLD | NEW |