Chromium Code Reviews| 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 "CCDrawQuad.h" | 9 #include "CCDrawQuad.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "cc/layer_tree_host.h" | 12 #include "cc/layer_tree_host.h" |
| 13 #include "cc/texture_update_controller.h" | 13 #include "cc/texture_update_controller.h" |
| 14 #include "cc/timer.h" | 14 #include "cc/timer.h" |
| 15 #include <wtf/CurrentTime.h> | 15 #include <wtf/CurrentTime.h> |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) | 19 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) |
| 20 { | 20 { |
| 21 return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>() ; | 21 return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>() ; |
| 22 } | 22 } |
| 23 | 23 |
| 24 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost) | 24 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost) |
| 25 : m_layerTreeHost(layerTreeHost) | 25 : m_layerTreeHost(layerTreeHost) |
| 26 , m_contextLost(false) | 26 , m_contextLost(false) |
| 27 , m_rendererInitialized(false) | 27 , m_rendererInitialized(false) |
| 28 , m_nextFrameIsNewlyCommittedFrame(false) | 28 , m_nextFrameIsNewlyCommittedFrame(false) |
| 29 , m_totalCommitCount(0) | 29 , m_totalCommitCount(0) |
| 30 , m_deferCommits(false) | |
| 30 { | 31 { |
| 31 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 32 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
| 32 DCHECK(Proxy::isMainThread()); | 33 DCHECK(Proxy::isMainThread()); |
| 33 } | 34 } |
| 34 | 35 |
| 35 void SingleThreadProxy::start() | 36 void SingleThreadProxy::start() |
| 36 { | 37 { |
| 37 DebugScopedSetImplThread impl; | 38 DebugScopedSetImplThread impl; |
| 38 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 39 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
| 39 } | 40 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 } | 225 } |
| 225 | 226 |
| 226 void SingleThreadProxy::setNeedsRedraw() | 227 void SingleThreadProxy::setNeedsRedraw() |
| 227 { | 228 { |
| 228 // FIXME: Once we move render_widget scheduling into this class, we can | 229 // FIXME: Once we move render_widget scheduling into this class, we can |
| 229 // treat redraw requests more efficiently than commitAndRedraw requests. | 230 // treat redraw requests more efficiently than commitAndRedraw requests. |
| 230 m_layerTreeHostImpl->setFullRootLayerDamage(); | 231 m_layerTreeHostImpl->setFullRootLayerDamage(); |
| 231 setNeedsCommit(); | 232 setNeedsCommit(); |
| 232 } | 233 } |
| 233 | 234 |
| 235 void SingleThreadProxy::setDeferCommits(bool deferCommits) | |
|
jamesr
2012/10/23 21:24:34
I would say don't implement this at all - it doesn
jonathan.backer
2012/10/24 16:42:14
Done. NOTREACHED.
| |
| 236 { | |
| 237 if (m_deferCommits == deferCommits) | |
| 238 return; | |
| 239 m_deferCommits = deferCommits; | |
| 240 | |
| 241 if (m_deferCommits) | |
| 242 TRACE_EVENT_ASYNC_BEGIN0("cc", "SingleThreadProxy::setDeferCommits", thi s); | |
| 243 else | |
| 244 TRACE_EVENT_ASYNC_END0("cc", "SingleThreadProxy::setDeferCommits", this) ; | |
| 245 } | |
| 246 | |
| 247 bool SingleThreadProxy::deferCommits() const | |
| 248 { | |
| 249 return m_deferCommits; | |
| 250 } | |
| 251 | |
| 234 bool SingleThreadProxy::commitRequested() const | 252 bool SingleThreadProxy::commitRequested() const |
| 235 { | 253 { |
| 236 return false; | 254 return false; |
| 237 } | 255 } |
| 238 | 256 |
| 239 void SingleThreadProxy::didAddAnimation() | 257 void SingleThreadProxy::didAddAnimation() |
| 240 { | 258 { |
| 241 } | 259 } |
| 242 | 260 |
| 243 size_t SingleThreadProxy::maxPartialTextureUpdates() const | 261 size_t SingleThreadProxy::maxPartialTextureUpdates() const |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 | 391 |
| 374 void SingleThreadProxy::didSwapFrame() | 392 void SingleThreadProxy::didSwapFrame() |
| 375 { | 393 { |
| 376 if (m_nextFrameIsNewlyCommittedFrame) { | 394 if (m_nextFrameIsNewlyCommittedFrame) { |
| 377 m_nextFrameIsNewlyCommittedFrame = false; | 395 m_nextFrameIsNewlyCommittedFrame = false; |
| 378 m_layerTreeHost->didCommitAndDrawFrame(); | 396 m_layerTreeHost->didCommitAndDrawFrame(); |
| 379 } | 397 } |
| 380 } | 398 } |
| 381 | 399 |
| 382 } | 400 } |
| OLD | NEW |