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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: Check for layerTreeView while setting handlers. 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) 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 "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #include "ui/base/ui_base_switches.h" 88 #include "ui/base/ui_base_switches.h"
89 #include "ui/gfx/geometry/point_conversions.h" 89 #include "ui/gfx/geometry/point_conversions.h"
90 #include "ui/gfx/geometry/rect_conversions.h" 90 #include "ui/gfx/geometry/rect_conversions.h"
91 #include "ui/gfx/geometry/size_conversions.h" 91 #include "ui/gfx/geometry/size_conversions.h"
92 #include "ui/gfx/skia_util.h" 92 #include "ui/gfx/skia_util.h"
93 #include "ui/gl/gl_switches.h" 93 #include "ui/gl/gl_switches.h"
94 #include "ui/surface/transport_dib.h" 94 #include "ui/surface/transport_dib.h"
95 95
96 #if defined(OS_ANDROID) 96 #if defined(OS_ANDROID)
97 #include <android/keycodes.h> 97 #include <android/keycodes.h>
98 #include "base/time/time.h"
98 #endif 99 #endif
99 100
100 #if defined(OS_POSIX) 101 #if defined(OS_POSIX)
101 #include "third_party/skia/include/core/SkMallocPixelRef.h" 102 #include "third_party/skia/include/core/SkMallocPixelRef.h"
102 #include "third_party/skia/include/core/SkPixelRef.h" 103 #include "third_party/skia/include/core/SkPixelRef.h"
103 #endif // defined(OS_POSIX) 104 #endif // defined(OS_POSIX)
104 105
105 #if defined(USE_AURA) 106 #if defined(USE_AURA)
106 #include "content/public/common/service_manager_connection.h" 107 #include "content/public/common/service_manager_connection.h"
107 #include "content/renderer/mus/render_widget_mus_connection.h" 108 #include "content/renderer/mus/render_widget_mus_connection.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 composition_range_(gfx::Range::InvalidRange()), 374 composition_range_(gfx::Range::InvalidRange()),
374 popup_type_(popup_type), 375 popup_type_(popup_type),
375 pending_window_rect_count_(0), 376 pending_window_rect_count_(0),
376 screen_info_(screen_info), 377 screen_info_(screen_info),
377 device_scale_factor_(screen_info_.device_scale_factor), 378 device_scale_factor_(screen_info_.device_scale_factor),
378 monitor_composition_info_(false), 379 monitor_composition_info_(false),
379 popup_origin_scale_for_emulation_(0.f), 380 popup_origin_scale_for_emulation_(0.f),
380 frame_swap_message_queue_(new FrameSwapMessageQueue()), 381 frame_swap_message_queue_(new FrameSwapMessageQueue()),
381 resizing_mode_selector_(new ResizingModeSelector()), 382 resizing_mode_selector_(new ResizingModeSelector()),
382 has_host_context_menu_location_(false), 383 has_host_context_menu_location_(false),
384 has_added_input_handler_(false),
383 has_focus_(false), 385 has_focus_(false),
384 #if defined(OS_MACOSX) 386 #if defined(OS_MACOSX)
385 text_input_client_observer_(new TextInputClientObserver(this)), 387 text_input_client_observer_(new TextInputClientObserver(this)),
386 #endif 388 #endif
387 focused_pepper_plugin_(nullptr) { 389 focused_pepper_plugin_(nullptr),
390 weak_ptr_factory_(this) {
388 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); 391 DCHECK_NE(routing_id_, MSG_ROUTING_NONE);
389 if (!swapped_out) 392 if (!swapped_out)
390 RenderProcess::current()->AddRefProcess(); 393 RenderProcess::current()->AddRefProcess();
391 DCHECK(RenderThread::Get()); 394 DCHECK(RenderThread::Get());
392 device_color_profile_.push_back('0'); 395 device_color_profile_.push_back('0');
393 396
394 // In tests there may not be a RenderThreadImpl. 397 // In tests there may not be a RenderThreadImpl.
395 if (RenderThreadImpl::current()) { 398 if (RenderThreadImpl::current()) {
396 render_widget_scheduling_state_ = RenderThreadImpl::current() 399 render_widget_scheduling_state_ = RenderThreadImpl::current()
397 ->GetRendererScheduler() 400 ->GetRendererScheduler()
(...skipping 29 matching lines...) Expand all
427 int32_t routing_id = MSG_ROUTING_NONE; 430 int32_t routing_id = MSG_ROUTING_NONE;
428 if (!RenderThreadImpl::current_render_message_filter()->CreateNewWidget( 431 if (!RenderThreadImpl::current_render_message_filter()->CreateNewWidget(
429 opener->GetRoutingID(), popup_type, &routing_id)) { 432 opener->GetRoutingID(), popup_type, &routing_id)) {
430 return nullptr; 433 return nullptr;
431 } 434 }
432 435
433 scoped_refptr<RenderWidget> widget( 436 scoped_refptr<RenderWidget> widget(
434 new RenderWidget(routing_id, compositor_deps, popup_type, screen_info, 437 new RenderWidget(routing_id, compositor_deps, popup_type, screen_info,
435 false, false, false)); 438 false, false, false));
436 ShowCallback opener_callback = 439 ShowCallback opener_callback =
437 base::Bind(&RenderViewImpl::ShowCreatedPopupWidget, opener->AsWeakPtr()); 440 base::Bind(&RenderViewImpl::ShowCreatedPopupWidget, opener->GetWeakPtr());
438 widget->Init(opener_callback, RenderWidget::CreateWebWidget(widget.get())); 441 widget->Init(opener_callback, RenderWidget::CreateWebWidget(widget.get()));
439 DCHECK(!widget->HasOneRef()); // RenderWidget::Init() adds a reference. 442 DCHECK(!widget->HasOneRef()); // RenderWidget::Init() adds a reference.
440 return widget.get(); 443 return widget.get();
441 } 444 }
442 445
443 // static 446 // static
444 RenderWidget* RenderWidget::CreateForFrame( 447 RenderWidget* RenderWidget::CreateForFrame(
445 int widget_routing_id, 448 int widget_routing_id,
446 bool hidden, 449 bool hidden,
447 const ScreenInfo& screen_info, 450 const ScreenInfo& screen_info,
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 // For background pages and certain tests, we don't want to trigger 1236 // For background pages and certain tests, we don't want to trigger
1234 // CompositorFrameSink creation. 1237 // CompositorFrameSink creation.
1235 if (compositor_never_visible_ || !RenderThreadImpl::current()) 1238 if (compositor_never_visible_ || !RenderThreadImpl::current())
1236 compositor_->SetNeverVisible(); 1239 compositor_->SetNeverVisible();
1237 1240
1238 StartCompositor(); 1241 StartCompositor();
1239 DCHECK_NE(MSG_ROUTING_NONE, routing_id_); 1242 DCHECK_NE(MSG_ROUTING_NONE, routing_id_);
1240 compositor_->SetFrameSinkId( 1243 compositor_->SetFrameSinkId(
1241 cc::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_)); 1244 cc::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_));
1242 1245
1246 RenderThreadImpl* render_thread = RenderThreadImpl::current();
1247 // render_thread may be NULL in tests.
1248 InputHandlerManager* input_handler_manager =
1249 render_thread ? render_thread->input_handler_manager() : NULL;
1250 if (input_handler_manager) {
1251 input_handler_manager->AddInputHandler(
1252 routing_id_, compositor()->GetInputHandler(),
1253 weak_ptr_factory_.GetWeakPtr(),
1254 compositor_deps_->IsScrollAnimatorEnabled());
1255 has_added_input_handler_ = true;
1256 }
1257
1243 return compositor_.get(); 1258 return compositor_.get();
1244 } 1259 }
1245 1260
1246 void RenderWidget::WillCloseLayerTreeView() { 1261 void RenderWidget::WillCloseLayerTreeView() {
1247 if (host_closing_) 1262 if (host_closing_)
1248 return; 1263 return;
1249 1264
1250 // Prevent new compositors or output surfaces from being created. 1265 // Prevent new compositors or output surfaces from being created.
1251 host_closing_ = true; 1266 host_closing_ = true;
1252 1267
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 // browser side (https://crbug.com/669219). 2289 // browser side (https://crbug.com/669219).
2275 // If there is no WebFrameWidget, then there will be no 2290 // If there is no WebFrameWidget, then there will be no
2276 // InputMethodControllers for a WebLocalFrame. 2291 // InputMethodControllers for a WebLocalFrame.
2277 return nullptr; 2292 return nullptr;
2278 } 2293 }
2279 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) 2294 return static_cast<blink::WebFrameWidget*>(GetWebWidget())
2280 ->getActiveWebInputMethodController(); 2295 ->getActiveWebInputMethodController();
2281 } 2296 }
2282 2297
2283 } // namespace content 2298 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698