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

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

Issue 2866983002: mac: Don't set background color from a frame until frame is displayed (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | 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 "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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 void RenderWidgetHostViewMac::AcceleratedWidgetGetVSyncParameters( 419 void RenderWidgetHostViewMac::AcceleratedWidgetGetVSyncParameters(
420 base::TimeTicks* timebase, base::TimeDelta* interval) const { 420 base::TimeTicks* timebase, base::TimeDelta* interval) const {
421 if (display_link_ && 421 if (display_link_ &&
422 display_link_->GetVSyncParameters(timebase, interval)) 422 display_link_->GetVSyncParameters(timebase, interval))
423 return; 423 return;
424 *timebase = base::TimeTicks(); 424 *timebase = base::TimeTicks();
425 *interval = base::TimeDelta(); 425 *interval = base::TimeDelta();
426 } 426 }
427 427
428 void RenderWidgetHostViewMac::AcceleratedWidgetSwapCompleted() { 428 void RenderWidgetHostViewMac::AcceleratedWidgetSwapCompleted() {
429 // Set the background color for the root layer from the frame that just
430 // swapped. See RenderWidgetHostViewAura for more details. Note that this is
431 // done only after the swap has completed, so that the background is not set
432 // before the frame is up.
433 UpdateBackgroundColorFromRenderer(last_frame_root_background_color_);
434
429 if (display_link_) 435 if (display_link_)
430 display_link_->NotifyCurrentTime(base::TimeTicks::Now()); 436 display_link_->NotifyCurrentTime(base::TimeTicks::Now());
431 } 437 }
432 438
433 /////////////////////////////////////////////////////////////////////////////// 439 ///////////////////////////////////////////////////////////////////////////////
434 // RenderWidgetHostViewMac, public: 440 // RenderWidgetHostViewMac, public:
435 441
436 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, 442 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
437 bool is_guest_view_hack) 443 bool is_guest_view_hack)
438 : render_widget_host_(RenderWidgetHostImpl::From(widget)), 444 : render_widget_host_(RenderWidgetHostImpl::From(widget)),
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) { 1422 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) {
1417 browser_compositor_->DidCreateNewRendererCompositorFrameSink( 1423 browser_compositor_->DidCreateNewRendererCompositorFrameSink(
1418 renderer_compositor_frame_sink); 1424 renderer_compositor_frame_sink);
1419 } 1425 }
1420 1426
1421 void RenderWidgetHostViewMac::SubmitCompositorFrame( 1427 void RenderWidgetHostViewMac::SubmitCompositorFrame(
1422 const cc::LocalSurfaceId& local_surface_id, 1428 const cc::LocalSurfaceId& local_surface_id,
1423 cc::CompositorFrame frame) { 1429 cc::CompositorFrame frame) {
1424 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); 1430 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame");
1425 1431
1426 // Override the compositor background color. See RenderWidgetHostViewAura 1432 last_frame_root_background_color_ = frame.metadata.root_background_color;
1427 // for more details.
1428 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color);
1429
1430 last_scroll_offset_ = frame.metadata.root_scroll_offset; 1433 last_scroll_offset_ = frame.metadata.root_scroll_offset;
1431 1434
1432 page_at_minimum_scale_ = 1435 page_at_minimum_scale_ =
1433 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; 1436 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor;
1434 browser_compositor_->SubmitCompositorFrame(local_surface_id, 1437 browser_compositor_->SubmitCompositorFrame(local_surface_id,
1435 std::move(frame)); 1438 std::move(frame));
1436 UpdateDisplayVSyncParameters(); 1439 UpdateDisplayVSyncParameters();
1437 } 1440 }
1438 1441
1439 void RenderWidgetHostViewMac::OnBeginFrameDidNotSwap( 1442 void RenderWidgetHostViewMac::OnBeginFrameDidNotSwap(
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 3506
3504 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3507 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3505 // regions that are not draggable. (See ControlRegionView in 3508 // regions that are not draggable. (See ControlRegionView in
3506 // native_app_window_cocoa.mm). This requires the render host view to be 3509 // native_app_window_cocoa.mm). This requires the render host view to be
3507 // draggable by default. 3510 // draggable by default.
3508 - (BOOL)mouseDownCanMoveWindow { 3511 - (BOOL)mouseDownCanMoveWindow {
3509 return YES; 3512 return YES;
3510 } 3513 }
3511 3514
3512 @end 3515 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698