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

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

Issue 13844021: Move compositor thread input handling logic into content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 rendering_stats_instrumentation)); 152 rendering_stats_instrumentation));
153 } 153 }
154 154
155 LayerTreeHostImpl::LayerTreeHostImpl( 155 LayerTreeHostImpl::LayerTreeHostImpl(
156 const LayerTreeSettings& settings, 156 const LayerTreeSettings& settings,
157 LayerTreeHostImplClient* client, 157 LayerTreeHostImplClient* client,
158 Proxy* proxy, 158 Proxy* proxy,
159 RenderingStatsInstrumentation* rendering_stats_instrumentation) 159 RenderingStatsInstrumentation* rendering_stats_instrumentation)
160 : client_(client), 160 : client_(client),
161 proxy_(proxy), 161 proxy_(proxy),
162 input_handler_client_(NULL),
162 did_lock_scrolling_layer_(false), 163 did_lock_scrolling_layer_(false),
163 should_bubble_scrolls_(false), 164 should_bubble_scrolls_(false),
164 wheel_scrolling_(false), 165 wheel_scrolling_(false),
165 root_layer_scroll_offset_delegate_(NULL), 166 root_layer_scroll_offset_delegate_(NULL),
166 settings_(settings), 167 settings_(settings),
167 overdraw_bottom_height_(0.f), 168 overdraw_bottom_height_(0.f),
168 device_scale_factor_(1.f), 169 device_scale_factor_(1.f),
169 visible_(true), 170 visible_(true),
170 managed_memory_policy_( 171 managed_memory_policy_(
171 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), 172 PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 TRACE_EVENT_OBJECT_CREATED_WITH_ID( 204 TRACE_EVENT_OBJECT_CREATED_WITH_ID(
204 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this); 205 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this);
205 } 206 }
206 207
207 LayerTreeHostImpl::~LayerTreeHostImpl() { 208 LayerTreeHostImpl::~LayerTreeHostImpl() {
208 DCHECK(proxy_->IsImplThread()); 209 DCHECK(proxy_->IsImplThread());
209 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); 210 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()");
210 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 211 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
211 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this); 212 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", this);
212 213
214 if (input_handler_client_) {
215 input_handler_client_->WillShutdown();
216 input_handler_client_ = NULL;
217 }
218
213 if (active_tree_->root_layer()) { 219 if (active_tree_->root_layer()) {
214 ClearRenderSurfaces(); 220 ClearRenderSurfaces();
215 // The layer trees must be destroyed before the layer tree host. We've 221 // The layer trees must be destroyed before the layer tree host. We've
216 // made a contract with our animation controllers that the registrar 222 // made a contract with our animation controllers that the registrar
217 // will outlive them, and we must make good. 223 // will outlive them, and we must make good.
218 recycle_tree_.reset(); 224 recycle_tree_.reset();
219 pending_tree_.reset(); 225 pending_tree_.reset();
220 active_tree_.reset(); 226 active_tree_.reset();
221 } 227 }
222 } 228 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 TRACE_EVENT_INSTANT0( 276 TRACE_EVENT_INSTANT0(
271 "cc", "LayerTreeHostImpl::CanDraw contents textures purged", 277 "cc", "LayerTreeHostImpl::CanDraw contents textures purged",
272 TRACE_EVENT_SCOPE_THREAD); 278 TRACE_EVENT_SCOPE_THREAD);
273 return false; 279 return false;
274 } 280 }
275 return true; 281 return true;
276 } 282 }
277 283
278 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time, 284 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time,
279 base::Time wall_clock_time) { 285 base::Time wall_clock_time) {
286 if (input_handler_client_)
287 input_handler_client_->Animate(monotonic_time);
280 AnimatePageScale(monotonic_time); 288 AnimatePageScale(monotonic_time);
281 AnimateLayers(monotonic_time, wall_clock_time); 289 AnimateLayers(monotonic_time, wall_clock_time);
282 AnimateScrollbars(monotonic_time); 290 AnimateScrollbars(monotonic_time);
283 AnimateTopControls(monotonic_time); 291 AnimateTopControls(monotonic_time);
284 } 292 }
285 293
286 void LayerTreeHostImpl::ManageTiles() { 294 void LayerTreeHostImpl::ManageTiles() {
287 DCHECK(tile_manager_); 295 DCHECK(tile_manager_);
288 tile_manager_->ManageTiles(); 296 tile_manager_->ManageTiles();
289 297
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 if (!output_surface_->ForcedDrawToSoftwareDevice()) 724 if (!output_surface_->ForcedDrawToSoftwareDevice())
717 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); 725 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes);
718 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()), 726 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()),
719 frame); 727 frame);
720 728
721 // If we're making a frame to draw, it better have at least one render pass. 729 // If we're making a frame to draw, it better have at least one render pass.
722 DCHECK(!frame->render_passes.empty()); 730 DCHECK(!frame->render_passes.empty());
723 return draw_frame; 731 return draw_frame;
724 } 732 }
725 733
734 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() {
735 if (input_handler_client_)
736 input_handler_client_->MainThreadHasStoppedFlinging();
737 }
738
726 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( 739 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking(
727 bool should_background_tick) { 740 bool should_background_tick) {
728 bool enabled = should_background_tick && 741 bool enabled = should_background_tick &&
729 !animation_registrar_->active_animation_controllers().empty(); 742 !animation_registrar_->active_animation_controllers().empty();
730 743
731 // Lazily create the time_source adapter so that we can vary the interval for 744 // Lazily create the time_source adapter so that we can vary the interval for
732 // testing. 745 // testing.
733 if (!time_source_client_adapter_) { 746 if (!time_source_client_adapter_) {
734 time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create( 747 time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create(
735 this, 748 this,
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 client_->SetNeedsRedrawOnImplThread(); 1495 client_->SetNeedsRedrawOnImplThread();
1483 active_tree_->set_needs_update_draw_properties(); 1496 active_tree_->set_needs_update_draw_properties();
1484 SetFullRootLayerDamage(); 1497 SetFullRootLayerDamage();
1485 } 1498 }
1486 1499
1487 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { 1500 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() {
1488 active_tree_->UpdateDrawProperties(); 1501 active_tree_->UpdateDrawProperties();
1489 return !active_tree_->RenderSurfaceLayerList().empty(); 1502 return !active_tree_->RenderSurfaceLayerList().empty();
1490 } 1503 }
1491 1504
1505 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) {
1506 DCHECK(input_handler_client_ == NULL);
1507 input_handler_client_ = client;
1508 }
1509
1492 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( 1510 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
1493 gfx::Point viewport_point, InputHandler::ScrollInputType type) { 1511 gfx::Point viewport_point, InputHandler::ScrollInputType type) {
1494 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); 1512 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
1495 1513
1496 if (top_controls_manager_) 1514 if (top_controls_manager_)
1497 top_controls_manager_->ScrollBegin(); 1515 top_controls_manager_->ScrollBegin();
1498 1516
1499 DCHECK(!CurrentlyScrollingLayer()); 1517 DCHECK(!CurrentlyScrollingLayer());
1500 ClearCurrentlyScrollingLayer(); 1518 ClearCurrentlyScrollingLayer();
1501 1519
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 } 2187 }
2170 2188
2171 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 2189 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
2172 if (debug_state_.continuous_painting != debug_state.continuous_painting) 2190 if (debug_state_.continuous_painting != debug_state.continuous_painting)
2173 paint_time_counter_->ClearHistory(); 2191 paint_time_counter_->ClearHistory();
2174 2192
2175 debug_state_ = debug_state; 2193 debug_state_ = debug_state;
2176 } 2194 }
2177 2195
2178 } // namespace cc 2196 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698