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 "cc/single_thread_proxy.h" | 5 #include "cc/single_thread_proxy.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/draw_quad.h" | 8 #include "cc/draw_quad.h" |
9 #include "cc/layer_tree_host.h" | 9 #include "cc/layer_tree_host.h" |
10 #include "cc/output_surface.h" | 10 #include "cc/output_surface.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost) | 22 SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layerTreeHost) |
23 : Proxy(scoped_ptr<Thread>(NULL)) | 23 : Proxy(scoped_ptr<Thread>(NULL)) |
24 , m_layerTreeHost(layerTreeHost) | 24 , m_layerTreeHost(layerTreeHost) |
25 , m_outputSurfaceLost(false) | 25 , m_outputSurfaceLost(false) |
26 , m_rendererInitialized(false) | 26 , m_rendererInitialized(false) |
27 , m_nextFrameIsNewlyCommittedFrame(false) | 27 , m_nextFrameIsNewlyCommittedFrame(false) |
28 , m_totalCommitCount(0) | 28 , m_totalCommitCount(0) |
29 { | 29 { |
30 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 30 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
31 DCHECK(Proxy::isMainThread()); | 31 DCHECK(Proxy::isMainThread()); |
| 32 DCHECK(layerTreeHost); |
| 33 |
| 34 // Impl-side painting not supported without threaded compositing |
| 35 DCHECK(!layerTreeHost->settings().implSidePainting); |
32 } | 36 } |
33 | 37 |
34 void SingleThreadProxy::start() | 38 void SingleThreadProxy::start() |
35 { | 39 { |
36 DebugScopedSetImplThread impl(this); | 40 DebugScopedSetImplThread impl(this); |
37 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 41 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
38 } | 42 } |
39 | 43 |
40 SingleThreadProxy::~SingleThreadProxy() | 44 SingleThreadProxy::~SingleThreadProxy() |
41 { | 45 { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 { | 358 { |
355 DCHECK(!m_outputSurfaceLost); | 359 DCHECK(!m_outputSurfaceLost); |
356 { | 360 { |
357 DebugScopedSetImplThread impl(this); | 361 DebugScopedSetImplThread impl(this); |
358 | 362 |
359 if (!m_layerTreeHostImpl->visible()) | 363 if (!m_layerTreeHostImpl->visible()) |
360 return false; | 364 return false; |
361 | 365 |
362 m_layerTreeHostImpl->animate(base::TimeTicks::Now(), base::Time::Now()); | 366 m_layerTreeHostImpl->animate(base::TimeTicks::Now(), base::Time::Now()); |
363 | 367 |
364 if (m_layerTreeHostImpl->settings().implSidePainting) | |
365 m_layerTreeHostImpl->manageTiles(); | |
366 | |
367 // We guard prepareToDraw() with canDraw() because it always returns a v
alid frame, so can only | 368 // We guard prepareToDraw() with canDraw() because it always returns a v
alid frame, so can only |
368 // be used when such a frame is possible. Since drawLayers() depends on
the result of | 369 // be used when such a frame is possible. Since drawLayers() depends on
the result of |
369 // prepareToDraw(), it is guarded on canDraw() as well. | 370 // prepareToDraw(), it is guarded on canDraw() as well. |
370 if (!m_layerTreeHostImpl->canDraw()) | 371 if (!m_layerTreeHostImpl->canDraw()) |
371 return false; | 372 return false; |
372 | 373 |
373 LayerTreeHostImpl::FrameData frame; | 374 LayerTreeHostImpl::FrameData frame; |
374 m_layerTreeHostImpl->prepareToDraw(frame); | 375 m_layerTreeHostImpl->prepareToDraw(frame); |
375 m_layerTreeHostImpl->drawLayers(frame); | 376 m_layerTreeHostImpl->drawLayers(frame); |
376 m_layerTreeHostImpl->didDrawAllLayers(frame); | 377 m_layerTreeHostImpl->didDrawAllLayers(frame); |
(...skipping 22 matching lines...) Expand all Loading... |
399 } | 400 } |
400 | 401 |
401 skia::RefPtr<SkPicture> SingleThreadProxy::capturePicture() | 402 skia::RefPtr<SkPicture> SingleThreadProxy::capturePicture() |
402 { | 403 { |
403 // Requires impl-side painting, which is only supported in threaded composit
ing. | 404 // Requires impl-side painting, which is only supported in threaded composit
ing. |
404 NOTREACHED(); | 405 NOTREACHED(); |
405 return skia::RefPtr<SkPicture>(); | 406 return skia::RefPtr<SkPicture>(); |
406 } | 407 } |
407 | 408 |
408 } // namespace cc | 409 } // namespace cc |
OLD | NEW |