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 |
31 using gpu::gles2::GLES2Interface; | |
32 | |
30 namespace { | 33 namespace { |
31 | 34 |
32 // Measured in seconds. | 35 // Measured in seconds. |
33 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 36 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
34 | 37 |
35 class SwapPromiseChecker { | 38 class SwapPromiseChecker { |
36 public: | 39 public: |
37 explicit SwapPromiseChecker(cc::LayerTreeHost* layer_tree_host) | 40 explicit SwapPromiseChecker(cc::LayerTreeHost* layer_tree_host) |
38 : layer_tree_host_(layer_tree_host) {} | 41 : layer_tree_host_(layer_tree_host) {} |
39 | 42 |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 success, | 1262 success, |
1260 capabilities)); | 1263 capabilities)); |
1261 | 1264 |
1262 if (success) | 1265 if (success) |
1263 impl().scheduler->DidCreateAndInitializeOutputSurface(); | 1266 impl().scheduler->DidCreateAndInitializeOutputSurface(); |
1264 } | 1267 } |
1265 | 1268 |
1266 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1269 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
1267 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1270 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
1268 DCHECK(IsImplThread()); | 1271 DCHECK(IsImplThread()); |
1269 if (impl().layer_tree_host_impl->resource_provider()) | 1272 ResourceProvider* resource_provider = |
1270 impl().layer_tree_host_impl->resource_provider()->Finish(); | 1273 impl().layer_tree_host_impl->resource_provider(); |
danakj
2014/07/10 17:01:44
use the lthi->output_surface() instead, and null c
sohanjg
2014/07/11 16:43:33
Done.
| |
1274 if (resource_provider) { | |
1275 GLES2Interface* gl = resource_provider->ContextGL(); | |
1276 if (gl) | |
1277 gl->Finish(); | |
1278 } | |
1271 completion->Signal(); | 1279 completion->Signal(); |
1272 } | 1280 } |
1273 | 1281 |
1274 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1282 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
1275 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1283 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
1276 DCHECK(IsImplThread()); | 1284 DCHECK(IsImplThread()); |
1277 DCHECK(IsMainThreadBlocked()); | 1285 DCHECK(IsMainThreadBlocked()); |
1278 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1286 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
1279 impl().layer_tree_host_impl->resource_provider()); | 1287 impl().layer_tree_host_impl->resource_provider()); |
1280 impl().current_resource_update_controller.reset(); | 1288 impl().current_resource_update_controller.reset(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1439 | 1447 |
1440 impl().timing_history.DidActivatePendingTree(); | 1448 impl().timing_history.DidActivatePendingTree(); |
1441 } | 1449 } |
1442 | 1450 |
1443 void ThreadProxy::DidManageTiles() { | 1451 void ThreadProxy::DidManageTiles() { |
1444 DCHECK(IsImplThread()); | 1452 DCHECK(IsImplThread()); |
1445 impl().scheduler->DidManageTiles(); | 1453 impl().scheduler->DidManageTiles(); |
1446 } | 1454 } |
1447 | 1455 |
1448 } // namespace cc | 1456 } // namespace cc |
OLD | NEW |