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

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

Issue 2774373002: Use MojoCompositorFrameSink in RendererCompositorFrameSink (Closed)
Patch Set: Fixed mac Created 3 years, 8 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 // When making an element on the page fullscreen the element's background 393 // When making an element on the page fullscreen the element's background
394 // may not match the page's, so use black as the gutter color to avoid 394 // may not match the page's, so use black as the gutter color to avoid
395 // flashes of brighter colors during the transition. 395 // flashes of brighter colors during the transition.
396 if (render_widget_host_->delegate() && 396 if (render_widget_host_->delegate() &&
397 render_widget_host_->delegate()->IsFullscreenForCurrentTab()) { 397 render_widget_host_->delegate()->IsFullscreenForCurrentTab()) {
398 return SK_ColorBLACK; 398 return SK_ColorBLACK;
399 } 399 }
400 return color; 400 return color;
401 } 401 }
402 402
403 void RenderWidgetHostViewMac::
404 BrowserCompositorMacSendReclaimCompositorResources(
405 bool is_swap_ack,
406 const cc::ReturnedResourceArray& resources) {
407 render_widget_host_->SendReclaimCompositorResources(is_swap_ack, resources);
408 }
409
410 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( 403 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame(
411 const cc::BeginFrameArgs& args) { 404 const cc::BeginFrameArgs& args) {
412 needs_flush_input_ = false; 405 needs_flush_input_ = false;
413 render_widget_host_->FlushInput(); 406 render_widget_host_->FlushInput();
414 UpdateNeedsBeginFramesInternal(); 407 UpdateNeedsBeginFramesInternal();
415 render_widget_host_->Send( 408 if (renderer_compositor_frame_sink_)
416 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); 409 renderer_compositor_frame_sink_->OnBeginFrame(args);
417 } 410 }
418 411
419 //////////////////////////////////////////////////////////////////////////////// 412 ////////////////////////////////////////////////////////////////////////////////
420 // AcceleratedWidgetMacNSView, public: 413 // AcceleratedWidgetMacNSView, public:
421 414
422 NSView* RenderWidgetHostViewMac::AcceleratedWidgetGetNSView() const { 415 NSView* RenderWidgetHostViewMac::AcceleratedWidgetGetNSView() const {
423 return cocoa_view_; 416 return cocoa_view_;
424 } 417 }
425 418
426 void RenderWidgetHostViewMac::AcceleratedWidgetGetVSyncParameters( 419 void RenderWidgetHostViewMac::AcceleratedWidgetGetVSyncParameters(
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 // If the Mac Zoom feature is enabled, update it with the bounds of the 1410 // If the Mac Zoom feature is enabled, update it with the bounds of the
1418 // current focused node so that it can ensure that it's scrolled into view. 1411 // current focused node so that it can ensure that it's scrolled into view.
1419 // Don't do anything if it's an editable node, as this will be handled by 1412 // Don't do anything if it's an editable node, as this will be handled by
1420 // OnSelectionBoundsChanged instead. 1413 // OnSelectionBoundsChanged instead.
1421 if (UAZoomEnabled() && !is_editable_node) { 1414 if (UAZoomEnabled() && !is_editable_node) {
1422 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); 1415 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect());
1423 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); 1416 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther);
1424 } 1417 }
1425 } 1418 }
1426 1419
1427 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink() { 1420 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink(
1428 browser_compositor_->DidCreateNewRendererCompositorFrameSink(); 1421 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) {
1422 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink;
1423 browser_compositor_->DidCreateNewRendererCompositorFrameSink(
1424 renderer_compositor_frame_sink_);
1429 } 1425 }
1430 1426
1431 void RenderWidgetHostViewMac::SubmitCompositorFrame( 1427 void RenderWidgetHostViewMac::SubmitCompositorFrame(
1432 const cc::LocalSurfaceId& local_surface_id, 1428 const cc::LocalSurfaceId& local_surface_id,
1433 cc::CompositorFrame frame) { 1429 cc::CompositorFrame frame) {
1434 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); 1430 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame");
1435 1431
1436 // Override the compositor background color. See RenderWidgetHostViewAura 1432 // Override the compositor background color. See RenderWidgetHostViewAura
1437 // for more details. 1433 // for more details.
1438 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); 1434 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color);
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after
3521 3517
3522 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3518 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3523 // regions that are not draggable. (See ControlRegionView in 3519 // regions that are not draggable. (See ControlRegionView in
3524 // native_app_window_cocoa.mm). This requires the render host view to be 3520 // native_app_window_cocoa.mm). This requires the render host view to be
3525 // draggable by default. 3521 // draggable by default.
3526 - (BOOL)mouseDownCanMoveWindow { 3522 - (BOOL)mouseDownCanMoveWindow {
3527 return YES; 3523 return YES;
3528 } 3524 }
3529 3525
3530 @end 3526 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698