Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: cc/trees/proxy_impl.cc

Issue 2666423002: Assert sequence validity on non-thread-safe RefCount manipulations (2) (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 bool forced_draw = true; 486 bool forced_draw = true;
487 return DrawInternal(forced_draw); 487 return DrawInternal(forced_draw);
488 } 488 }
489 489
490 void ProxyImpl::ScheduledActionCommit() { 490 void ProxyImpl::ScheduledActionCommit() {
491 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionCommit"); 491 TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionCommit");
492 DCHECK(IsImplThread()); 492 DCHECK(IsImplThread());
493 DCHECK(IsMainThreadBlocked()); 493 DCHECK(IsMainThreadBlocked());
494 DCHECK(commit_completion_event_); 494 DCHECK(commit_completion_event_);
495 495
496 // Relax the cross-thread access restriction to non-thread-safe RefCount.
497 // It's safe since the main thread is blocked while a main-thread-bound
498 // compositor stuff are accessed from the impl thread.
499 base::ScopedAllowCrossThreadRefCountAccess
500 allow_cross_thread_ref_count_access;
501
496 layer_tree_host_impl_->BeginCommit(); 502 layer_tree_host_impl_->BeginCommit();
497 blocked_main_commit().layer_tree_host->FinishCommitOnImplThread( 503 blocked_main_commit().layer_tree_host->FinishCommitOnImplThread(
498 layer_tree_host_impl_.get()); 504 layer_tree_host_impl_.get());
499 505
500 // Remove the LayerTreeHost reference before the completion event is signaled 506 // Remove the LayerTreeHost reference before the completion event is signaled
501 // and cleared. This is necessary since blocked_main_commit() allows access 507 // and cleared. This is necessary since blocked_main_commit() allows access
502 // only while we have the completion event to ensure the main thread is 508 // only while we have the completion event to ensure the main thread is
503 // blocked for a commit. 509 // blocked for a commit.
504 blocked_main_commit().layer_tree_host = nullptr; 510 blocked_main_commit().layer_tree_host = nullptr;
505 511
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { 646 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() {
641 DCHECK(IsMainThreadBlocked() && commit_completion_event_); 647 DCHECK(IsMainThreadBlocked() && commit_completion_event_);
642 return main_thread_blocked_commit_vars_unsafe_; 648 return main_thread_blocked_commit_vars_unsafe_;
643 } 649 }
644 650
645 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { 651 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() {
646 return task_runner_provider_->MainThreadTaskRunner(); 652 return task_runner_provider_->MainThreadTaskRunner();
647 } 653 }
648 654
649 } // namespace cc 655 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698