| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/browser_compositor_view_mac.h" | 5 #include "content/browser/compositor/browser_compositor_view_mac.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 10 #include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" | 10 #include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // static | 76 // static |
| 77 void BrowserCompositorViewMac::GotAcceleratedFrame( | 77 void BrowserCompositorViewMac::GotAcceleratedFrame( |
| 78 gfx::AcceleratedWidget widget, | 78 gfx::AcceleratedWidget widget, |
| 79 uint64 surface_handle, int surface_id, | 79 uint64 surface_handle, int surface_id, |
| 80 const std::vector<ui::LatencyInfo>& latency_info, | 80 const std::vector<ui::LatencyInfo>& latency_info, |
| 81 gfx::Size pixel_size, float scale_factor, | 81 gfx::Size pixel_size, float scale_factor, |
| 82 int gpu_host_id, int gpu_route_id) { | 82 int gpu_host_id, int gpu_route_id) { |
| 83 BrowserCompositorCALayerTreeMac* ca_layer_tree = | 83 BrowserCompositorCALayerTreeMac* ca_layer_tree = |
| 84 BrowserCompositorCALayerTreeMac::FromAcceleratedWidget(widget); | 84 BrowserCompositorCALayerTreeMac::FromAcceleratedWidget(widget); |
| 85 bool disable_throttling = false; |
| 85 int renderer_id = 0; | 86 int renderer_id = 0; |
| 86 if (ca_layer_tree) { | 87 if (ca_layer_tree) { |
| 87 ca_layer_tree->GotAcceleratedFrame( | 88 ca_layer_tree->GotAcceleratedFrame( |
| 88 surface_handle, surface_id, latency_info, pixel_size, scale_factor); | 89 surface_handle, surface_id, latency_info, pixel_size, scale_factor); |
| 90 disable_throttling = ca_layer_tree->IsRendererThrottlingDisabled(); |
| 89 renderer_id = ca_layer_tree->GetRendererID(); | 91 renderer_id = ca_layer_tree->GetRendererID(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 // Acknowledge the swap, now that it has been processed. | 94 // Acknowledge the swap, now that it has been processed. |
| 93 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 95 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 96 ack_params.disable_throttling = disable_throttling; |
| 94 ack_params.renderer_id = renderer_id; | 97 ack_params.renderer_id = renderer_id; |
| 95 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 98 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 96 if (ui_shim) { | 99 if (ui_shim) { |
| 97 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented( | 100 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented( |
| 98 gpu_route_id, ack_params)); | 101 gpu_route_id, ack_params)); |
| 99 } | 102 } |
| 100 } | 103 } |
| 101 | 104 |
| 102 // static | 105 // static |
| 103 void BrowserCompositorViewMac::GotSoftwareFrame( | 106 void BrowserCompositorViewMac::GotSoftwareFrame( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 120 DCHECK_GT(g_placeholder_count, 0u); | 123 DCHECK_GT(g_placeholder_count, 0u); |
| 121 g_placeholder_count -= 1; | 124 g_placeholder_count -= 1; |
| 122 | 125 |
| 123 // If there are no placeholders allocated, destroy the recyclable | 126 // If there are no placeholders allocated, destroy the recyclable |
| 124 // BrowserCompositorCALayerTreeMac. | 127 // BrowserCompositorCALayerTreeMac. |
| 125 if (!g_placeholder_count) | 128 if (!g_placeholder_count) |
| 126 g_recyclable_ca_layer_tree.Get().reset(); | 129 g_recyclable_ca_layer_tree.Get().reset(); |
| 127 } | 130 } |
| 128 | 131 |
| 129 } // namespace content | 132 } // namespace content |
| OLD | NEW |