| 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/location.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/thread_task_runner_handle.h" |
| 11 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 12 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 14 #include "gpu/command_buffer/service/context_group.h" | 17 #include "gpu/command_buffer/service/context_group.h" |
| 15 #include "ui/gl/gl_bindings.h" | 18 #include "ui/gl/gl_bindings.h" |
| 16 #include "ui/gl/gl_version_info.h" | 19 #include "ui/gl/gl_version_info.h" |
| 17 #include "ui/gl/gpu_timing.h" | 20 #include "ui/gl/gpu_timing.h" |
| 18 | 21 |
| 19 namespace gpu { | 22 namespace gpu { |
| 20 namespace gles2 { | 23 namespace gles2 { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 return markers_[source].back().name_; | 304 return markers_[source].back().name_; |
| 302 } | 305 } |
| 303 return base::EmptyString(); | 306 return base::EmptyString(); |
| 304 } | 307 } |
| 305 | 308 |
| 306 scoped_refptr<Outputter> GPUTracer::CreateOutputter(const std::string& name) { | 309 scoped_refptr<Outputter> GPUTracer::CreateOutputter(const std::string& name) { |
| 307 return TraceOutputter::Create(name); | 310 return TraceOutputter::Create(name); |
| 308 } | 311 } |
| 309 | 312 |
| 310 void GPUTracer::PostTask() { | 313 void GPUTracer::PostTask() { |
| 311 base::MessageLoop::current()->PostDelayedTask( | 314 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 312 FROM_HERE, | 315 FROM_HERE, base::Bind(&GPUTracer::Process, base::AsWeakPtr(this)), |
| 313 base::Bind(&GPUTracer::Process, base::AsWeakPtr(this)), | |
| 314 base::TimeDelta::FromMilliseconds(kProcessInterval)); | 316 base::TimeDelta::FromMilliseconds(kProcessInterval)); |
| 315 } | 317 } |
| 316 | 318 |
| 317 void GPUTracer::Process() { | 319 void GPUTracer::Process() { |
| 318 process_posted_ = false; | 320 process_posted_ = false; |
| 319 ProcessTraces(); | 321 ProcessTraces(); |
| 320 IssueProcessTask(); | 322 IssueProcessTask(); |
| 321 } | 323 } |
| 322 | 324 |
| 323 void GPUTracer::ProcessTraces() { | 325 void GPUTracer::ProcessTraces() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 void GPUTracer::IssueProcessTask() { | 370 void GPUTracer::IssueProcessTask() { |
| 369 if (finished_traces_.empty() || process_posted_) | 371 if (finished_traces_.empty() || process_posted_) |
| 370 return; | 372 return; |
| 371 | 373 |
| 372 process_posted_ = true; | 374 process_posted_ = true; |
| 373 PostTask(); | 375 PostTask(); |
| 374 } | 376 } |
| 375 | 377 |
| 376 } // namespace gles2 | 378 } // namespace gles2 |
| 377 } // namespace gpu | 379 } // namespace gpu |
| OLD | NEW |