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

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

Issue 14960006: cc: Don't do CompositeAndReadback when using DelegatingRenderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/single_thread_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/base/thread.h" 10 #include "cc/base/thread.h"
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 // to produce a frame, as the calling site on main thread is blocked until its 906 // to produce a frame, as the calling site on main thread is blocked until its
907 // request completes, and we signal completion here. If CanDraw() is false, we 907 // request completes, and we signal completion here. If CanDraw() is false, we
908 // will indicate success=false to the caller, but we must still signal 908 // will indicate success=false to the caller, but we must still signal
909 // completion to avoid deadlock. 909 // completion to avoid deadlock.
910 910
911 // We guard PrepareToDraw() with CanDraw() because it always returns a valid 911 // We guard PrepareToDraw() with CanDraw() because it always returns a valid
912 // frame, so can only be used when such a frame is possible. Since 912 // frame, so can only be used when such a frame is possible. Since
913 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on 913 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
914 // CanDraw() as well. 914 // CanDraw() as well.
915 915
916 // If it is a forced draw, make sure we do a draw and swap. 916 bool drawing_for_readback = !!readback_request_on_impl_thread_;
917 gfx::Rect readback_rect; 917 bool can_do_readback = layer_tree_host_impl_->renderer()->CanReadPixels();
918 if (readback_request_on_impl_thread_)
919 readback_rect = readback_request_on_impl_thread_->rect;
920 918
921 LayerTreeHostImpl::FrameData frame; 919 LayerTreeHostImpl::FrameData frame;
922 bool draw_frame = false; 920 bool draw_frame = false;
923 bool start_ready_animations = true; 921 bool start_ready_animations = true;
924 922
925 if (layer_tree_host_impl_->CanDraw()) { 923 if (layer_tree_host_impl_->CanDraw() &&
924 (!drawing_for_readback || can_do_readback)) {
925 // If it is for a readback, make sure we draw the portion being read back.
926 gfx::Rect readback_rect;
927 if (drawing_for_readback)
928 readback_rect = readback_request_on_impl_thread_->rect;
929
926 // Do not start animations if we skip drawing the frame to avoid 930 // Do not start animations if we skip drawing the frame to avoid
927 // checkerboarding. 931 // checkerboarding.
928 if (layer_tree_host_impl_->PrepareToDraw(&frame, readback_rect) || 932 if (layer_tree_host_impl_->PrepareToDraw(&frame, readback_rect) ||
929 forced_draw) 933 forced_draw)
930 draw_frame = true; 934 draw_frame = true;
931 else 935 else
932 start_ready_animations = false; 936 start_ready_animations = false;
933 } 937 }
934 938
935 if (draw_frame) { 939 if (draw_frame) {
(...skipping 17 matching lines...) Expand all
953 } 957 }
954 958
955 // Check for a pending CompositeAndReadback. 959 // Check for a pending CompositeAndReadback.
956 if (readback_request_on_impl_thread_) { 960 if (readback_request_on_impl_thread_) {
957 readback_request_on_impl_thread_->success = false; 961 readback_request_on_impl_thread_->success = false;
958 if (draw_frame) { 962 if (draw_frame) {
959 layer_tree_host_impl_->Readback(readback_request_on_impl_thread_->pixels, 963 layer_tree_host_impl_->Readback(readback_request_on_impl_thread_->pixels,
960 readback_request_on_impl_thread_->rect); 964 readback_request_on_impl_thread_->rect);
961 readback_request_on_impl_thread_->success = 965 readback_request_on_impl_thread_->success =
962 !layer_tree_host_impl_->IsContextLost(); 966 !layer_tree_host_impl_->IsContextLost();
963 } 967 }
piman 2013/05/09 22:07:31 else readback_request_on_impl_thread_->success = f
danakj 2013/05/09 22:14:51 This is set on 961 just before the if, so that see
piman 2013/05/09 22:18:04 Oh, thanks... missed that.
danakj 2013/05/09 22:18:47 Np :) TBH I didn't see it first round and just tho
964 readback_request_on_impl_thread_->completion.Signal(); 968 readback_request_on_impl_thread_->completion.Signal();
965 readback_request_on_impl_thread_ = NULL; 969 readback_request_on_impl_thread_ = NULL;
966 } else if (draw_frame) { 970 } else if (draw_frame) {
967 result.did_swap = layer_tree_host_impl_->SwapBuffers(frame); 971 result.did_swap = layer_tree_host_impl_->SwapBuffers(frame);
968 972
969 if (frame.contains_incomplete_tile) 973 if (frame.contains_incomplete_tile)
970 DidSwapUseIncompleteTileOnImplThread(); 974 DidSwapUseIncompleteTileOnImplThread();
971 } 975 }
972 976
973 // Tell the main thread that the the newly-commited frame was drawn. 977 // Tell the main thread that the the newly-commited frame was drawn.
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 1378
1375 void ThreadProxy::DidReceiveLastInputEventForVSync( 1379 void ThreadProxy::DidReceiveLastInputEventForVSync(
1376 base::TimeTicks frame_time) { 1380 base::TimeTicks frame_time) {
1377 if (render_vsync_notification_enabled_) { 1381 if (render_vsync_notification_enabled_) {
1378 TRACE_EVENT0("cc", "ThreadProxy::DidReceiveLastInputEventForVSync"); 1382 TRACE_EVENT0("cc", "ThreadProxy::DidReceiveLastInputEventForVSync");
1379 DidVSync(frame_time); 1383 DidVSync(frame_time);
1380 } 1384 }
1381 } 1385 }
1382 1386
1383 } // namespace cc 1387 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698