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 "cc/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/debug/trace_event_synthetic_delay.h" | 13 #include "base/debug/trace_event_synthetic_delay.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "cc/base/swap_promise.h" | 15 #include "cc/base/swap_promise.h" |
| 16 #include "cc/debug/benchmark_instrumentation.h" | 16 #include "cc/debug/benchmark_instrumentation.h" |
| 17 #include "cc/debug/devtools_instrumentation.h" | 17 #include "cc/debug/devtools_instrumentation.h" |
| 18 #include "cc/input/input_handler.h" | 18 #include "cc/input/input_handler.h" |
| 19 #include "cc/output/context_provider.h" | 19 #include "cc/output/context_provider.h" |
| 20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
| 21 #include "cc/quads/draw_quad.h" | 21 #include "cc/quads/draw_quad.h" |
| 22 #include "cc/resources/prioritized_resource_manager.h" | 22 #include "cc/resources/prioritized_resource_manager.h" |
| 23 #include "cc/scheduler/delay_based_time_source.h" | 23 #include "cc/scheduler/delay_based_time_source.h" |
| 24 #include "cc/scheduler/scheduler.h" | 24 #include "cc/scheduler/scheduler.h" |
| 25 #include "cc/trees/blocking_task_runner.h" | 25 #include "cc/trees/blocking_task_runner.h" |
| 26 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
| 27 #include "cc/trees/layer_tree_impl.h" | 27 #include "cc/trees/layer_tree_impl.h" |
| 28 #include "gpu/command_buffer/client/gles2_interface.h" | |
| 28 #include "ui/gfx/frame_time.h" | 29 #include "ui/gfx/frame_time.h" |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 // Measured in seconds. | 33 // Measured in seconds. |
| 33 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 34 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
| 34 | 35 |
| 35 unsigned int nextBeginFrameId = 0; | 36 unsigned int nextBeginFrameId = 0; |
| 36 | 37 |
| 37 class SwapPromiseChecker { | 38 class SwapPromiseChecker { |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 success, | 1267 success, |
| 1267 capabilities)); | 1268 capabilities)); |
| 1268 | 1269 |
| 1269 if (success) | 1270 if (success) |
| 1270 impl().scheduler->DidCreateAndInitializeOutputSurface(); | 1271 impl().scheduler->DidCreateAndInitializeOutputSurface(); |
| 1271 } | 1272 } |
| 1272 | 1273 |
| 1273 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1274 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
| 1274 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1275 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
| 1275 DCHECK(IsImplThread()); | 1276 DCHECK(IsImplThread()); |
| 1276 if (impl().layer_tree_host_impl->resource_provider()) | 1277 ContextProvider* context_provider = |
| 1277 impl().layer_tree_host_impl->resource_provider()->Finish(); | 1278 impl().layer_tree_host_impl->output_surface()->context_provider(); |
|
danakj
2014/07/14 16:29:19
Oh, I think you need to null-check the OutputSurfa
sohanjg
2014/07/14 16:44:47
Done.
No problem :)
| |
| 1279 if (context_provider) | |
| 1280 context_provider->ContextGL()->Finish(); | |
| 1278 completion->Signal(); | 1281 completion->Signal(); |
| 1279 } | 1282 } |
| 1280 | 1283 |
| 1281 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1284 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
| 1282 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1285 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
| 1283 DCHECK(IsImplThread()); | 1286 DCHECK(IsImplThread()); |
| 1284 DCHECK(IsMainThreadBlocked()); | 1287 DCHECK(IsMainThreadBlocked()); |
| 1285 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1288 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
| 1286 impl().layer_tree_host_impl->resource_provider()); | 1289 impl().layer_tree_host_impl->resource_provider()); |
| 1287 impl().current_resource_update_controller.reset(); | 1290 impl().current_resource_update_controller.reset(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1446 | 1449 |
| 1447 impl().timing_history.DidActivateSyncTree(); | 1450 impl().timing_history.DidActivateSyncTree(); |
| 1448 } | 1451 } |
| 1449 | 1452 |
| 1450 void ThreadProxy::DidManageTiles() { | 1453 void ThreadProxy::DidManageTiles() { |
| 1451 DCHECK(IsImplThread()); | 1454 DCHECK(IsImplThread()); |
| 1452 impl().scheduler->DidManageTiles(); | 1455 impl().scheduler->DidManageTiles(); |
| 1453 } | 1456 } |
| 1454 | 1457 |
| 1455 } // namespace cc | 1458 } // namespace cc |
| OLD | NEW |