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" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 threaded_channel_ = threaded_channel.Pass(); | 131 threaded_channel_ = threaded_channel.Pass(); |
132 main().channel_main = threaded_channel_.get(); | 132 main().channel_main = threaded_channel_.get(); |
133 } | 133 } |
134 | 134 |
135 void ThreadProxy::FinishAllRendering() { | 135 void ThreadProxy::FinishAllRendering() { |
136 DCHECK(Proxy::IsMainThread()); | 136 DCHECK(Proxy::IsMainThread()); |
137 DCHECK(!main().defer_commits); | 137 DCHECK(!main().defer_commits); |
138 | 138 |
139 // Make sure all GL drawing is finished on the impl thread. | 139 // Make sure all GL drawing is finished on the impl thread. |
140 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 140 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
141 CompletionEvent completion; | 141 main().channel_main->FinishAllRenderingOnImpl(); |
142 Proxy::ImplThreadTaskRunner()->PostTask( | |
143 FROM_HERE, | |
144 base::Bind(&ThreadProxy::FinishAllRenderingOnImplThread, | |
145 impl_thread_weak_ptr_, | |
146 &completion)); | |
147 completion.Wait(); | |
148 } | 142 } |
149 | 143 |
150 bool ThreadProxy::IsStarted() const { | 144 bool ThreadProxy::IsStarted() const { |
151 DCHECK(Proxy::IsMainThread()); | 145 DCHECK(Proxy::IsMainThread()); |
152 return main().started; | 146 return main().started; |
153 } | 147 } |
154 | 148 |
155 bool ThreadProxy::CommitToActiveTree() const { | 149 bool ThreadProxy::CommitToActiveTree() const { |
156 // With ThreadProxy, we use a pending tree and activate it once it's ready to | 150 // With ThreadProxy, we use a pending tree and activate it once it's ready to |
157 // draw to allow input to modify the active tree and draw during raster. | 151 // draw to allow input to modify the active tree and draw during raster. |
158 return false; | 152 return false; |
159 } | 153 } |
160 | 154 |
161 void ThreadProxy::SetVisible(bool visible) { | 155 void ThreadProxy::SetVisible(bool visible) { |
162 TRACE_EVENT1("cc", "ThreadProxy::SetVisible", "visible", visible); | 156 TRACE_EVENT1("cc", "ThreadProxy::SetVisible", "visible", visible); |
163 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 157 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
164 | 158 |
165 CompletionEvent completion; | 159 main().channel_main->SetVisibleOnImpl(visible); |
danakj
2015/10/08 19:21:08
i'd like it if it was obvious which calls are goin
Khushal
2015/10/08 20:32:07
We will try to make some calls asynchronous for Bl
danakj
2015/10/09 17:54:43
I think we should mark everything as Sync that is
Khushal
2015/10/09 19:46:55
That would definitely be better. Just had one doub
| |
166 Proxy::ImplThreadTaskRunner()->PostTask( | |
167 FROM_HERE, | |
168 base::Bind(&ThreadProxy::SetVisibleOnImplThread, | |
169 impl_thread_weak_ptr_, | |
170 &completion, | |
171 visible)); | |
172 completion.Wait(); | |
173 } | 160 } |
174 | 161 |
175 void ThreadProxy::SetVisibleOnImplThread(CompletionEvent* completion, | 162 void ThreadProxy::SetVisibleOnImpl(bool visible) { |
176 bool visible) { | |
177 TRACE_EVENT1("cc", "ThreadProxy::SetVisibleOnImplThread", "visible", visible); | 163 TRACE_EVENT1("cc", "ThreadProxy::SetVisibleOnImplThread", "visible", visible); |
178 impl().layer_tree_host_impl->SetVisible(visible); | 164 impl().layer_tree_host_impl->SetVisible(visible); |
179 impl().scheduler->SetVisible(visible); | 165 impl().scheduler->SetVisible(visible); |
180 completion->Signal(); | |
181 } | 166 } |
182 | 167 |
183 void ThreadProxy::SetThrottleFrameProduction(bool throttle) { | 168 void ThreadProxy::SetThrottleFrameProduction(bool throttle) { |
184 TRACE_EVENT1("cc", "ThreadProxy::SetThrottleFrameProduction", "throttle", | 169 TRACE_EVENT1("cc", "ThreadProxy::SetThrottleFrameProduction", "throttle", |
185 throttle); | 170 throttle); |
186 main().channel_main->SetThrottleFrameProductionOnImpl(throttle); | 171 main().channel_main->SetThrottleFrameProductionOnImpl(throttle); |
187 } | 172 } |
188 | 173 |
189 void ThreadProxy::SetThrottleFrameProductionOnImpl(bool throttle) { | 174 void ThreadProxy::SetThrottleFrameProductionOnImpl(bool throttle) { |
190 TRACE_EVENT1("cc", "ThreadProxy::SetThrottleFrameProductionOnImplThread", | 175 TRACE_EVENT1("cc", "ThreadProxy::SetThrottleFrameProductionOnImplThread", |
191 "throttle", throttle); | 176 "throttle", throttle); |
192 impl().scheduler->SetThrottleFrameProduction(throttle); | 177 impl().scheduler->SetThrottleFrameProduction(throttle); |
193 } | 178 } |
194 | 179 |
195 void ThreadProxy::DidLoseOutputSurface() { | 180 void ThreadProxy::DidLoseOutputSurface() { |
196 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface"); | 181 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface"); |
197 DCHECK(IsMainThread()); | 182 DCHECK(IsMainThread()); |
198 layer_tree_host()->DidLoseOutputSurface(); | 183 layer_tree_host()->DidLoseOutputSurface(); |
199 } | 184 } |
200 | 185 |
201 void ThreadProxy::RequestNewOutputSurface() { | 186 void ThreadProxy::RequestNewOutputSurface() { |
202 DCHECK(IsMainThread()); | 187 DCHECK(IsMainThread()); |
203 layer_tree_host()->RequestNewOutputSurface(); | 188 layer_tree_host()->RequestNewOutputSurface(); |
204 } | 189 } |
205 | 190 |
206 void ThreadProxy::SetOutputSurface(OutputSurface* output_surface) { | 191 void ThreadProxy::SetOutputSurface(OutputSurface* output_surface) { |
207 Proxy::ImplThreadTaskRunner()->PostTask( | 192 main().channel_main->InitializeOutputSurfaceOnImpl(output_surface); |
208 FROM_HERE, base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, | |
209 impl_thread_weak_ptr_, output_surface)); | |
210 } | 193 } |
211 | 194 |
212 void ThreadProxy::ReleaseOutputSurface() { | 195 void ThreadProxy::ReleaseOutputSurface() { |
213 DCHECK(IsMainThread()); | 196 DCHECK(IsMainThread()); |
214 DCHECK(layer_tree_host()->output_surface_lost()); | 197 DCHECK(layer_tree_host()->output_surface_lost()); |
215 | 198 |
216 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 199 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
217 CompletionEvent completion; | 200 main().channel_main->ReleaseOutputSurfaceOnImpl(); |
218 Proxy::ImplThreadTaskRunner()->PostTask( | |
219 FROM_HERE, base::Bind(&ThreadProxy::ReleaseOutputSurfaceOnImplThread, | |
220 impl_thread_weak_ptr_, &completion)); | |
221 completion.Wait(); | |
222 } | 201 } |
223 | 202 |
224 void ThreadProxy::DidInitializeOutputSurface( | 203 void ThreadProxy::DidInitializeOutputSurface( |
225 bool success, | 204 bool success, |
226 const RendererCapabilities& capabilities) { | 205 const RendererCapabilities& capabilities) { |
227 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); | 206 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); |
228 DCHECK(IsMainThread()); | 207 DCHECK(IsMainThread()); |
229 | 208 |
230 if (!success) { | 209 if (!success) { |
231 layer_tree_host()->DidFailToInitializeOutputSurface(); | 210 layer_tree_host()->DidFailToInitializeOutputSurface(); |
232 return; | 211 return; |
233 } | 212 } |
234 main().renderer_capabilities_main_thread_copy = capabilities; | 213 main().renderer_capabilities_main_thread_copy = capabilities; |
235 layer_tree_host()->DidInitializeOutputSurface(); | 214 layer_tree_host()->DidInitializeOutputSurface(); |
236 } | 215 } |
237 | 216 |
238 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( | 217 void ThreadProxy::SetRendererCapabilitiesMainCopy( |
239 const RendererCapabilities& capabilities) { | 218 const RendererCapabilities& capabilities) { |
240 main().renderer_capabilities_main_thread_copy = capabilities; | 219 main().renderer_capabilities_main_thread_copy = capabilities; |
241 } | 220 } |
242 | 221 |
243 bool ThreadProxy::SendCommitRequestToImplThreadIfNeeded( | 222 bool ThreadProxy::SendCommitRequestToImplThreadIfNeeded( |
244 CommitPipelineStage required_stage) { | 223 CommitPipelineStage required_stage) { |
245 DCHECK(IsMainThread()); | 224 DCHECK(IsMainThread()); |
246 DCHECK_NE(NO_PIPELINE_STAGE, required_stage); | 225 DCHECK_NE(NO_PIPELINE_STAGE, required_stage); |
247 bool already_posted = | 226 bool already_posted = |
248 main().max_requested_pipeline_stage != NO_PIPELINE_STAGE; | 227 main().max_requested_pipeline_stage != NO_PIPELINE_STAGE; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 return; | 280 return; |
302 } | 281 } |
303 if (SendCommitRequestToImplThreadIfNeeded(COMMIT_PIPELINE_STAGE)) { | 282 if (SendCommitRequestToImplThreadIfNeeded(COMMIT_PIPELINE_STAGE)) { |
304 TRACE_EVENT_INSTANT0("cc", "ThreadProxy::SetNeedsCommit", | 283 TRACE_EVENT_INSTANT0("cc", "ThreadProxy::SetNeedsCommit", |
305 TRACE_EVENT_SCOPE_THREAD); | 284 TRACE_EVENT_SCOPE_THREAD); |
306 } | 285 } |
307 } | 286 } |
308 | 287 |
309 void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() { | 288 void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() { |
310 DCHECK(IsImplThread()); | 289 DCHECK(IsImplThread()); |
311 Proxy::MainThreadTaskRunner()->PostTask( | 290 impl().channel_impl->SetRendererCapabilitiesMainCopy( |
312 FROM_HERE, | 291 impl() |
313 base::Bind(&ThreadProxy::SetRendererCapabilitiesMainThreadCopy, | 292 .layer_tree_host_impl->GetRendererCapabilities() |
314 main_thread_weak_ptr_, | 293 .MainThreadCapabilities()); |
315 impl() | |
316 .layer_tree_host_impl->GetRendererCapabilities() | |
317 .MainThreadCapabilities())); | |
318 } | 294 } |
319 | 295 |
320 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() { | 296 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
321 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread"); | 297 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread"); |
322 DCHECK(IsImplThread()); | 298 DCHECK(IsImplThread()); |
323 Proxy::MainThreadTaskRunner()->PostTask( | 299 impl().channel_impl->DidLoseOutputSurface(); |
324 FROM_HERE, | |
325 base::Bind(&ThreadProxy::DidLoseOutputSurface, main_thread_weak_ptr_)); | |
326 impl().scheduler->DidLoseOutputSurface(); | 300 impl().scheduler->DidLoseOutputSurface(); |
327 } | 301 } |
328 | 302 |
329 void ThreadProxy::CommitVSyncParameters(base::TimeTicks timebase, | 303 void ThreadProxy::CommitVSyncParameters(base::TimeTicks timebase, |
330 base::TimeDelta interval) { | 304 base::TimeDelta interval) { |
331 impl().scheduler->CommitVSyncParameters(timebase, interval); | 305 impl().scheduler->CommitVSyncParameters(timebase, interval); |
332 } | 306 } |
333 | 307 |
334 void ThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { | 308 void ThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { |
335 impl().scheduler->SetEstimatedParentDrawTime(draw_time); | 309 impl().scheduler->SetEstimatedParentDrawTime(draw_time); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 // In tests the layer tree is destroyed after the scheduler is. | 369 // In tests the layer tree is destroyed after the scheduler is. |
396 if (impl().scheduler) | 370 if (impl().scheduler) |
397 impl().scheduler->SetVideoNeedsBeginFrames(needs_begin_frames); | 371 impl().scheduler->SetVideoNeedsBeginFrames(needs_begin_frames); |
398 } | 372 } |
399 | 373 |
400 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 374 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
401 scoped_ptr<AnimationEventsVector> events) { | 375 scoped_ptr<AnimationEventsVector> events) { |
402 TRACE_EVENT0("cc", | 376 TRACE_EVENT0("cc", |
403 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); | 377 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); |
404 DCHECK(IsImplThread()); | 378 DCHECK(IsImplThread()); |
405 Proxy::MainThreadTaskRunner()->PostTask( | 379 impl().channel_impl->SetAnimationEvents(events.Pass()); |
406 FROM_HERE, | |
407 base::Bind(&ThreadProxy::SetAnimationEvents, | |
408 main_thread_weak_ptr_, | |
409 base::Passed(&events))); | |
410 } | 380 } |
411 | 381 |
412 bool ThreadProxy::IsInsideDraw() { return impl().inside_draw; } | 382 bool ThreadProxy::IsInsideDraw() { return impl().inside_draw; } |
413 | 383 |
414 void ThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { | 384 void ThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
415 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); | 385 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); |
416 DCHECK(IsMainThread()); | 386 DCHECK(IsMainThread()); |
417 Proxy::ImplThreadTaskRunner()->PostTask( | 387 Proxy::ImplThreadTaskRunner()->PostTask( |
418 FROM_HERE, | 388 FROM_HERE, |
419 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread, | 389 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread, |
(...skipping 11 matching lines...) Expand all Loading... | |
431 DCHECK(IsMainThread()); | 401 DCHECK(IsMainThread()); |
432 if (main().defer_commits == defer_commits) | 402 if (main().defer_commits == defer_commits) |
433 return; | 403 return; |
434 | 404 |
435 main().defer_commits = defer_commits; | 405 main().defer_commits = defer_commits; |
436 if (main().defer_commits) | 406 if (main().defer_commits) |
437 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); | 407 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); |
438 else | 408 else |
439 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); | 409 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); |
440 | 410 |
441 Proxy::ImplThreadTaskRunner()->PostTask( | 411 main().channel_main->SetDeferCommitsOnImpl(defer_commits); |
442 FROM_HERE, | |
443 base::Bind(&ThreadProxy::SetDeferCommitsOnImplThread, | |
444 impl_thread_weak_ptr_, | |
445 defer_commits)); | |
446 } | 412 } |
447 | 413 |
448 void ThreadProxy::SetDeferCommitsOnImplThread(bool defer_commits) const { | 414 void ThreadProxy::SetDeferCommitsOnImpl(bool defer_commits) { |
449 DCHECK(IsImplThread()); | 415 DCHECK(IsImplThread()); |
450 impl().scheduler->SetDeferCommits(defer_commits); | 416 impl().scheduler->SetDeferCommits(defer_commits); |
451 } | 417 } |
452 | 418 |
453 bool ThreadProxy::CommitRequested() const { | 419 bool ThreadProxy::CommitRequested() const { |
454 DCHECK(IsMainThread()); | 420 DCHECK(IsMainThread()); |
455 // TODO(skyostil): Split this into something like CommitRequested() and | 421 // TODO(skyostil): Split this into something like CommitRequested() and |
456 // CommitInProgress(). | 422 // CommitInProgress(). |
457 return main().current_pipeline_stage != NO_PIPELINE_STAGE || | 423 return main().current_pipeline_stage != NO_PIPELINE_STAGE || |
458 main().max_requested_pipeline_stage >= COMMIT_PIPELINE_STAGE; | 424 main().max_requested_pipeline_stage >= COMMIT_PIPELINE_STAGE; |
(...skipping 22 matching lines...) Expand all Loading... | |
481 } | 447 } |
482 | 448 |
483 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { | 449 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { |
484 DCHECK(IsImplThread()); | 450 DCHECK(IsImplThread()); |
485 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); | 451 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); |
486 SetNeedsRedrawOnImplThread(); | 452 SetNeedsRedrawOnImplThread(); |
487 } | 453 } |
488 | 454 |
489 void ThreadProxy::MainThreadHasStoppedFlinging() { | 455 void ThreadProxy::MainThreadHasStoppedFlinging() { |
490 DCHECK(IsMainThread()); | 456 DCHECK(IsMainThread()); |
491 Proxy::ImplThreadTaskRunner()->PostTask( | 457 main().channel_main->MainThreadHasStoppedFlingingOnImpl(); |
492 FROM_HERE, | |
493 base::Bind(&ThreadProxy::MainThreadHasStoppedFlingingOnImplThread, | |
494 impl_thread_weak_ptr_)); | |
495 } | 458 } |
496 | 459 |
497 void ThreadProxy::MainThreadHasStoppedFlingingOnImplThread() { | 460 void ThreadProxy::MainThreadHasStoppedFlingingOnImpl() { |
498 DCHECK(IsImplThread()); | 461 DCHECK(IsImplThread()); |
499 impl().layer_tree_host_impl->MainThreadHasStoppedFlinging(); | 462 impl().layer_tree_host_impl->MainThreadHasStoppedFlinging(); |
500 } | 463 } |
501 | 464 |
502 void ThreadProxy::NotifyInputThrottledUntilCommit() { | 465 void ThreadProxy::NotifyInputThrottledUntilCommit() { |
503 DCHECK(IsMainThread()); | 466 DCHECK(IsMainThread()); |
504 Proxy::ImplThreadTaskRunner()->PostTask( | 467 main().channel_main->SetInputThrottledUntilCommitOnImpl(true); |
505 FROM_HERE, | |
506 base::Bind(&ThreadProxy::SetInputThrottledUntilCommitOnImplThread, | |
507 impl_thread_weak_ptr_, | |
508 true)); | |
509 } | 468 } |
510 | 469 |
511 void ThreadProxy::SetInputThrottledUntilCommitOnImplThread(bool is_throttled) { | 470 void ThreadProxy::SetInputThrottledUntilCommitOnImpl(bool is_throttled) { |
512 DCHECK(IsImplThread()); | 471 DCHECK(IsImplThread()); |
513 if (is_throttled == impl().input_throttled_until_commit) | 472 if (is_throttled == impl().input_throttled_until_commit) |
514 return; | 473 return; |
515 impl().input_throttled_until_commit = is_throttled; | 474 impl().input_throttled_until_commit = is_throttled; |
516 RenewTreePriority(); | 475 RenewTreePriority(); |
517 } | 476 } |
518 | 477 |
519 LayerTreeHost* ThreadProxy::layer_tree_host() { | 478 LayerTreeHost* ThreadProxy::layer_tree_host() { |
520 return blocked_main().layer_tree_host; | 479 return blocked_main().layer_tree_host; |
521 } | 480 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 TRACE_EVENT0("cc", "ThreadProxy::Stop"); | 536 TRACE_EVENT0("cc", "ThreadProxy::Stop"); |
578 DCHECK(IsMainThread()); | 537 DCHECK(IsMainThread()); |
579 DCHECK(main().started); | 538 DCHECK(main().started); |
580 | 539 |
581 // Synchronously finishes pending GL operations and deletes the impl. | 540 // Synchronously finishes pending GL operations and deletes the impl. |
582 // The two steps are done as separate post tasks, so that tasks posted | 541 // The two steps are done as separate post tasks, so that tasks posted |
583 // by the GL implementation due to the Finish can be executed by the | 542 // by the GL implementation due to the Finish can be executed by the |
584 // renderer before shutting it down. | 543 // renderer before shutting it down. |
585 { | 544 { |
586 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 545 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
587 | 546 main().channel_main->FinishGLOnImpl(); |
588 CompletionEvent completion; | |
589 Proxy::ImplThreadTaskRunner()->PostTask( | |
590 FROM_HERE, | |
591 base::Bind(&ThreadProxy::FinishGLOnImplThread, | |
592 impl_thread_weak_ptr_, | |
593 &completion)); | |
594 completion.Wait(); | |
595 } | 547 } |
596 { | 548 { |
597 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 549 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
598 | 550 |
599 CompletionEvent completion; | 551 CompletionEvent completion; |
600 Proxy::ImplThreadTaskRunner()->PostTask( | 552 Proxy::ImplThreadTaskRunner()->PostTask( |
601 FROM_HERE, | 553 FROM_HERE, |
602 base::Bind(&ThreadProxy::LayerTreeHostClosedOnImplThread, | 554 base::Bind(&ThreadProxy::LayerTreeHostClosedOnImplThread, |
603 impl_thread_weak_ptr_, | 555 impl_thread_weak_ptr_, |
604 &completion)); | 556 &completion)); |
605 completion.Wait(); | 557 completion.Wait(); |
606 } | 558 } |
607 | 559 |
608 main().weak_factory.InvalidateWeakPtrs(); | 560 main().weak_factory.InvalidateWeakPtrs(); |
609 blocked_main().layer_tree_host = NULL; | 561 blocked_main().layer_tree_host = NULL; |
610 main().started = false; | 562 main().started = false; |
611 } | 563 } |
612 | 564 |
613 bool ThreadProxy::SupportsImplScrolling() const { | 565 bool ThreadProxy::SupportsImplScrolling() const { |
614 return true; | 566 return true; |
615 } | 567 } |
616 | 568 |
617 void ThreadProxy::FinishAllRenderingOnImplThread(CompletionEvent* completion) { | 569 void ThreadProxy::FinishAllRenderingOnImpl() { |
618 TRACE_EVENT0("cc", "ThreadProxy::FinishAllRenderingOnImplThread"); | 570 TRACE_EVENT0("cc", "ThreadProxy::FinishAllRenderingOnImplThread"); |
619 DCHECK(IsImplThread()); | 571 DCHECK(IsImplThread()); |
620 impl().layer_tree_host_impl->FinishAllRendering(); | 572 impl().layer_tree_host_impl->FinishAllRendering(); |
621 completion->Signal(); | |
622 } | 573 } |
623 | 574 |
624 void ThreadProxy::ScheduledActionSendBeginMainFrame() { | 575 void ThreadProxy::ScheduledActionSendBeginMainFrame() { |
625 unsigned int begin_frame_id = nextBeginFrameId++; | 576 unsigned int begin_frame_id = nextBeginFrameId++; |
626 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( | 577 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( |
627 benchmark_instrumentation::kSendBeginFrame, begin_frame_id); | 578 benchmark_instrumentation::kSendBeginFrame, begin_frame_id); |
628 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( | 579 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( |
629 new BeginMainFrameAndCommitState); | 580 new BeginMainFrameAndCommitState); |
630 begin_main_frame_state->begin_frame_id = begin_frame_id; | 581 begin_main_frame_state->begin_frame_id = begin_frame_id; |
631 begin_main_frame_state->begin_frame_args = | 582 begin_main_frame_state->begin_frame_args = |
(...skipping 11 matching lines...) Expand all Loading... | |
643 Proxy::MainThreadTaskRunner()->PostTask( | 594 Proxy::MainThreadTaskRunner()->PostTask( |
644 FROM_HERE, | 595 FROM_HERE, |
645 base::Bind(&ThreadProxy::BeginMainFrame, | 596 base::Bind(&ThreadProxy::BeginMainFrame, |
646 main_thread_weak_ptr_, | 597 main_thread_weak_ptr_, |
647 base::Passed(&begin_main_frame_state))); | 598 base::Passed(&begin_main_frame_state))); |
648 devtools_instrumentation::DidRequestMainThreadFrame( | 599 devtools_instrumentation::DidRequestMainThreadFrame( |
649 impl().layer_tree_host_id); | 600 impl().layer_tree_host_id); |
650 } | 601 } |
651 | 602 |
652 void ThreadProxy::SendBeginMainFrameNotExpectedSoon() { | 603 void ThreadProxy::SendBeginMainFrameNotExpectedSoon() { |
653 Proxy::MainThreadTaskRunner()->PostTask( | 604 impl().channel_impl->BeginMainFrameNotExpectedSoon(); |
654 FROM_HERE, base::Bind(&ThreadProxy::BeginMainFrameNotExpectedSoon, | |
655 main_thread_weak_ptr_)); | |
656 } | 605 } |
657 | 606 |
658 void ThreadProxy::BeginMainFrame( | 607 void ThreadProxy::BeginMainFrame( |
659 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 608 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
660 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( | 609 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( |
661 benchmark_instrumentation::kDoBeginFrame, | 610 benchmark_instrumentation::kDoBeginFrame, |
662 begin_main_frame_state->begin_frame_id); | 611 begin_main_frame_state->begin_frame_id); |
663 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); | 612 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); |
664 DCHECK(IsMainThread()); | 613 DCHECK(IsMainThread()); |
665 DCHECK_EQ(NO_PIPELINE_STAGE, main().current_pipeline_stage); | 614 DCHECK_EQ(NO_PIPELINE_STAGE, main().current_pipeline_stage); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 void ThreadProxy::BeginMainFrameAbortedOnImplThread( | 758 void ThreadProxy::BeginMainFrameAbortedOnImplThread( |
810 CommitEarlyOutReason reason) { | 759 CommitEarlyOutReason reason) { |
811 TRACE_EVENT1("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread", "reason", | 760 TRACE_EVENT1("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread", "reason", |
812 CommitEarlyOutReasonToString(reason)); | 761 CommitEarlyOutReasonToString(reason)); |
813 DCHECK(IsImplThread()); | 762 DCHECK(IsImplThread()); |
814 DCHECK(impl().scheduler); | 763 DCHECK(impl().scheduler); |
815 DCHECK(impl().scheduler->CommitPending()); | 764 DCHECK(impl().scheduler->CommitPending()); |
816 DCHECK(!impl().layer_tree_host_impl->pending_tree()); | 765 DCHECK(!impl().layer_tree_host_impl->pending_tree()); |
817 | 766 |
818 if (CommitEarlyOutHandledCommit(reason)) { | 767 if (CommitEarlyOutHandledCommit(reason)) { |
819 SetInputThrottledUntilCommitOnImplThread(false); | 768 SetInputThrottledUntilCommitOnImpl(false); |
820 impl().last_processed_begin_main_frame_args = | 769 impl().last_processed_begin_main_frame_args = |
821 impl().last_begin_main_frame_args; | 770 impl().last_begin_main_frame_args; |
822 } | 771 } |
823 impl().layer_tree_host_impl->BeginMainFrameAborted(reason); | 772 impl().layer_tree_host_impl->BeginMainFrameAborted(reason); |
824 impl().scheduler->BeginMainFrameAborted(reason); | 773 impl().scheduler->BeginMainFrameAborted(reason); |
825 } | 774 } |
826 | 775 |
827 void ThreadProxy::ScheduledActionAnimate() { | 776 void ThreadProxy::ScheduledActionAnimate() { |
828 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); | 777 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); |
829 DCHECK(IsImplThread()); | 778 DCHECK(IsImplThread()); |
(...skipping 28 matching lines...) Expand all Loading... | |
858 impl().commit_completion_event->Signal(); | 807 impl().commit_completion_event->Signal(); |
859 impl().commit_completion_event = NULL; | 808 impl().commit_completion_event = NULL; |
860 } | 809 } |
861 | 810 |
862 impl().scheduler->DidCommit(); | 811 impl().scheduler->DidCommit(); |
863 | 812 |
864 // Delay this step until afer the main thread has been released as it's | 813 // Delay this step until afer the main thread has been released as it's |
865 // often a good bit of work to update the tree and prepare the new frame. | 814 // often a good bit of work to update the tree and prepare the new frame. |
866 impl().layer_tree_host_impl->CommitComplete(); | 815 impl().layer_tree_host_impl->CommitComplete(); |
867 | 816 |
868 SetInputThrottledUntilCommitOnImplThread(false); | 817 SetInputThrottledUntilCommitOnImpl(false); |
869 | 818 |
870 impl().next_frame_is_newly_committed_frame = true; | 819 impl().next_frame_is_newly_committed_frame = true; |
871 } | 820 } |
872 | 821 |
873 void ThreadProxy::ScheduledActionActivateSyncTree() { | 822 void ThreadProxy::ScheduledActionActivateSyncTree() { |
874 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivateSyncTree"); | 823 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivateSyncTree"); |
875 DCHECK(IsImplThread()); | 824 DCHECK(IsImplThread()); |
876 impl().layer_tree_host_impl->ActivateSyncTree(); | 825 impl().layer_tree_host_impl->ActivateSyncTree(); |
877 } | 826 } |
878 | 827 |
879 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { | 828 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
880 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); | 829 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); |
881 DCHECK(IsImplThread()); | 830 DCHECK(IsImplThread()); |
882 Proxy::MainThreadTaskRunner()->PostTask( | 831 impl().channel_impl->RequestNewOutputSurface(); |
883 FROM_HERE, | |
884 base::Bind(&ThreadProxy::RequestNewOutputSurface, main_thread_weak_ptr_)); | |
885 } | 832 } |
886 | 833 |
887 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { | 834 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { |
888 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); | 835 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); |
889 DrawResult result; | 836 DrawResult result; |
890 | 837 |
891 DCHECK(IsImplThread()); | 838 DCHECK(IsImplThread()); |
892 DCHECK(impl().layer_tree_host_impl.get()); | 839 DCHECK(impl().layer_tree_host_impl.get()); |
893 | 840 |
894 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); | 841 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
930 | 877 |
931 bool start_ready_animations = draw_frame; | 878 bool start_ready_animations = draw_frame; |
932 impl().layer_tree_host_impl->UpdateAnimationState(start_ready_animations); | 879 impl().layer_tree_host_impl->UpdateAnimationState(start_ready_animations); |
933 | 880 |
934 if (draw_frame) | 881 if (draw_frame) |
935 impl().layer_tree_host_impl->SwapBuffers(frame); | 882 impl().layer_tree_host_impl->SwapBuffers(frame); |
936 | 883 |
937 // Tell the main thread that the the newly-commited frame was drawn. | 884 // Tell the main thread that the the newly-commited frame was drawn. |
938 if (impl().next_frame_is_newly_committed_frame) { | 885 if (impl().next_frame_is_newly_committed_frame) { |
939 impl().next_frame_is_newly_committed_frame = false; | 886 impl().next_frame_is_newly_committed_frame = false; |
940 Proxy::MainThreadTaskRunner()->PostTask( | 887 impl().channel_impl->DidCommitAndDrawFrame(); |
941 FROM_HERE, | |
942 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); | |
943 } | 888 } |
944 | 889 |
945 DCHECK_NE(INVALID_RESULT, result); | 890 DCHECK_NE(INVALID_RESULT, result); |
946 return result; | 891 return result; |
947 } | 892 } |
948 | 893 |
949 void ThreadProxy::ScheduledActionPrepareTiles() { | 894 void ThreadProxy::ScheduledActionPrepareTiles() { |
950 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionPrepareTiles"); | 895 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionPrepareTiles"); |
951 impl().layer_tree_host_impl->PrepareTiles(); | 896 impl().layer_tree_host_impl->PrepareTiles(); |
952 } | 897 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1023 impl().rendering_stats_instrumentation)); | 968 impl().rendering_stats_instrumentation)); |
1024 | 969 |
1025 impl().scheduler = Scheduler::Create( | 970 impl().scheduler = Scheduler::Create( |
1026 this, scheduler_settings, impl().layer_tree_host_id, | 971 this, scheduler_settings, impl().layer_tree_host_id, |
1027 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), | 972 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), |
1028 compositor_timing_history.Pass()); | 973 compositor_timing_history.Pass()); |
1029 | 974 |
1030 DCHECK_EQ(impl().scheduler->visible(), | 975 DCHECK_EQ(impl().scheduler->visible(), |
1031 impl().layer_tree_host_impl->visible()); | 976 impl().layer_tree_host_impl->visible()); |
1032 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); | 977 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); |
978 threaded_channel_->InitImplThreadWeakPtr(); | |
1033 completion->Signal(); | 979 completion->Signal(); |
1034 } | 980 } |
1035 | 981 |
1036 void ThreadProxy::InitializeOutputSurfaceOnImplThread( | 982 void ThreadProxy::InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) { |
1037 OutputSurface* output_surface) { | |
1038 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); | 983 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); |
1039 DCHECK(IsImplThread()); | 984 DCHECK(IsImplThread()); |
1040 | 985 |
1041 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); | 986 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); |
1042 bool success = host_impl->InitializeRenderer(output_surface); | 987 bool success = host_impl->InitializeRenderer(output_surface); |
1043 RendererCapabilities capabilities; | 988 RendererCapabilities capabilities; |
1044 if (success) { | 989 if (success) { |
1045 capabilities = | 990 capabilities = |
1046 host_impl->GetRendererCapabilities().MainThreadCapabilities(); | 991 host_impl->GetRendererCapabilities().MainThreadCapabilities(); |
1047 } | 992 } |
1048 | 993 |
1049 Proxy::MainThreadTaskRunner()->PostTask( | 994 impl().channel_impl->DidInitializeOutputSurface(success, capabilities); |
1050 FROM_HERE, | |
1051 base::Bind(&ThreadProxy::DidInitializeOutputSurface, | |
1052 main_thread_weak_ptr_, | |
1053 success, | |
1054 capabilities)); | |
1055 | 995 |
1056 if (success) | 996 if (success) |
1057 impl().scheduler->DidCreateAndInitializeOutputSurface(); | 997 impl().scheduler->DidCreateAndInitializeOutputSurface(); |
1058 } | 998 } |
1059 | 999 |
1060 void ThreadProxy::ReleaseOutputSurfaceOnImplThread( | 1000 void ThreadProxy::ReleaseOutputSurfaceOnImpl() { |
1061 CompletionEvent* completion) { | |
1062 DCHECK(IsImplThread()); | 1001 DCHECK(IsImplThread()); |
1063 | 1002 |
1064 // Unlike DidLoseOutputSurfaceOnImplThread, we don't need to call | 1003 // Unlike DidLoseOutputSurfaceOnImplThread, we don't need to call |
1065 // LayerTreeHost::DidLoseOutputSurface since it already knows. | 1004 // LayerTreeHost::DidLoseOutputSurface since it already knows. |
1066 impl().scheduler->DidLoseOutputSurface(); | 1005 impl().scheduler->DidLoseOutputSurface(); |
1067 impl().layer_tree_host_impl->ReleaseOutputSurface(); | 1006 impl().layer_tree_host_impl->ReleaseOutputSurface(); |
1068 completion->Signal(); | |
1069 } | 1007 } |
1070 | 1008 |
1071 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1009 void ThreadProxy::FinishGLOnImpl() { |
1072 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1010 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
1073 DCHECK(IsImplThread()); | 1011 DCHECK(IsImplThread()); |
1074 if (impl().layer_tree_host_impl->output_surface()) { | 1012 if (impl().layer_tree_host_impl->output_surface()) { |
1075 ContextProvider* context_provider = | 1013 ContextProvider* context_provider = |
1076 impl().layer_tree_host_impl->output_surface()->context_provider(); | 1014 impl().layer_tree_host_impl->output_surface()->context_provider(); |
1077 if (context_provider) | 1015 if (context_provider) |
1078 context_provider->ContextGL()->Finish(); | 1016 context_provider->ContextGL()->Finish(); |
1079 } | 1017 } |
1080 completion->Signal(); | |
1081 } | 1018 } |
1082 | 1019 |
1083 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1020 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
1084 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1021 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
1085 DCHECK(IsImplThread()); | 1022 DCHECK(IsImplThread()); |
1086 DCHECK(IsMainThreadBlocked()); | 1023 DCHECK(IsMainThreadBlocked()); |
1087 impl().scheduler = nullptr; | 1024 impl().scheduler = nullptr; |
1088 impl().external_begin_frame_source = nullptr; | 1025 impl().external_begin_frame_source = nullptr; |
1089 impl().layer_tree_host_impl = nullptr; | 1026 impl().layer_tree_host_impl = nullptr; |
1090 impl().weak_factory.InvalidateWeakPtrs(); | 1027 impl().weak_factory.InvalidateWeakPtrs(); |
1028 threaded_channel_->InvalidateImplThreadWeakPtr(); | |
1091 // We need to explicitly shutdown the notifier to destroy any weakptrs it is | 1029 // We need to explicitly shutdown the notifier to destroy any weakptrs it is |
1092 // holding while still on the compositor thread. This also ensures any | 1030 // holding while still on the compositor thread. This also ensures any |
1093 // callbacks holding a ThreadProxy pointer are cancelled. | 1031 // callbacks holding a ThreadProxy pointer are cancelled. |
1094 impl().smoothness_priority_expiration_notifier.Shutdown(); | 1032 impl().smoothness_priority_expiration_notifier.Shutdown(); |
1095 completion->Signal(); | 1033 completion->Signal(); |
1096 } | 1034 } |
1097 | 1035 |
1098 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() | 1036 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() |
1099 : memory_allocation_limit_bytes(0), | 1037 : memory_allocation_limit_bytes(0), |
1100 evicted_ui_resources(false) {} | 1038 evicted_ui_resources(false) {} |
1101 | 1039 |
1102 ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {} | 1040 ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {} |
1103 | 1041 |
1104 bool ThreadProxy::MainFrameWillHappenForTesting() { | 1042 bool ThreadProxy::MainFrameWillHappenForTesting() { |
1105 DCHECK(IsMainThread()); | 1043 DCHECK(IsMainThread()); |
1106 CompletionEvent completion; | |
1107 bool main_frame_will_happen = false; | 1044 bool main_frame_will_happen = false; |
1108 { | 1045 { |
1109 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 1046 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
1110 Proxy::ImplThreadTaskRunner()->PostTask( | 1047 main().channel_main->MainFrameWillHappenOnImplForTesting( |
1111 FROM_HERE, | 1048 &main_frame_will_happen); |
1112 base::Bind(&ThreadProxy::MainFrameWillHappenOnImplThreadForTesting, | |
1113 impl_thread_weak_ptr_, | |
1114 &completion, | |
1115 &main_frame_will_happen)); | |
1116 completion.Wait(); | |
1117 } | 1049 } |
1118 return main_frame_will_happen; | 1050 return main_frame_will_happen; |
1119 } | 1051 } |
1120 | 1052 |
1121 void ThreadProxy::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { | 1053 void ThreadProxy::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { |
1122 NOTREACHED() << "Only used by SingleThreadProxy"; | 1054 NOTREACHED() << "Only used by SingleThreadProxy"; |
1123 } | 1055 } |
1124 | 1056 |
1125 void ThreadProxy::MainFrameWillHappenOnImplThreadForTesting( | 1057 void ThreadProxy::MainFrameWillHappenOnImplForTesting( |
1126 CompletionEvent* completion, | |
1127 bool* main_frame_will_happen) { | 1058 bool* main_frame_will_happen) { |
1128 DCHECK(IsImplThread()); | 1059 DCHECK(IsImplThread()); |
1129 if (impl().layer_tree_host_impl->output_surface()) { | 1060 if (impl().layer_tree_host_impl->output_surface()) { |
1130 *main_frame_will_happen = impl().scheduler->MainFrameForTestingWillHappen(); | 1061 *main_frame_will_happen = impl().scheduler->MainFrameForTestingWillHappen(); |
1131 } else { | 1062 } else { |
1132 *main_frame_will_happen = false; | 1063 *main_frame_will_happen = false; |
1133 } | 1064 } |
1134 completion->Signal(); | |
1135 } | 1065 } |
1136 | 1066 |
1137 void ThreadProxy::RenewTreePriority() { | 1067 void ThreadProxy::RenewTreePriority() { |
1138 DCHECK(IsImplThread()); | 1068 DCHECK(IsImplThread()); |
1139 bool smoothness_takes_priority = | 1069 bool smoothness_takes_priority = |
1140 impl().layer_tree_host_impl->pinch_gesture_active() || | 1070 impl().layer_tree_host_impl->pinch_gesture_active() || |
1141 impl().layer_tree_host_impl->page_scale_animation_active() || | 1071 impl().layer_tree_host_impl->page_scale_animation_active() || |
1142 impl().layer_tree_host_impl->IsActivelyScrolling(); | 1072 impl().layer_tree_host_impl->IsActivelyScrolling(); |
1143 | 1073 |
1144 // Schedule expiration if smoothness currently takes priority. | 1074 // Schedule expiration if smoothness currently takes priority. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1210 impl().scheduler->WillPrepareTiles(); | 1140 impl().scheduler->WillPrepareTiles(); |
1211 } | 1141 } |
1212 | 1142 |
1213 void ThreadProxy::DidPrepareTiles() { | 1143 void ThreadProxy::DidPrepareTiles() { |
1214 DCHECK(IsImplThread()); | 1144 DCHECK(IsImplThread()); |
1215 impl().scheduler->DidPrepareTiles(); | 1145 impl().scheduler->DidPrepareTiles(); |
1216 } | 1146 } |
1217 | 1147 |
1218 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { | 1148 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { |
1219 DCHECK(IsImplThread()); | 1149 DCHECK(IsImplThread()); |
1220 Proxy::MainThreadTaskRunner()->PostTask( | 1150 impl().channel_impl->DidCompletePageScaleAnimation(); |
1221 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, | |
1222 main_thread_weak_ptr_)); | |
1223 } | 1151 } |
1224 | 1152 |
1225 void ThreadProxy::OnDrawForOutputSurface() { | 1153 void ThreadProxy::OnDrawForOutputSurface() { |
1226 DCHECK(IsImplThread()); | 1154 DCHECK(IsImplThread()); |
1227 impl().scheduler->OnDrawForOutputSurface(); | 1155 impl().scheduler->OnDrawForOutputSurface(); |
1228 } | 1156 } |
1229 | 1157 |
1230 void ThreadProxy::PostFrameTimingEventsOnImplThread( | 1158 void ThreadProxy::PostFrameTimingEventsOnImplThread( |
1231 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1159 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
1232 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1160 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
1233 DCHECK(IsImplThread()); | 1161 DCHECK(IsImplThread()); |
1234 Proxy::MainThreadTaskRunner()->PostTask( | 1162 impl().channel_impl->PostFrameTimingEventsOnMain(composite_events.Pass(), |
1235 FROM_HERE, | 1163 main_frame_events.Pass()); |
1236 base::Bind(&ThreadProxy::PostFrameTimingEvents, main_thread_weak_ptr_, | |
1237 base::Passed(composite_events.Pass()), | |
1238 base::Passed(main_frame_events.Pass()))); | |
1239 } | 1164 } |
1240 | 1165 |
1241 void ThreadProxy::PostFrameTimingEvents( | 1166 void ThreadProxy::PostFrameTimingEventsOnMain( |
1242 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1167 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
1243 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1168 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
1244 DCHECK(IsMainThread()); | 1169 DCHECK(IsMainThread()); |
1245 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), | 1170 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), |
1246 main_frame_events.Pass()); | 1171 main_frame_events.Pass()); |
1247 } | 1172 } |
1248 | 1173 |
1249 base::WeakPtr<ProxyMain> ThreadProxy::GetMainWeakPtr() { | 1174 base::WeakPtr<ProxyMain> ThreadProxy::GetMainWeakPtr() { |
1250 return main_thread_weak_ptr_; | 1175 return main_thread_weak_ptr_; |
1251 } | 1176 } |
1252 | 1177 |
1253 base::WeakPtr<ProxyImpl> ThreadProxy::GetImplWeakPtr() { | 1178 base::WeakPtr<ProxyImpl> ThreadProxy::GetImplWeakPtr() { |
1254 return impl_thread_weak_ptr_; | 1179 return impl_thread_weak_ptr_; |
1255 } | 1180 } |
1256 | 1181 |
1257 } // namespace cc | 1182 } // namespace cc |
OLD | NEW |