| OLD | NEW |
| 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 <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
| 9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
| 10 | 10 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 int output_surface_id, | 433 int output_surface_id, |
| 434 const cc::CompositorFrameAck& ack) { | 434 const cc::CompositorFrameAck& ack) { |
| 435 render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources( | 435 render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources( |
| 436 render_widget_host_->GetRoutingID(), output_surface_id, ack)); | 436 render_widget_host_->GetRoutingID(), output_surface_id, ack)); |
| 437 } | 437 } |
| 438 | 438 |
| 439 void RenderWidgetHostViewMac::DelegatedFrameHostOnLostCompositorResources() { | 439 void RenderWidgetHostViewMac::DelegatedFrameHostOnLostCompositorResources() { |
| 440 render_widget_host_->ScheduleComposite(); | 440 render_widget_host_->ScheduleComposite(); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void RenderWidgetHostViewMac::DelegatedFrameHostUpdateVSyncParameters( | |
| 444 const base::TimeTicks& timebase, | |
| 445 const base::TimeDelta& interval) { | |
| 446 render_widget_host_->UpdateVSyncParameters(timebase, interval); | |
| 447 } | |
| 448 | |
| 449 //////////////////////////////////////////////////////////////////////////////// | 443 //////////////////////////////////////////////////////////////////////////////// |
| 450 // AcceleratedWidgetMacNSView, public: | 444 // AcceleratedWidgetMacNSView, public: |
| 451 | 445 |
| 452 NSView* RenderWidgetHostViewMac::AcceleratedWidgetGetNSView() const { | 446 NSView* RenderWidgetHostViewMac::AcceleratedWidgetGetNSView() const { |
| 453 return cocoa_view_; | 447 return cocoa_view_; |
| 454 } | 448 } |
| 455 | 449 |
| 456 bool RenderWidgetHostViewMac::AcceleratedWidgetShouldIgnoreBackpressure() | 450 bool RenderWidgetHostViewMac::AcceleratedWidgetShouldIgnoreBackpressure() |
| 457 const { | 451 const { |
| 458 // If vsync is disabled, then always draw and ack frames immediately. | 452 // If vsync is disabled, then always draw and ack frames immediately. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 // ready to draw. | 539 // ready to draw. |
| 546 background_layer_.reset([[CALayer alloc] init]); | 540 background_layer_.reset([[CALayer alloc] init]); |
| 547 base::ScopedCFTypeRef<CGColorRef> background( | 541 base::ScopedCFTypeRef<CGColorRef> background( |
| 548 gfx::CGColorCreateFromSkColor(background_color_)); | 542 gfx::CGColorCreateFromSkColor(background_color_)); |
| 549 [background_layer_ setBackgroundColor:background]; | 543 [background_layer_ setBackgroundColor:background]; |
| 550 [cocoa_view_ setLayer:background_layer_]; | 544 [cocoa_view_ setLayer:background_layer_]; |
| 551 [cocoa_view_ setWantsLayer:YES]; | 545 [cocoa_view_ setWantsLayer:YES]; |
| 552 | 546 |
| 553 if (IsDelegatedRendererEnabled()) { | 547 if (IsDelegatedRendererEnabled()) { |
| 554 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 548 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
| 555 delegated_frame_host_.reset(new DelegatedFrameHost(this)); | 549 delegated_frame_host_.reset(new DelegatedFrameHost(this, false)); |
| 556 } | 550 } |
| 557 | 551 |
| 558 gfx::Screen::GetScreenFor(cocoa_view_)->AddObserver(this); | 552 gfx::Screen::GetScreenFor(cocoa_view_)->AddObserver(this); |
| 559 | 553 |
| 560 if (!is_guest_view_hack_) | 554 if (!is_guest_view_hack_) |
| 561 render_widget_host_->SetView(this); | 555 render_widget_host_->SetView(this); |
| 562 } | 556 } |
| 563 | 557 |
| 564 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { | 558 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { |
| 565 gfx::Screen::GetScreenFor(cocoa_view_)->RemoveObserver(this); | 559 gfx::Screen::GetScreenFor(cocoa_view_)->RemoveObserver(this); |
| (...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3431 | 3425 |
| 3432 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3426 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3433 // regions that are not draggable. (See ControlRegionView in | 3427 // regions that are not draggable. (See ControlRegionView in |
| 3434 // native_app_window_cocoa.mm). This requires the render host view to be | 3428 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3435 // draggable by default. | 3429 // draggable by default. |
| 3436 - (BOOL)mouseDownCanMoveWindow { | 3430 - (BOOL)mouseDownCanMoveWindow { |
| 3437 return YES; | 3431 return YES; |
| 3438 } | 3432 } |
| 3439 | 3433 |
| 3440 @end | 3434 @end |
| OLD | NEW |