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/single_thread_proxy.h" | 7 #include "cc/single_thread_proxy.h" |
8 | 8 |
| 9 #include "cc/rendering_stats_subscriber.h" |
| 10 #include <wtf/CurrentTime.h> |
| 11 |
| 12 using namespace WTF; |
9 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
10 #include "cc/draw_quad.h" | 14 #include "cc/draw_quad.h" |
11 #include "cc/graphics_context.h" | 15 #include "cc/graphics_context.h" |
12 #include "cc/layer_tree_host.h" | 16 #include "cc/layer_tree_host.h" |
13 #include "cc/resource_update_controller.h" | 17 #include "cc/resource_update_controller.h" |
14 | 18 |
15 namespace cc { | 19 namespace cc { |
16 | 20 |
17 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) | 21 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) |
18 { | 22 { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return initialized; | 151 return initialized; |
148 } | 152 } |
149 | 153 |
150 void SingleThreadProxy::renderingStats(RenderingStats* stats) | 154 void SingleThreadProxy::renderingStats(RenderingStats* stats) |
151 { | 155 { |
152 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); | 156 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); |
153 stats->totalCommitCount = m_totalCommitCount; | 157 stats->totalCommitCount = m_totalCommitCount; |
154 m_layerTreeHostImpl->renderingStats(stats); | 158 m_layerTreeHostImpl->renderingStats(stats); |
155 } | 159 } |
156 | 160 |
| 161 void SingleThreadProxy::startRecordingRenderingStats() |
| 162 { |
| 163 // This subscriber will collect total commit time and total commit count. |
| 164 m_renderingStatsSubscriber = RenderingStatsSubscriber::create(); |
| 165 m_layerTreeHostImpl->startRecordingRenderingStats(); |
| 166 } |
| 167 |
| 168 void SingleThreadProxy::stopRecordingRenderingStats(RenderingStats* stats) |
| 169 { |
| 170 // TODO(vollick): populate stats based on the subscriber here. |
| 171 m_renderingStatsSubscriber.reset(); |
| 172 m_layerTreeHostImpl->stopRecordingRenderingStats(stats); |
| 173 } |
| 174 |
157 const RendererCapabilities& SingleThreadProxy::rendererCapabilities() const | 175 const RendererCapabilities& SingleThreadProxy::rendererCapabilities() const |
158 { | 176 { |
159 DCHECK(m_rendererInitialized); | 177 DCHECK(m_rendererInitialized); |
160 // Note: this gets called during the commit by the "impl" thread | 178 // Note: this gets called during the commit by the "impl" thread |
161 return m_RendererCapabilitiesForMainThread; | 179 return m_RendererCapabilitiesForMainThread; |
162 } | 180 } |
163 | 181 |
164 void SingleThreadProxy::loseContext() | 182 void SingleThreadProxy::loseContext() |
165 { | 183 { |
166 DCHECK(Proxy::isMainThread()); | 184 DCHECK(Proxy::isMainThread()); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 409 |
392 void SingleThreadProxy::didSwapFrame() | 410 void SingleThreadProxy::didSwapFrame() |
393 { | 411 { |
394 if (m_nextFrameIsNewlyCommittedFrame) { | 412 if (m_nextFrameIsNewlyCommittedFrame) { |
395 m_nextFrameIsNewlyCommittedFrame = false; | 413 m_nextFrameIsNewlyCommittedFrame = false; |
396 m_layerTreeHost->didCommitAndDrawFrame(); | 414 m_layerTreeHost->didCommitAndDrawFrame(); |
397 } | 415 } |
398 } | 416 } |
399 | 417 |
400 } | 418 } |
OLD | NEW |