| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/proxy_impl.h" | 5 #include "cc/trees/proxy_impl.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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 bool forced_draw = true; | 480 bool forced_draw = true; |
| 481 return DrawInternal(forced_draw); | 481 return DrawInternal(forced_draw); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void ProxyImpl::ScheduledActionCommit() { | 484 void ProxyImpl::ScheduledActionCommit() { |
| 485 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionCommit"); | 485 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionCommit"); |
| 486 DCHECK(IsImplThread()); | 486 DCHECK(IsImplThread()); |
| 487 DCHECK(IsMainThreadBlocked()); | 487 DCHECK(IsMainThreadBlocked()); |
| 488 DCHECK(commit_completion_event_); | 488 DCHECK(commit_completion_event_); |
| 489 | 489 |
| 490 // Relax the cross-thread access restriction to non-thread-safe RefCount. |
| 491 // It's safe since the main thread is blocked while a main-thread-bound |
| 492 // compositor stuff are accessed from the impl thread. |
| 493 base::ScopedAllowCrossThreadRefCountAccess |
| 494 allow_cross_thread_ref_count_access; |
| 495 |
| 490 layer_tree_host_impl_->BeginCommit(); | 496 layer_tree_host_impl_->BeginCommit(); |
| 491 blocked_main_commit().layer_tree_host->FinishCommitOnImplThread( | 497 blocked_main_commit().layer_tree_host->FinishCommitOnImplThread( |
| 492 layer_tree_host_impl_.get()); | 498 layer_tree_host_impl_.get()); |
| 493 | 499 |
| 494 // Remove the LayerTreeHost reference before the completion event is signaled | 500 // Remove the LayerTreeHost reference before the completion event is signaled |
| 495 // and cleared. This is necessary since blocked_main_commit() allows access | 501 // and cleared. This is necessary since blocked_main_commit() allows access |
| 496 // only while we have the completion event to ensure the main thread is | 502 // only while we have the completion event to ensure the main thread is |
| 497 // blocked for a commit. | 503 // blocked for a commit. |
| 498 blocked_main_commit().layer_tree_host = nullptr; | 504 blocked_main_commit().layer_tree_host = nullptr; |
| 499 | 505 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 634 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 629 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 635 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 630 return main_thread_blocked_commit_vars_unsafe_; | 636 return main_thread_blocked_commit_vars_unsafe_; |
| 631 } | 637 } |
| 632 | 638 |
| 633 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { | 639 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { |
| 634 return task_runner_provider_->MainThreadTaskRunner(); | 640 return task_runner_provider_->MainThreadTaskRunner(); |
| 635 } | 641 } |
| 636 | 642 |
| 637 } // namespace cc | 643 } // namespace cc |
| OLD | NEW |