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/layer_tree_impl.h" |
10 #include "cc/output_surface.h" | 11 #include "cc/output_surface.h" |
11 #include "cc/prioritized_resource_manager.h" | 12 #include "cc/prioritized_resource_manager.h" |
12 #include "cc/resource_update_controller.h" | 13 #include "cc/resource_update_controller.h" |
13 #include "cc/thread.h" | 14 #include "cc/thread.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) | 18 scoped_ptr<Proxy> SingleThreadProxy::create(LayerTreeHost* layerTreeHost) |
18 { | 19 { |
19 return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>()
; | 20 return make_scoped_ptr(new SingleThreadProxy(layerTreeHost)).PassAs<Proxy>()
; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 251 } |
251 | 252 |
252 void SingleThreadProxy::stop() | 253 void SingleThreadProxy::stop() |
253 { | 254 { |
254 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); | 255 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); |
255 DCHECK(Proxy::isMainThread()); | 256 DCHECK(Proxy::isMainThread()); |
256 { | 257 { |
257 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 258 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
258 DebugScopedSetImplThread impl(this); | 259 DebugScopedSetImplThread impl(this); |
259 | 260 |
260 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 261 if (!m_layerTreeHostImpl->activeTree()->ContentsTexturesPurged()) |
261 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); | 262 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); |
262 m_layerTreeHostImpl.reset(); | 263 m_layerTreeHostImpl.reset(); |
263 } | 264 } |
264 m_layerTreeHost = 0; | 265 m_layerTreeHost = 0; |
265 } | 266 } |
266 | 267 |
267 void SingleThreadProxy::setNeedsRedrawOnImplThread() | 268 void SingleThreadProxy::setNeedsRedrawOnImplThread() |
268 { | 269 { |
269 m_layerTreeHost->scheduleComposite(); | 270 m_layerTreeHost->scheduleComposite(); |
270 } | 271 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 DCHECK(Proxy::isMainThread()); | 338 DCHECK(Proxy::isMainThread()); |
338 | 339 |
339 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 340 if (!m_layerTreeHost->initializeRendererIfNeeded()) |
340 return false; | 341 return false; |
341 | 342 |
342 m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings(); | 343 m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings(); |
343 | 344 |
344 scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQu
eue); | 345 scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQu
eue); |
345 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); | 346 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); |
346 | 347 |
347 if (m_layerTreeHostImpl->contentsTexturesPurged()) | |
348 m_layerTreeHostImpl->resetContentsTexturesPurged(); | |
349 | |
350 m_layerTreeHost->willCommit(); | 348 m_layerTreeHost->willCommit(); |
351 doCommit(queue.Pass()); | 349 doCommit(queue.Pass()); |
352 bool result = doComposite(); | 350 bool result = doComposite(); |
353 m_layerTreeHost->didBeginFrame(); | 351 m_layerTreeHost->didBeginFrame(); |
354 return result; | 352 return result; |
355 } | 353 } |
356 | 354 |
357 bool SingleThreadProxy::doComposite() | 355 bool SingleThreadProxy::doComposite() |
358 { | 356 { |
359 DCHECK(!m_outputSurfaceLost); | 357 DCHECK(!m_outputSurfaceLost); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 398 } |
401 | 399 |
402 skia::RefPtr<SkPicture> SingleThreadProxy::capturePicture() | 400 skia::RefPtr<SkPicture> SingleThreadProxy::capturePicture() |
403 { | 401 { |
404 // Requires impl-side painting, which is only supported in threaded composit
ing. | 402 // Requires impl-side painting, which is only supported in threaded composit
ing. |
405 NOTREACHED(); | 403 NOTREACHED(); |
406 return skia::RefPtr<SkPicture>(); | 404 return skia::RefPtr<SkPicture>(); |
407 } | 405 } |
408 | 406 |
409 } // namespace cc | 407 } // namespace cc |
OLD | NEW |