OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/thread_proxy.h" | 7 #include "cc/thread_proxy.h" |
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" |
11 #include "cc/delay_based_time_source.h" | 11 #include "cc/delay_based_time_source.h" |
12 #include "cc/draw_quad.h" | 12 #include "cc/draw_quad.h" |
13 #include "cc/frame_rate_controller.h" | 13 #include "cc/frame_rate_controller.h" |
14 #include "cc/graphics_context.h" | 14 #include "cc/graphics_context.h" |
15 #include "cc/input_handler.h" | 15 #include "cc/input_handler.h" |
16 #include "cc/layer_tree_host.h" | 16 #include "cc/layer_tree_host.h" |
| 17 #include "cc/rendering_stats_subscriber.h" |
17 #include "cc/scheduler.h" | 18 #include "cc/scheduler.h" |
18 #include "cc/scoped_thread_proxy.h" | 19 #include "cc/scoped_thread_proxy.h" |
19 #include <public/WebSharedGraphicsContext3D.h> | 20 #include <public/WebSharedGraphicsContext3D.h> |
20 | 21 |
21 using WebKit::WebSharedGraphicsContext3D; | 22 using WebKit::WebSharedGraphicsContext3D; |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 // Measured in seconds. | 26 // Measured in seconds. |
26 const double contextRecreationTickRate = 0.03; | 27 const double contextRecreationTickRate = 0.03; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 252 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
252 CompletionEvent completion; | 253 CompletionEvent completion; |
253 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::renderingStatsOnImplT
hread, | 254 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::renderingStatsOnImplT
hread, |
254 base::Unretained(this), &completio
n, stats)); | 255 base::Unretained(this), &completio
n, stats)); |
255 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); | 256 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); |
256 stats->totalCommitCount = m_totalCommitCount; | 257 stats->totalCommitCount = m_totalCommitCount; |
257 | 258 |
258 completion.wait(); | 259 completion.wait(); |
259 } | 260 } |
260 | 261 |
| 262 void ThreadProxy::startRecordingRenderingStats() |
| 263 { |
| 264 DCHECK(isMainThread()); |
| 265 |
| 266 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 267 CompletionEvent completion; |
| 268 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::startRecordingRenderi
ngStatsOnImplThread, |
| 269 base::Unretained(this), &completion
)); |
| 270 |
| 271 // This subscriber will collect total commit time and total commit count. |
| 272 m_renderingStatsSubscriber = RenderingStatsSubscriber::create(); |
| 273 completion.wait(); |
| 274 } |
| 275 |
| 276 void ThreadProxy::stopRecordingRenderingStats(RenderingStats* stats) |
| 277 { |
| 278 DCHECK(isMainThread()); |
| 279 |
| 280 // TODO(vollick) populate stats based on subscriber here. |
| 281 m_renderingStatsSubscriber.reset(); |
| 282 |
| 283 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 284 CompletionEvent completion; |
| 285 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::stopRecordingRenderin
gStatsOnImplThread, |
| 286 base::Unretained(this), &completion
, stats)); |
| 287 completion.wait(); |
| 288 } |
| 289 |
261 const RendererCapabilities& ThreadProxy::rendererCapabilities() const | 290 const RendererCapabilities& ThreadProxy::rendererCapabilities() const |
262 { | 291 { |
263 DCHECK(m_rendererInitialized); | 292 DCHECK(m_rendererInitialized); |
264 return m_RendererCapabilitiesMainThreadCopy; | 293 return m_RendererCapabilitiesMainThreadCopy; |
265 } | 294 } |
266 | 295 |
267 void ThreadProxy::loseContext() | 296 void ThreadProxy::loseContext() |
268 { | 297 { |
269 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::didLoseContextOnImplT
hread, base::Unretained(this))); | 298 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::didLoseContextOnImplT
hread, base::Unretained(this))); |
270 } | 299 } |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 completion->signal(); | 1003 completion->signal(); |
975 } | 1004 } |
976 | 1005 |
977 void ThreadProxy::renderingStatsOnImplThread(CompletionEvent* completion, Render
ingStats* stats) | 1006 void ThreadProxy::renderingStatsOnImplThread(CompletionEvent* completion, Render
ingStats* stats) |
978 { | 1007 { |
979 DCHECK(isImplThread()); | 1008 DCHECK(isImplThread()); |
980 m_layerTreeHostImpl->renderingStats(stats); | 1009 m_layerTreeHostImpl->renderingStats(stats); |
981 completion->signal(); | 1010 completion->signal(); |
982 } | 1011 } |
983 | 1012 |
| 1013 void ThreadProxy::startRecordingRenderingStatsOnImplThread(CompletionEvent* comp
letion) |
| 1014 { |
| 1015 DCHECK(isImplThread()); |
| 1016 m_layerTreeHostImpl->startRecordingRenderingStats(); |
| 1017 completion->signal(); |
| 1018 } |
| 1019 |
| 1020 void ThreadProxy::stopRecordingRenderingStatsOnImplThread(CompletionEvent* compl
etion, RenderingStats* stats) |
| 1021 { |
| 1022 DCHECK(isImplThread()); |
| 1023 m_layerTreeHostImpl->stopRecordingRenderingStats(stats); |
| 1024 completion->signal(); |
| 1025 } |
| 1026 |
984 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 1027 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
985 { | 1028 { |
986 } | 1029 } |
987 | 1030 |
988 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() | 1031 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() |
989 { | 1032 { |
990 } | 1033 } |
991 | 1034 |
992 } // namespace cc | 1035 } // namespace cc |
OLD | NEW |