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

Side by Side Diff: ui/compositor/compositor.cc

Issue 2197503002: Route Scroll events through a cc::InputHandler Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollWheelAsScrollEvent
Patch Set: Abandon DeliverInputForBeginFrame: will not help fix the header row Created 4 years 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 | « ui/compositor/compositor.h ('k') | ui/compositor/layer.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/compositor.h" 5 #include "ui/compositor/compositor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <deque> 10 #include <deque>
(...skipping 21 matching lines...) Expand all
32 #include "cc/surfaces/surface_manager.h" 32 #include "cc/surfaces/surface_manager.h"
33 #include "cc/trees/layer_tree_host_in_process.h" 33 #include "cc/trees/layer_tree_host_in_process.h"
34 #include "cc/trees/layer_tree_settings.h" 34 #include "cc/trees/layer_tree_settings.h"
35 #include "third_party/skia/include/core/SkBitmap.h" 35 #include "third_party/skia/include/core/SkBitmap.h"
36 #include "ui/compositor/compositor_observer.h" 36 #include "ui/compositor/compositor_observer.h"
37 #include "ui/compositor/compositor_switches.h" 37 #include "ui/compositor/compositor_switches.h"
38 #include "ui/compositor/compositor_vsync_manager.h" 38 #include "ui/compositor/compositor_vsync_manager.h"
39 #include "ui/compositor/dip_util.h" 39 #include "ui/compositor/dip_util.h"
40 #include "ui/compositor/layer.h" 40 #include "ui/compositor/layer.h"
41 #include "ui/compositor/layer_animator_collection.h" 41 #include "ui/compositor/layer_animator_collection.h"
42 #include "ui/compositor/overscroll/ui_scroll_input_manager.h"
42 #include "ui/gl/gl_switches.h" 43 #include "ui/gl/gl_switches.h"
43 44
44 namespace { 45 namespace {
45 46
46 const double kDefaultRefreshRate = 60.0; 47 const double kDefaultRefreshRate = 60.0;
47 const double kTestRefreshRate = 200.0; 48 const double kTestRefreshRate = 200.0;
48 49
49 } // namespace 50 } // namespace
50 51
51 namespace ui { 52 namespace ui {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 177 }
177 178
178 // Note: Only enable image decode tasks if we have more than one worker 179 // Note: Only enable image decode tasks if we have more than one worker
179 // thread. 180 // thread.
180 settings.image_decode_tasks_enabled = false; 181 settings.image_decode_tasks_enabled = false;
181 182
182 settings.gpu_memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; 183 settings.gpu_memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024;
183 settings.gpu_memory_policy.priority_cutoff_when_visible = 184 settings.gpu_memory_policy.priority_cutoff_when_visible =
184 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 185 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
185 186
187 #if defined(OS_MACOSX)
188 settings.enable_elastic_overscroll = true;
189 #endif
190
186 base::TimeTicks before_create = base::TimeTicks::Now(); 191 base::TimeTicks before_create = base::TimeTicks::Now();
187 192
188 animation_host_ = cc::AnimationHost::CreateMainInstance(); 193 animation_host_ = cc::AnimationHost::CreateMainInstance();
189 194
190 cc::LayerTreeHostInProcess::InitParams params; 195 cc::LayerTreeHostInProcess::InitParams params;
191 params.client = this; 196 params.client = this;
192 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); 197 params.task_graph_runner = context_factory_->GetTaskGraphRunner();
193 params.settings = &settings; 198 params.settings = &settings;
194 params.main_task_runner = task_runner_; 199 params.main_task_runner = task_runner_;
195 params.mutator_host = animation_host_.get(); 200 params.mutator_host = animation_host_.get();
196 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, &params); 201 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, &params);
202
203 // Tie composited scrolling with whether the platform wants elastic scrolling.
204 // TODO(tapted): Use composited scrolling on all platforms.
205 if (settings.enable_elastic_overscroll) {
206 scroll_input_manager_.reset(
207 new UIScrollInputManager(host_->GetInputHandler()));
208 }
209
197 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", 210 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
198 base::TimeTicks::Now() - before_create); 211 base::TimeTicks::Now() - before_create);
199 212
200 animation_timeline_ = 213 animation_timeline_ =
201 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); 214 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId());
202 animation_host_->AddAnimationTimeline(animation_timeline_.get()); 215 animation_host_->AddAnimationTimeline(animation_timeline_.get());
203 216
204 host_->GetLayerTree()->SetRootLayer(root_web_layer_); 217 host_->GetLayerTree()->SetRootLayer(root_web_layer_);
205 host_->SetFrameSinkId(frame_sink_id_); 218 host_->SetFrameSinkId(frame_sink_id_);
206 host_->SetVisible(true); 219 host_->SetVisible(true);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 for (auto& observer : observer_list_) 539 for (auto& observer : observer_list_)
527 observer.OnCompositingLockStateChanged(this); 540 observer.OnCompositingLockStateChanged(this);
528 } 541 }
529 542
530 void Compositor::CancelCompositorLock() { 543 void Compositor::CancelCompositorLock() {
531 if (compositor_lock_) 544 if (compositor_lock_)
532 compositor_lock_->CancelLock(); 545 compositor_lock_->CancelLock();
533 } 546 }
534 547
535 } // namespace ui 548 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698