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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 1412923009: Route touch-events for WebViewGuest directly to guest renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Experiment: run on bots without DCHECK. Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/render_widget_host_view_child_frame.h" 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6 6
7 #include "cc/surfaces/surface.h" 7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_factory.h" 8 #include "cc/surfaces/surface_factory.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "cc/surfaces/surface_sequence.h" 10 #include "cc/surfaces/surface_sequence.h"
(...skipping 15 matching lines...) Expand all
26 26
27 namespace content { 27 namespace content {
28 28
29 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( 29 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
30 RenderWidgetHost* widget_host) 30 RenderWidgetHost* widget_host)
31 : host_(RenderWidgetHostImpl::From(widget_host)), 31 : host_(RenderWidgetHostImpl::From(widget_host)),
32 use_surfaces_(UseSurfacesEnabled()), 32 use_surfaces_(UseSurfacesEnabled()),
33 next_surface_sequence_(1u), 33 next_surface_sequence_(1u),
34 last_output_surface_id_(0), 34 last_output_surface_id_(0),
35 current_surface_scale_factor_(1.f), 35 current_surface_scale_factor_(1.f),
36 has_started_rendering_(false),
36 ack_pending_count_(0), 37 ack_pending_count_(0),
37 frame_connector_(nullptr), 38 frame_connector_(nullptr),
38 weak_factory_(this) { 39 weak_factory_(this) {
39 if (use_surfaces_) { 40 if (use_surfaces_)
40 id_allocator_ = CreateSurfaceIdAllocator(); 41 id_allocator_ = CreateSurfaceIdAllocator();
41 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
42 host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner(
43 GetSurfaceIdNamespace(), this);
44 }
45 }
46 42
47 host_->SetView(this); 43 host_->SetView(this);
48 } 44 }
49 45
50 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { 46 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
51 if (!surface_id_.is_null()) 47 if (!surface_id_.is_null())
52 surface_factory_->Destroy(surface_id_); 48 surface_factory_->Destroy(surface_id_);
53 } 49 }
54 50
55 void RenderWidgetHostViewChildFrame::InitAsChild( 51 void RenderWidgetHostViewChildFrame::InitAsChild(
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // the embedder's renderer to be composited. 256 // the embedder's renderer to be composited.
261 if (!frame->delegated_frame_data || !use_surfaces_) { 257 if (!frame->delegated_frame_data || !use_surfaces_) {
262 frame_connector_->ChildFrameCompositorFrameSwapped( 258 frame_connector_->ChildFrameCompositorFrameSwapped(
263 output_surface_id, 259 output_surface_id,
264 host_->GetProcess()->GetID(), 260 host_->GetProcess()->GetID(),
265 host_->GetRoutingID(), 261 host_->GetRoutingID(),
266 frame.Pass()); 262 frame.Pass());
267 return; 263 return;
268 } 264 }
269 265
266 if (!has_started_rendering_) {
267 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
268 host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner(
tdresser 2015/11/02 15:38:24 It isn't clear to me why this was postponed - is i
kenrb 2015/11/02 16:04:22 I don't really like this, but I understand why it
wjmaclean 2015/11/02 19:23:10 I suppose one alternative would be to leave this r
tdresser 2015/11/02 21:10:19 This seems reasonable to me.
269 GetSurfaceIdNamespace(), this);
270 }
271 has_started_rendering_ = true;
272 }
273
270 cc::RenderPass* root_pass = 274 cc::RenderPass* root_pass =
271 frame->delegated_frame_data->render_pass_list.back(); 275 frame->delegated_frame_data->render_pass_list.back();
272 276
273 gfx::Size frame_size = root_pass->output_rect.size(); 277 gfx::Size frame_size = root_pass->output_rect.size();
274 float scale_factor = frame->metadata.device_scale_factor; 278 float scale_factor = frame->metadata.device_scale_factor;
275 279
276 // Check whether we need to recreate the cc::Surface, which means the child 280 // Check whether we need to recreate the cc::Surface, which means the child
277 // frame renderer has changed its output surface, or size, or scale factor. 281 // frame renderer has changed its output surface, or size, or scale factor.
278 if (output_surface_id != last_output_surface_id_ && surface_factory_) { 282 if (output_surface_id != last_output_surface_id_ && surface_factory_) {
279 surface_factory_->Destroy(surface_id_); 283 surface_factory_->Destroy(surface_id_);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 480 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
477 } 481 }
478 482
479 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { 483 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
480 if (surface_factory_ && !surface_id_.is_null()) 484 if (surface_factory_ && !surface_id_.is_null())
481 surface_factory_->Destroy(surface_id_); 485 surface_factory_->Destroy(surface_id_);
482 surface_id_ = cc::SurfaceId(); 486 surface_id_ = cc::SurfaceId();
483 } 487 }
484 488
485 } // namespace content 489 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698