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

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

Issue 1602343002: compositor-worker: cc->blink mutation plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor-worker-ian-patch
Patch Set: Merge master + s/scoped_ptr/unique_ptr/ Created 4 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/proxy_common.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/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <limits> 11 #include <limits>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <unordered_map> 14 #include <unordered_map>
15 #include <utility> 15 #include <utility>
16 16
17 #include "base/auto_reset.h" 17 #include "base/auto_reset.h"
18 #include "base/bind.h"
18 #include "base/containers/small_map.h" 19 #include "base/containers/small_map.h"
19 #include "base/json/json_writer.h" 20 #include "base/json/json_writer.h"
20 #include "base/memory/ptr_util.h" 21 #include "base/memory/ptr_util.h"
21 #include "base/metrics/histogram.h" 22 #include "base/metrics/histogram.h"
22 #include "base/numerics/safe_conversions.h" 23 #include "base/numerics/safe_conversions.h"
23 #include "base/stl_util.h" 24 #include "base/stl_util.h"
24 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
25 #include "base/trace_event/trace_event_argument.h" 26 #include "base/trace_event/trace_event_argument.h"
26 #include "cc/animation/animation_events.h" 27 #include "cc/animation/animation_events.h"
27 #include "cc/animation/animation_host.h" 28 #include "cc/animation/animation_host.h"
29 #include "cc/animation/animation_id_provider.h"
30 #include "cc/animation/scroll_offset_animation_curve.h"
28 #include "cc/animation/timing_function.h" 31 #include "cc/animation/timing_function.h"
29 #include "cc/base/histograms.h" 32 #include "cc/base/histograms.h"
30 #include "cc/base/math_util.h" 33 #include "cc/base/math_util.h"
31 #include "cc/debug/benchmark_instrumentation.h" 34 #include "cc/debug/benchmark_instrumentation.h"
32 #include "cc/debug/debug_rect_history.h" 35 #include "cc/debug/debug_rect_history.h"
33 #include "cc/debug/devtools_instrumentation.h" 36 #include "cc/debug/devtools_instrumentation.h"
34 #include "cc/debug/frame_rate_counter.h" 37 #include "cc/debug/frame_rate_counter.h"
35 #include "cc/debug/frame_viewer_instrumentation.h" 38 #include "cc/debug/frame_viewer_instrumentation.h"
36 #include "cc/debug/rendering_stats_instrumentation.h" 39 #include "cc/debug/rendering_stats_instrumentation.h"
37 #include "cc/debug/traced_value.h" 40 #include "cc/debug/traced_value.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 output_is_secure_(false), 233 output_is_secure_(false),
231 animation_host_(), 234 animation_host_(),
232 rendering_stats_instrumentation_(rendering_stats_instrumentation), 235 rendering_stats_instrumentation_(rendering_stats_instrumentation),
233 micro_benchmark_controller_(this), 236 micro_benchmark_controller_(this),
234 shared_bitmap_manager_(shared_bitmap_manager), 237 shared_bitmap_manager_(shared_bitmap_manager),
235 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 238 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
236 task_graph_runner_(task_graph_runner), 239 task_graph_runner_(task_graph_runner),
237 id_(id), 240 id_(id),
238 requires_high_res_to_draw_(false), 241 requires_high_res_to_draw_(false),
239 is_likely_to_require_a_draw_(false), 242 is_likely_to_require_a_draw_(false),
240 frame_timing_tracker_(FrameTimingTracker::Create(this)) { 243 frame_timing_tracker_(FrameTimingTracker::Create(this)),
244 mutator_(nullptr) {
241 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL); 245 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL);
242 animation_host_->SetMutatorHostClient(this); 246 animation_host_->SetMutatorHostClient(this);
243 animation_host_->SetSupportsScrollAnimations(SupportsImplScrolling()); 247 animation_host_->SetSupportsScrollAnimations(SupportsImplScrolling());
244 248
245 DCHECK(task_runner_provider_->IsImplThread()); 249 DCHECK(task_runner_provider_->IsImplThread());
246 DidVisibilityChange(this, visible_); 250 DidVisibilityChange(this, visible_);
247 251
248 SetDebugState(settings.initial_debug_state); 252 SetDebugState(settings.initial_debug_state);
249 253
250 // LTHI always has an active tree. 254 // LTHI always has an active tree.
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 request_ids, start_time, end_time, active_tree_->source_frame_number()); 2251 request_ids, start_time, end_time, active_tree_->source_frame_number());
2248 } 2252 }
2249 2253
2250 void LayerTreeHostImpl::PostFrameTimingEvents( 2254 void LayerTreeHostImpl::PostFrameTimingEvents(
2251 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 2255 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
2252 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 2256 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
2253 client_->PostFrameTimingEventsOnImplThread(std::move(composite_events), 2257 client_->PostFrameTimingEventsOnImplThread(std::move(composite_events),
2254 std::move(main_frame_events)); 2258 std::move(main_frame_events));
2255 } 2259 }
2256 2260
2261 void LayerTreeHostImpl::SetLayerTreeMutator(LayerTreeMutator* mutator) {
2262 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
2263 "LayerTreeHostImpl::SetLayerTreeMutator");
2264 mutator_ = mutator;
2265 }
2266
2257 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() { 2267 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
2258 ClearUIResources(); 2268 ClearUIResources();
2259 tile_manager_->FinishTasksAndCleanUp(); 2269 tile_manager_->FinishTasksAndCleanUp();
2260 resource_pool_ = nullptr; 2270 resource_pool_ = nullptr;
2261 tile_task_worker_pool_ = nullptr; 2271 tile_task_worker_pool_ = nullptr;
2262 single_thread_synchronous_task_graph_runner_ = nullptr; 2272 single_thread_synchronous_task_graph_runner_ = nullptr;
2263 image_decode_controller_ = nullptr; 2273 image_decode_controller_ = nullptr;
2264 } 2274 }
2265 2275
2266 void LayerTreeHostImpl::ReleaseOutputSurface() { 2276 void LayerTreeHostImpl::ReleaseOutputSurface() {
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 viewport()->PinchEnd(); 3313 viewport()->PinchEnd();
3304 top_controls_manager_->PinchEnd(); 3314 top_controls_manager_->PinchEnd();
3305 client_->SetNeedsCommitOnImplThread(); 3315 client_->SetNeedsCommitOnImplThread();
3306 // When a pinch ends, we may be displaying content cached at incorrect scales, 3316 // When a pinch ends, we may be displaying content cached at incorrect scales,
3307 // so updating draw properties and drawing will ensure we are using the right 3317 // so updating draw properties and drawing will ensure we are using the right
3308 // scales that we want when we're not inside a pinch. 3318 // scales that we want when we're not inside a pinch.
3309 active_tree_->set_needs_update_draw_properties(); 3319 active_tree_->set_needs_update_draw_properties();
3310 SetNeedsRedraw(); 3320 SetNeedsRedraw();
3311 } 3321 }
3312 3322
3323 std::unique_ptr<BeginFrameCallbackList>
3324 LayerTreeHostImpl::ProcessLayerTreeMutations() {
3325 auto callbacks = make_scoped_ptr(new BeginFrameCallbackList());
3326 if (mutator_) {
3327 const base::Closure& callback = mutator_->TakeMutations();
3328 if (!callback.is_null())
3329 callbacks->push_back(callback);
3330 }
3331 return callbacks;
3332 }
3333
3313 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, 3334 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
3314 LayerImpl* root_layer) { 3335 LayerImpl* root_layer) {
3315 if (!root_layer) 3336 if (!root_layer)
3316 return; 3337 return;
3317 3338
3318 return root_layer->layer_tree_impl() 3339 return root_layer->layer_tree_impl()
3319 ->property_trees() 3340 ->property_trees()
3320 ->scroll_tree.CollectScrollDeltas(scroll_info); 3341 ->scroll_tree.CollectScrollDeltas(scroll_info);
3321 } 3342 }
3322 3343
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3942 return task_runner_provider_->HasImplThread(); 3963 return task_runner_provider_->HasImplThread();
3943 } 3964 }
3944 3965
3945 bool LayerTreeHostImpl::CommitToActiveTree() const { 3966 bool LayerTreeHostImpl::CommitToActiveTree() const {
3946 // In single threaded mode we skip the pending tree and commit directly to the 3967 // In single threaded mode we skip the pending tree and commit directly to the
3947 // active tree. 3968 // active tree.
3948 return !task_runner_provider_->HasImplThread(); 3969 return !task_runner_provider_->HasImplThread();
3949 } 3970 }
3950 3971
3951 } // namespace cc 3972 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/proxy_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698