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

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

Issue 1194743002: cc: Remove ResourceUpdateQueue and ResourceUpdateController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resourcequeue: header Created 5 years, 6 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
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | 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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/profiler/scoped_tracker.h" 8 #include "base/profiler/scoped_tracker.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/debug/benchmark_instrumentation.h" 10 #include "cc/debug/benchmark_instrumentation.h"
11 #include "cc/debug/devtools_instrumentation.h" 11 #include "cc/debug/devtools_instrumentation.h"
12 #include "cc/output/context_provider.h" 12 #include "cc/output/context_provider.h"
13 #include "cc/output/output_surface.h" 13 #include "cc/output/output_surface.h"
14 #include "cc/quads/draw_quad.h" 14 #include "cc/quads/draw_quad.h"
15 #include "cc/resources/prioritized_resource_manager.h" 15 #include "cc/resources/prioritized_resource_manager.h"
16 #include "cc/resources/resource_update_controller.h"
17 #include "cc/scheduler/commit_earlyout_reason.h" 16 #include "cc/scheduler/commit_earlyout_reason.h"
18 #include "cc/trees/layer_tree_host.h" 17 #include "cc/trees/layer_tree_host.h"
19 #include "cc/trees/layer_tree_host_single_thread_client.h" 18 #include "cc/trees/layer_tree_host_single_thread_client.h"
20 #include "cc/trees/layer_tree_impl.h" 19 #include "cc/trees/layer_tree_impl.h"
21 #include "cc/trees/scoped_abort_remaining_swap_promises.h" 20 #include "cc/trees/scoped_abort_remaining_swap_promises.h"
22 21
23 namespace cc { 22 namespace cc {
24 23
25 scoped_ptr<Proxy> SingleThreadProxy::Create( 24 scoped_ptr<Proxy> SingleThreadProxy::Create(
26 LayerTreeHost* layer_tree_host, 25 LayerTreeHost* layer_tree_host,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // called since that goes out to the embedder, and we want the embedder 236 // called since that goes out to the embedder, and we want the embedder
238 // to receive its callbacks before that. 237 // to receive its callbacks before that.
239 commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks( 238 commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks(
240 blocking_main_thread_task_runner())); 239 blocking_main_thread_task_runner()));
241 240
242 layer_tree_host_impl_->BeginCommit(); 241 layer_tree_host_impl_->BeginCommit();
243 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); 242 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get());
244 243
245 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 244 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
246 // is fixed. 245 // is fixed.
247 tracked_objects::ScopedTracker tracking_profile4(
248 FROM_HERE_WITH_EXPLICIT_FUNCTION(
249 "461509 SingleThreadProxy::DoCommit4"));
250 scoped_ptr<ResourceUpdateController> update_controller =
251 ResourceUpdateController::Create(
252 NULL,
253 MainThreadTaskRunner(),
254 queue_for_commit_.Pass(),
255 layer_tree_host_impl_->resource_provider());
256
257 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
258 // is fixed.
259 tracked_objects::ScopedTracker tracking_profile5(
260 FROM_HERE_WITH_EXPLICIT_FUNCTION(
261 "461509 SingleThreadProxy::DoCommit5"));
262 update_controller->Finalize();
263
264 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
265 // is fixed.
266 tracked_objects::ScopedTracker tracking_profile6( 246 tracked_objects::ScopedTracker tracking_profile6(
267 FROM_HERE_WITH_EXPLICIT_FUNCTION( 247 FROM_HERE_WITH_EXPLICIT_FUNCTION(
268 "461509 SingleThreadProxy::DoCommit6")); 248 "461509 SingleThreadProxy::DoCommit6"));
269 if (layer_tree_host_impl_->EvictedUIResourcesExist()) 249 if (layer_tree_host_impl_->EvictedUIResourcesExist())
270 layer_tree_host_->RecreateUIResources(); 250 layer_tree_host_->RecreateUIResources();
271 251
272 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 252 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
273 // is fixed. 253 // is fixed.
274 tracked_objects::ScopedTracker tracking_profile7( 254 tracked_objects::ScopedTracker tracking_profile7(
275 FROM_HERE_WITH_EXPLICIT_FUNCTION( 255 FROM_HERE_WITH_EXPLICIT_FUNCTION(
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 354
375 bool SingleThreadProxy::BeginMainFrameRequested() const { 355 bool SingleThreadProxy::BeginMainFrameRequested() const {
376 DCHECK(Proxy::IsMainThread()); 356 DCHECK(Proxy::IsMainThread());
377 // If there is no scheduler, then there can be no pending begin frame, 357 // If there is no scheduler, then there can be no pending begin frame,
378 // as all frames are all manually initiated by the embedder of cc. 358 // as all frames are all manually initiated by the embedder of cc.
379 if (!scheduler_on_impl_thread_) 359 if (!scheduler_on_impl_thread_)
380 return false; 360 return false;
381 return commit_requested_; 361 return commit_requested_;
382 } 362 }
383 363
384 size_t SingleThreadProxy::MaxPartialTextureUpdates() const {
385 return std::numeric_limits<size_t>::max();
386 }
387
388 void SingleThreadProxy::Stop() { 364 void SingleThreadProxy::Stop() {
389 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); 365 TRACE_EVENT0("cc", "SingleThreadProxy::stop");
390 DCHECK(Proxy::IsMainThread()); 366 DCHECK(Proxy::IsMainThread());
391 { 367 {
392 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 368 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
393 DebugScopedSetImplThread impl(this); 369 DebugScopedSetImplThread impl(this);
394 370
395 BlockingTaskRunner::CapturePostTasks blocked( 371 BlockingTaskRunner::CapturePostTasks blocked(
396 blocking_main_thread_task_runner()); 372 blocking_main_thread_task_runner());
397 scheduler_on_impl_thread_ = nullptr; 373 scheduler_on_impl_thread_ = nullptr;
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 DoBeginMainFrame(begin_frame_args); 827 DoBeginMainFrame(begin_frame_args);
852 } 828 }
853 829
854 void SingleThreadProxy::DoBeginMainFrame( 830 void SingleThreadProxy::DoBeginMainFrame(
855 const BeginFrameArgs& begin_frame_args) { 831 const BeginFrameArgs& begin_frame_args) {
856 layer_tree_host_->WillBeginMainFrame(); 832 layer_tree_host_->WillBeginMainFrame();
857 layer_tree_host_->BeginMainFrame(begin_frame_args); 833 layer_tree_host_->BeginMainFrame(begin_frame_args);
858 layer_tree_host_->AnimateLayers(begin_frame_args.frame_time); 834 layer_tree_host_->AnimateLayers(begin_frame_args.frame_time);
859 layer_tree_host_->Layout(); 835 layer_tree_host_->Layout();
860 836
861 DCHECK(!queue_for_commit_);
862 queue_for_commit_ = make_scoped_ptr(new ResourceUpdateQueue);
863
864 // New commits requested inside UpdateLayers should be respected. 837 // New commits requested inside UpdateLayers should be respected.
865 commit_requested_ = false; 838 commit_requested_ = false;
866 839
867 layer_tree_host_->UpdateLayers(); 840 layer_tree_host_->UpdateLayers();
868 841
869 timing_history_.DidBeginMainFrame(); 842 timing_history_.DidBeginMainFrame();
870 843
871 // TODO(enne): SingleThreadProxy does not support cancelling commits yet, 844 // TODO(enne): SingleThreadProxy does not support cancelling commits yet,
872 // search for CommitEarlyOutReason::FINISHED_NO_UPDATES inside 845 // search for CommitEarlyOutReason::FINISHED_NO_UPDATES inside
873 // thread_proxy.cc 846 // thread_proxy.cc
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); 905 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles");
933 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); 906 DCHECK(layer_tree_host_impl_->settings().impl_side_painting);
934 DebugScopedSetImplThread impl(this); 907 DebugScopedSetImplThread impl(this);
935 layer_tree_host_impl_->PrepareTiles(); 908 layer_tree_host_impl_->PrepareTiles();
936 } 909 }
937 910
938 void SingleThreadProxy::ScheduledActionInvalidateOutputSurface() { 911 void SingleThreadProxy::ScheduledActionInvalidateOutputSurface() {
939 NOTREACHED(); 912 NOTREACHED();
940 } 913 }
941 914
942 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) {
943 }
944
945 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { 915 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() {
946 return timing_history_.DrawDurationEstimate(); 916 return timing_history_.DrawDurationEstimate();
947 } 917 }
948 918
949 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { 919 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() {
950 return timing_history_.BeginMainFrameToCommitDurationEstimate(); 920 return timing_history_.BeginMainFrameToCommitDurationEstimate();
951 } 921 }
952 922
953 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { 923 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() {
954 return timing_history_.CommitToActivateDurationEstimate(); 924 return timing_history_.CommitToActivateDurationEstimate();
955 } 925 }
956 926
957 void SingleThreadProxy::DidFinishImplFrame() { 927 void SingleThreadProxy::DidFinishImplFrame() {
958 layer_tree_host_impl_->DidFinishImplFrame(); 928 layer_tree_host_impl_->DidFinishImplFrame();
959 #if DCHECK_IS_ON() 929 #if DCHECK_IS_ON()
960 DCHECK(inside_impl_frame_) 930 DCHECK(inside_impl_frame_)
961 << "DidFinishImplFrame called while not inside an impl frame!"; 931 << "DidFinishImplFrame called while not inside an impl frame!";
962 inside_impl_frame_ = false; 932 inside_impl_frame_ = false;
963 #endif 933 #endif
964 } 934 }
965 935
966 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 936 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
967 layer_tree_host_->SendBeginFramesToChildren(args); 937 layer_tree_host_->SendBeginFramesToChildren(args);
968 } 938 }
969 939
970 } // namespace cc 940 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698