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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: update Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 0386145c7c55fea08e4f34362dd5f3536b1b1a02..eee1538c8bbc0b734b8a69ea57dc0c63a3210a57 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -204,12 +204,7 @@ void SingleThreadProxy::DoCommit() {
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->DidCommit();
- // Issue decode callbacks.
- auto completed_decode_callbacks =
- layer_tree_host_impl_->TakeCompletedImageDecodeCallbacks();
- for (auto& callback : completed_decode_callbacks)
- callback.Run();
-
+ IssueImageDecodeFinishedCallbacks();
layer_tree_host_impl_->CommitComplete();
// Commit goes directly to the active tree, but we need to synchronously
@@ -221,6 +216,15 @@ void SingleThreadProxy::DoCommit() {
}
}
+void SingleThreadProxy::IssueImageDecodeFinishedCallbacks() {
+ DCHECK(task_runner_provider_->IsImplThread());
+
+ auto completed_decode_callbacks =
+ layer_tree_host_impl_->TakeCompletedImageDecodeCallbacks();
+ for (auto& callback : completed_decode_callbacks)
+ callback.Run();
+}
+
void SingleThreadProxy::CommitComplete() {
// Commit complete happens on the main side after activate to satisfy any
// SetNextCommitWaitsForActivation calls.
@@ -438,6 +442,19 @@ void SingleThreadProxy::NeedsImplSideInvalidation() {
scheduler_on_impl_thread_->SetNeedsImplSideInvalidation();
}
+void SingleThreadProxy::NotifyImageDecodeRequestFinished() {
+ // If we don't have a scheduler, then just issue the callbacks here.
+ // Otherwise, schedule a commit.
+ if (!scheduler_on_impl_thread_) {
+ DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
+ DebugScopedSetImplThread impl(task_runner_provider_);
+
+ IssueImageDecodeFinishedCallbacks();
+ return;
+ }
+ SetNeedsCommitOnImplThread();
+}
+
void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately");
DCHECK(task_runner_provider_->IsMainThread());

Powered by Google App Engine
This is Rietveld 408576698