OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "base/trace_event/trace_event_impl.h" | 9 #include "base/trace_event/trace_event_impl.h" |
10 #include "content/browser/tracing/power_tracing_agent.h" | 10 #include "content/browser/tracing/power_tracing_agent.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 base::Bind(&PowerTracingAgent::StartAgentTracingOnIOThread, | 62 base::Bind(&PowerTracingAgent::StartAgentTracingOnIOThread, |
63 base::Unretained(this), path, callback)); | 63 base::Unretained(this), path, callback)); |
64 } | 64 } |
65 | 65 |
66 void PowerTracingAgent::StartAgentTracingOnIOThread( | 66 void PowerTracingAgent::StartAgentTracingOnIOThread( |
67 const std::string& path, | 67 const std::string& path, |
68 const StartAgentTracingCallback& callback) { | 68 const StartAgentTracingCallback& callback) { |
69 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 69 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
70 | 70 |
71 battor_agent_.reset(new battor::BattOrAgent( | 71 battor_agent_.reset(new battor::BattOrAgent( |
72 path, this, | 72 path, this, BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
73 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 73 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); |
74 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); | |
75 | 74 |
76 start_tracing_callback_ = callback; | 75 start_tracing_callback_ = callback; |
77 battor_agent_->StartTracing(); | 76 battor_agent_->StartTracing(); |
78 } | 77 } |
79 | 78 |
80 void PowerTracingAgent::OnStartTracingComplete(battor::BattOrError error) { | 79 void PowerTracingAgent::OnStartTracingComplete(battor::BattOrError error) { |
81 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 80 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
82 | 81 |
83 bool success = (error == battor::BATTOR_ERROR_NONE); | 82 bool success = (error == battor::BATTOR_ERROR_NONE); |
84 if (!success) | 83 if (!success) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 record_clock_sync_marker_callback_.Reset(); | 175 record_clock_sync_marker_callback_.Reset(); |
177 record_clock_sync_marker_sync_id_ = std::string(); | 176 record_clock_sync_marker_sync_id_ = std::string(); |
178 record_clock_sync_marker_start_time_ = base::TimeTicks(); | 177 record_clock_sync_marker_start_time_ = base::TimeTicks(); |
179 } | 178 } |
180 | 179 |
181 bool PowerTracingAgent::SupportsExplicitClockSync() { | 180 bool PowerTracingAgent::SupportsExplicitClockSync() { |
182 return battor_agent_->SupportsExplicitClockSync(); | 181 return battor_agent_->SupportsExplicitClockSync(); |
183 } | 182 } |
184 | 183 |
185 } // namespace content | 184 } // namespace content |
OLD | NEW |