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 "content/renderer/media/render_media_log.h" | 5 #include "content/renderer/media/render_media_log.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 void RenderMediaLog::RecordRapporWithSecurityOrigin(const std::string& metric) { | 136 void RenderMediaLog::RecordRapporWithSecurityOrigin(const std::string& metric) { |
137 if (!task_runner_->BelongsToCurrentThread()) { | 137 if (!task_runner_->BelongsToCurrentThread()) { |
138 task_runner_->PostTask( | 138 task_runner_->PostTask( |
139 FROM_HERE, base::Bind(&RenderMediaLog::RecordRapporWithSecurityOrigin, | 139 FROM_HERE, base::Bind(&RenderMediaLog::RecordRapporWithSecurityOrigin, |
140 this, metric)); | 140 this, metric)); |
141 return; | 141 return; |
142 } | 142 } |
143 | 143 |
144 GetContentClient()->renderer()->RecordRapporURL(metric, security_origin_); | 144 RecordRapporWithURL(metric, security_origin_); |
| 145 } |
| 146 |
| 147 void RenderMediaLog::RecordRapporWithURL(const std::string& metric, |
| 148 const GURL& url) { |
| 149 if (!task_runner_->BelongsToCurrentThread()) { |
| 150 task_runner_->PostTask( |
| 151 FROM_HERE, |
| 152 base::Bind(&RenderMediaLog::RecordRapporWithURL, this, metric, url)); |
| 153 return; |
| 154 } |
| 155 |
| 156 GetContentClient()->renderer()->RecordRapporURL(metric, url); |
145 } | 157 } |
146 | 158 |
147 void RenderMediaLog::SendQueuedMediaEvents() { | 159 void RenderMediaLog::SendQueuedMediaEvents() { |
148 DCHECK(task_runner_->BelongsToCurrentThread()); | 160 DCHECK(task_runner_->BelongsToCurrentThread()); |
149 | 161 |
150 std::vector<media::MediaLogEvent> events_to_send; | 162 std::vector<media::MediaLogEvent> events_to_send; |
151 { | 163 { |
152 base::AutoLock auto_lock(lock_); | 164 base::AutoLock auto_lock(lock_); |
153 | 165 |
154 DCHECK(ipc_send_pending_); | 166 DCHECK(ipc_send_pending_); |
(...skipping 25 matching lines...) Expand all Loading... |
180 tick_clock_.swap(tick_clock); | 192 tick_clock_.swap(tick_clock); |
181 last_ipc_send_time_ = tick_clock_->NowTicks(); | 193 last_ipc_send_time_ = tick_clock_->NowTicks(); |
182 } | 194 } |
183 | 195 |
184 void RenderMediaLog::SetTaskRunnerForTesting( | 196 void RenderMediaLog::SetTaskRunnerForTesting( |
185 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 197 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
186 task_runner_ = task_runner; | 198 task_runner_ = task_runner; |
187 } | 199 } |
188 | 200 |
189 } // namespace content | 201 } // namespace content |
OLD | NEW |