| 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 <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2351 SendPendingLatencyInfoToHost(); | 2351 SendPendingLatencyInfoToHost(); |
| 2352 } | 2352 } |
| 2353 } | 2353 } |
| 2354 | 2354 |
| 2355 void RenderWidgetHostViewMac::AddPendingSwapAck( | 2355 void RenderWidgetHostViewMac::AddPendingSwapAck( |
| 2356 int32 route_id, int gpu_host_id, int32 renderer_id) { | 2356 int32 route_id, int gpu_host_id, int32 renderer_id) { |
| 2357 // Note that multiple un-acked swaps can come in the event of a GPU process | 2357 // Note that multiple un-acked swaps can come in the event of a GPU process |
| 2358 // loss. Drop the old acks. | 2358 // loss. Drop the old acks. |
| 2359 pending_swap_ack_.reset(new PendingSwapAck( | 2359 pending_swap_ack_.reset(new PendingSwapAck( |
| 2360 route_id, gpu_host_id, renderer_id)); | 2360 route_id, gpu_host_id, renderer_id)); |
| 2361 | |
| 2362 // A trace value of 2 indicates that there is a pending swap ack. See | |
| 2363 // CompositingIOSurfaceLayer's canDrawInCGLContext for other value meanings. | |
| 2364 TRACE_COUNTER_ID1("browser", "PendingSwapAck", | |
| 2365 compositing_iosurface_layer_.get(), 2); | |
| 2366 } | 2361 } |
| 2367 | 2362 |
| 2368 void RenderWidgetHostViewMac::SendPendingSwapAck() { | 2363 void RenderWidgetHostViewMac::SendPendingSwapAck() { |
| 2369 if (!pending_swap_ack_) | 2364 if (!pending_swap_ack_) |
| 2370 return; | 2365 return; |
| 2371 | 2366 |
| 2372 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 2367 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 2373 ack_params.sync_point = 0; | 2368 ack_params.sync_point = 0; |
| 2374 ack_params.renderer_id = pending_swap_ack_->renderer_id; | 2369 ack_params.renderer_id = pending_swap_ack_->renderer_id; |
| 2375 RenderWidgetHostImpl::AcknowledgeBufferPresent(pending_swap_ack_->route_id, | 2370 RenderWidgetHostImpl::AcknowledgeBufferPresent(pending_swap_ack_->route_id, |
| 2376 pending_swap_ack_->gpu_host_id, | 2371 pending_swap_ack_->gpu_host_id, |
| 2377 ack_params); | 2372 ack_params); |
| 2378 pending_swap_ack_.reset(); | 2373 pending_swap_ack_.reset(); |
| 2379 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 0); | |
| 2380 } | 2374 } |
| 2381 | 2375 |
| 2382 void RenderWidgetHostViewMac::PauseForPendingResizeOrRepaintsAndDraw() { | 2376 void RenderWidgetHostViewMac::PauseForPendingResizeOrRepaintsAndDraw() { |
| 2383 if (!render_widget_host_ || render_widget_host_->is_hidden()) | 2377 if (!render_widget_host_ || render_widget_host_->is_hidden()) |
| 2384 return; | 2378 return; |
| 2385 | 2379 |
| 2386 // Pausing for the overlay/underlay view prevents the other one from receiving | 2380 // Pausing for the overlay/underlay view prevents the other one from receiving |
| 2387 // frames. This may lead to large delays, causing overlaps. | 2381 // frames. This may lead to large delays, causing overlaps. |
| 2388 // See crbug.com/352020. | 2382 // See crbug.com/352020. |
| 2389 if (underlay_view_ || overlay_view_) | 2383 if (underlay_view_ || overlay_view_) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 //////////////////////////////////////////////////////////////////////////////// | 2473 //////////////////////////////////////////////////////////////////////////////// |
| 2480 // CompositingIOSurfaceLayerClient, public: | 2474 // CompositingIOSurfaceLayerClient, public: |
| 2481 | 2475 |
| 2482 void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) { | 2476 void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) { |
| 2483 SendPendingLatencyInfoToHost(); | 2477 SendPendingLatencyInfoToHost(); |
| 2484 SendPendingSwapAck(); | 2478 SendPendingSwapAck(); |
| 2485 if (!succeeded) | 2479 if (!succeeded) |
| 2486 GotAcceleratedCompositingError(); | 2480 GotAcceleratedCompositingError(); |
| 2487 } | 2481 } |
| 2488 | 2482 |
| 2489 bool RenderWidgetHostViewMac::AcceleratedLayerHasNotAckedPendingFrame() const { | |
| 2490 return pending_swap_ack_; | |
| 2491 } | |
| 2492 | |
| 2493 } // namespace content | 2483 } // namespace content |
| 2494 | 2484 |
| 2495 // RenderWidgetHostViewCocoa --------------------------------------------------- | 2485 // RenderWidgetHostViewCocoa --------------------------------------------------- |
| 2496 | 2486 |
| 2497 @implementation RenderWidgetHostViewCocoa | 2487 @implementation RenderWidgetHostViewCocoa |
| 2498 @synthesize selectedRange = selectedRange_; | 2488 @synthesize selectedRange = selectedRange_; |
| 2499 @synthesize suppressNextEscapeKeyUp = suppressNextEscapeKeyUp_; | 2489 @synthesize suppressNextEscapeKeyUp = suppressNextEscapeKeyUp_; |
| 2500 @synthesize markedRange = markedRange_; | 2490 @synthesize markedRange = markedRange_; |
| 2501 | 2491 |
| 2502 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r { | 2492 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r { |
| (...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4384 | 4374 |
| 4385 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 4375 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 4386 // regions that are not draggable. (See ControlRegionView in | 4376 // regions that are not draggable. (See ControlRegionView in |
| 4387 // native_app_window_cocoa.mm). This requires the render host view to be | 4377 // native_app_window_cocoa.mm). This requires the render host view to be |
| 4388 // draggable by default. | 4378 // draggable by default. |
| 4389 - (BOOL)mouseDownCanMoveWindow { | 4379 - (BOOL)mouseDownCanMoveWindow { |
| 4390 return YES; | 4380 return YES; |
| 4391 } | 4381 } |
| 4392 | 4382 |
| 4393 @end | 4383 @end |
| OLD | NEW |