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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: Plumb pseudo touch-event-rects for OOPIFs to compositor. Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" 5 #include "content/renderer/gpu/render_widget_compositor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 11 matching lines...) Expand all
22 #include "base/sys_info.h" 22 #include "base/sys_info.h"
23 #include "base/task_scheduler/post_task.h" 23 #include "base/task_scheduler/post_task.h"
24 #include "base/task_scheduler/task_scheduler.h" 24 #include "base/task_scheduler/task_scheduler.h"
25 #include "base/task_scheduler/task_traits.h" 25 #include "base/task_scheduler/task_traits.h"
26 #include "base/threading/thread_task_runner_handle.h" 26 #include "base/threading/thread_task_runner_handle.h"
27 #include "base/time/time.h" 27 #include "base/time/time.h"
28 #include "base/values.h" 28 #include "base/values.h"
29 #include "build/build_config.h" 29 #include "build/build_config.h"
30 #include "cc/animation/animation_host.h" 30 #include "cc/animation/animation_host.h"
31 #include "cc/animation/animation_timeline.h" 31 #include "cc/animation/animation_timeline.h"
32 #include "cc/base/region.h"
32 #include "cc/base/switches.h" 33 #include "cc/base/switches.h"
33 #include "cc/blimp/engine_picture_cache.h" 34 #include "cc/blimp/engine_picture_cache.h"
34 #include "cc/blimp/image_serialization_processor.h" 35 #include "cc/blimp/image_serialization_processor.h"
35 #include "cc/blimp/layer_tree_host_remote.h" 36 #include "cc/blimp/layer_tree_host_remote.h"
36 #include "cc/blimp/remote_compositor_bridge.h" 37 #include "cc/blimp/remote_compositor_bridge.h"
37 #include "cc/blink/web_layer_impl.h" 38 #include "cc/blink/web_layer_impl.h"
38 #include "cc/debug/layer_tree_debug_state.h" 39 #include "cc/debug/layer_tree_debug_state.h"
39 #include "cc/debug/micro_benchmark.h" 40 #include "cc/debug/micro_benchmark.h"
40 #include "cc/input/layer_selection_bound.h" 41 #include "cc/input/layer_selection_bound.h"
41 #include "cc/layers/layer.h" 42 #include "cc/layers/layer.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 206 }
206 207
207 RenderWidgetCompositor::RenderWidgetCompositor( 208 RenderWidgetCompositor::RenderWidgetCompositor(
208 RenderWidgetCompositorDelegate* delegate, 209 RenderWidgetCompositorDelegate* delegate,
209 CompositorDependencies* compositor_deps) 210 CompositorDependencies* compositor_deps)
210 : num_failed_recreate_attempts_(0), 211 : num_failed_recreate_attempts_(0),
211 delegate_(delegate), 212 delegate_(delegate),
212 compositor_deps_(compositor_deps), 213 compositor_deps_(compositor_deps),
213 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()), 214 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()),
214 never_visible_(false), 215 never_visible_(false),
216 is_for_oopif_(false),
215 layout_and_paint_async_callback_(nullptr), 217 layout_and_paint_async_callback_(nullptr),
216 remote_proto_channel_receiver_(nullptr), 218 remote_proto_channel_receiver_(nullptr),
217 weak_factory_(this) {} 219 weak_factory_(this) {}
218 220
219 void RenderWidgetCompositor::Initialize(float device_scale_factor, 221 void RenderWidgetCompositor::Initialize(float device_scale_factor,
220 const ScreenInfo& screen_info) { 222 const ScreenInfo& screen_info) {
221 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 223 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
222 cc::LayerTreeSettings settings = GenerateLayerTreeSettings( 224 cc::LayerTreeSettings settings = GenerateLayerTreeSettings(
223 *cmd, compositor_deps_, device_scale_factor, screen_info); 225 *cmd, compositor_deps_, device_scale_factor, screen_info);
224 226
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 "EventListener and WebEventListener enums must match"); 839 "EventListener and WebEventListener enums must match");
838 840
839 void RenderWidgetCompositor::setEventListenerProperties( 841 void RenderWidgetCompositor::setEventListenerProperties(
840 blink::WebEventListenerClass eventClass, 842 blink::WebEventListenerClass eventClass,
841 blink::WebEventListenerProperties properties) { 843 blink::WebEventListenerProperties properties) {
842 layer_tree_host_->GetLayerTree()->SetEventListenerProperties( 844 layer_tree_host_->GetLayerTree()->SetEventListenerProperties(
843 static_cast<cc::EventListenerClass>(eventClass), 845 static_cast<cc::EventListenerClass>(eventClass),
844 static_cast<cc::EventListenerProperties>(properties)); 846 static_cast<cc::EventListenerProperties>(properties));
845 } 847 }
846 848
849 void RenderWidgetCompositor::updateTouchRectsForSubframeIfNecessary() {
850 if (!is_for_oopif_)
851 return;
852
853 // If this is an oopif sub-frame compositor, we won't be getting TouchRects
854 // from ScrollingCoordinator, so to make sure touch events are handled
855 // properly, mark the entire root layer as a TouchRect.
856 // TODO(wjmaclean): remove this when ScrollingCoordinator is made per-frame,
857 // as opposed to per-page.
858 using blink::WebEventListenerProperties;
859 using blink::WebEventListenerClass;
860
861 blink::WebEventListenerProperties touch_start_properties =
862 eventListenerProperties(WebEventListenerClass::TouchStartOrMove);
863 blink::WebEventListenerProperties touch_end_cancel_properties =
864 eventListenerProperties(WebEventListenerClass::TouchEndOrCancel);
865 bool has_touch_handlers =
866 touch_start_properties == WebEventListenerProperties::Blocking ||
867 touch_start_properties ==
868 WebEventListenerProperties::BlockingAndPassive ||
869 touch_end_cancel_properties == WebEventListenerProperties::Blocking ||
870 touch_end_cancel_properties ==
871 WebEventListenerProperties::BlockingAndPassive;
872
873 cc::Layer* root_layer = layer_tree_host_->GetLayerTree()->root_layer();
874 cc::Region touch_handler_region;
875 if (has_touch_handlers)
876 touch_handler_region = gfx::Rect(gfx::Point(), root_layer->bounds());
877 root_layer->SetTouchEventHandlerRegion(touch_handler_region);
878 }
879
847 blink::WebEventListenerProperties 880 blink::WebEventListenerProperties
848 RenderWidgetCompositor::eventListenerProperties( 881 RenderWidgetCompositor::eventListenerProperties(
849 blink::WebEventListenerClass event_class) const { 882 blink::WebEventListenerClass event_class) const {
850 return static_cast<blink::WebEventListenerProperties>( 883 return static_cast<blink::WebEventListenerProperties>(
851 layer_tree_host_->GetLayerTree()->event_listener_properties( 884 layer_tree_host_->GetLayerTree()->event_listener_properties(
852 static_cast<cc::EventListenerClass>(event_class))); 885 static_cast<cc::EventListenerClass>(event_class)));
853 } 886 }
854 887
855 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) { 888 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) {
856 layer_tree_host_->GetLayerTree()->SetHaveScrollEventHandlers(has_handlers); 889 layer_tree_host_->GetLayerTree()->SetHaveScrollEventHandlers(has_handlers);
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( 1169 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor(
1137 float device_scale) { 1170 float device_scale) {
1138 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); 1171 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale);
1139 } 1172 }
1140 1173
1141 void RenderWidgetCompositor::SetDeviceColorSpace( 1174 void RenderWidgetCompositor::SetDeviceColorSpace(
1142 const gfx::ColorSpace& color_space) { 1175 const gfx::ColorSpace& color_space) {
1143 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); 1176 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space);
1144 } 1177 }
1145 1178
1179 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) {
1180 is_for_oopif_ = is_for_oopif;
1181 }
1182
1146 } // namespace content 1183 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698