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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2656893003: Let DelegateFrameHost in Mac and Android use correct FrameSinkId during creation (Closed)
Patch Set: nits 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/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <objc/runtime.h> 8 #import <objc/runtime.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 #include <QuartzCore/QuartzCore.h> 10 #include <QuartzCore/QuartzCore.h>
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 // Paint this view host with |background_color_| when there is no content 462 // Paint this view host with |background_color_| when there is no content
463 // ready to draw. 463 // ready to draw.
464 background_layer_.reset([[CALayer alloc] init]); 464 background_layer_.reset([[CALayer alloc] init]);
465 // Set the default color to be white. This is the wrong thing to do, but many 465 // Set the default color to be white. This is the wrong thing to do, but many
466 // UI components expect this view to be opaque. 466 // UI components expect this view to be opaque.
467 [background_layer_ setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; 467 [background_layer_ setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
468 [cocoa_view_ setLayer:background_layer_]; 468 [cocoa_view_ setLayer:background_layer_];
469 [cocoa_view_ setWantsLayer:YES]; 469 [cocoa_view_ setWantsLayer:YES];
470 470
471 browser_compositor_.reset(new BrowserCompositorMac( 471 // GuestViews have two RenderWidgetHostViews and so we need to make sure
boliu 2017/01/26 00:14:39 can you explain a bit how this works? will both RW
xlai (Olivia) 2017/01/26 15:56:11 I copied this comment and the same piece of code f
Fady Samuel 2017/01/26 16:06:36 guest_view_hack a flag used for the BrowserPlugin
boliu 2017/01/26 19:24:46 Same question here, how do we know AllocateFrameSi
xlai (Olivia) 2017/01/26 20:50:21 Mac is using GPUProcessTransportFactory so it's sa
472 this, this, render_widget_host_->is_hidden(), [cocoa_view_ window])); 472 // we don't have FrameSinkId collisions.
473 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
474 cc::FrameSinkId frame_sink_id =
475 is_guest_view_hack_
476 ? factory->GetContextFactoryPrivate()->AllocateFrameSinkId()
477 : cc::FrameSinkId(base::checked_cast<uint32_t>(
478 render_widget_host_->GetProcess()->GetID()),
479 base::checked_cast<uint32_t>(
480 render_widget_host_->GetRoutingID()));
481 browser_compositor_.reset(
482 new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(),
483 [cocoa_view_ window], frame_sink_id));
473 484
474 display::Screen::GetScreen()->AddObserver(this); 485 display::Screen::GetScreen()->AddObserver(this);
475 486
476 if (!is_guest_view_hack_) 487 if (!is_guest_view_hack_)
477 render_widget_host_->SetView(this); 488 render_widget_host_->SetView(this);
478 489
479 // Let the page-level input event router know about our surface ID 490 // Let the page-level input event router know about our surface ID
480 // namespace for surface-based hit testing. 491 // namespace for surface-based hit testing.
481 if (render_widget_host_->delegate() && 492 if (render_widget_host_->delegate() &&
482 render_widget_host_->delegate()->GetInputEventRouter()) { 493 render_widget_host_->delegate()->GetInputEventRouter()) {
(...skipping 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 3456
3446 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3457 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3447 // regions that are not draggable. (See ControlRegionView in 3458 // regions that are not draggable. (See ControlRegionView in
3448 // native_app_window_cocoa.mm). This requires the render host view to be 3459 // native_app_window_cocoa.mm). This requires the render host view to be
3449 // draggable by default. 3460 // draggable by default.
3450 - (BOOL)mouseDownCanMoveWindow { 3461 - (BOOL)mouseDownCanMoveWindow {
3451 return YES; 3462 return YES;
3452 } 3463 }
3453 3464
3454 @end 3465 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698