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 if (impl().layer_tree_host_impl->output_surface()) { |
1277 impl().layer_tree_host_impl->resource_provider()->Finish(); | 1278 ContextProvider* context_provider = |
| 1279 impl().layer_tree_host_impl->output_surface()->context_provider(); |
| 1280 if (context_provider) |
| 1281 context_provider->ContextGL()->Finish(); |
| 1282 } |
1278 completion->Signal(); | 1283 completion->Signal(); |
1279 } | 1284 } |
1280 | 1285 |
1281 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1286 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
1282 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1287 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
1283 DCHECK(IsImplThread()); | 1288 DCHECK(IsImplThread()); |
1284 DCHECK(IsMainThreadBlocked()); | 1289 DCHECK(IsMainThreadBlocked()); |
1285 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1290 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
1286 impl().layer_tree_host_impl->resource_provider()); | 1291 impl().layer_tree_host_impl->resource_provider()); |
1287 impl().current_resource_update_controller.reset(); | 1292 impl().current_resource_update_controller.reset(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 | 1451 |
1447 impl().timing_history.DidActivateSyncTree(); | 1452 impl().timing_history.DidActivateSyncTree(); |
1448 } | 1453 } |
1449 | 1454 |
1450 void ThreadProxy::DidManageTiles() { | 1455 void ThreadProxy::DidManageTiles() { |
1451 DCHECK(IsImplThread()); | 1456 DCHECK(IsImplThread()); |
1452 impl().scheduler->DidManageTiles(); | 1457 impl().scheduler->DidManageTiles(); |
1453 } | 1458 } |
1454 | 1459 |
1455 } // namespace cc | 1460 } // namespace cc |
OLD | NEW |