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/compositor/browser_compositor_view_private_mac.h" | 10 #include "content/browser/compositor/browser_compositor_view_private_mac.h" |
| 11 #include "content/common/gpu/gpu_messages.h" |
10 | 12 |
11 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
12 // BrowserCompositorViewMac | 14 // BrowserCompositorViewMac |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 namespace { | 17 namespace { |
16 | 18 |
17 // The number of placeholder objects allocated. If this reaches zero, then | 19 // The number of placeholder objects allocated. If this reaches zero, then |
18 // the BrowserCompositorViewMacInternal being held on to for recycling, | 20 // the BrowserCompositorViewMacInternal being held on to for recycling, |
19 // |g_recyclable_internal_view|, will be freed. | 21 // |g_recyclable_internal_view|, will be freed. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void BrowserCompositorViewMac::EndPumpingFrames() { | 71 void BrowserCompositorViewMac::EndPumpingFrames() { |
70 if (internal_view_) | 72 if (internal_view_) |
71 internal_view_->EndPumpingFrames(); | 73 internal_view_->EndPumpingFrames(); |
72 } | 74 } |
73 | 75 |
74 // static | 76 // static |
75 void BrowserCompositorViewMac::GotAcceleratedFrame( | 77 void BrowserCompositorViewMac::GotAcceleratedFrame( |
76 gfx::AcceleratedWidget widget, | 78 gfx::AcceleratedWidget widget, |
77 uint64 surface_handle, int surface_id, | 79 uint64 surface_handle, int surface_id, |
78 const std::vector<ui::LatencyInfo>& latency_info, | 80 const std::vector<ui::LatencyInfo>& latency_info, |
79 gfx::Size pixel_size, float scale_factor) { | 81 gfx::Size pixel_size, float scale_factor, |
| 82 int gpu_host_id, int gpu_route_id) { |
80 BrowserCompositorViewMacInternal* internal_view = | 83 BrowserCompositorViewMacInternal* internal_view = |
81 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); | 84 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); |
| 85 int renderer_id = 0; |
82 if (internal_view) { | 86 if (internal_view) { |
83 internal_view->GotAcceleratedFrame( | 87 internal_view->GotAcceleratedFrame( |
84 surface_handle, surface_id, latency_info, pixel_size, scale_factor); | 88 surface_handle, surface_id, latency_info, pixel_size, scale_factor); |
| 89 renderer_id = internal_view->GetRendererID(); |
| 90 } |
| 91 |
| 92 // Acknowledge the swap, now that it has been processed. |
| 93 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 94 ack_params.sync_point = 0; |
| 95 ack_params.renderer_id = renderer_id; |
| 96 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 97 if (ui_shim) { |
| 98 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented( |
| 99 gpu_route_id, ack_params)); |
85 } | 100 } |
86 } | 101 } |
87 | 102 |
88 // static | 103 // static |
89 void BrowserCompositorViewMac::GotSoftwareFrame( | 104 void BrowserCompositorViewMac::GotSoftwareFrame( |
90 gfx::AcceleratedWidget widget, | 105 gfx::AcceleratedWidget widget, |
91 cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas) { | 106 cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas) { |
92 BrowserCompositorViewMacInternal* internal_view = | 107 BrowserCompositorViewMacInternal* internal_view = |
93 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); | 108 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); |
94 if (internal_view) | 109 if (internal_view) |
(...skipping 11 matching lines...) Expand all Loading... |
106 DCHECK_GT(g_placeholder_count, 0u); | 121 DCHECK_GT(g_placeholder_count, 0u); |
107 g_placeholder_count -= 1; | 122 g_placeholder_count -= 1; |
108 | 123 |
109 // If there are no placeholders allocated, destroy the recyclable | 124 // If there are no placeholders allocated, destroy the recyclable |
110 // BrowserCompositorViewMacInternal. | 125 // BrowserCompositorViewMacInternal. |
111 if (!g_placeholder_count) | 126 if (!g_placeholder_count) |
112 g_recyclable_internal_view.Get().reset(); | 127 g_recyclable_internal_view.Get().reset(); |
113 } | 128 } |
114 | 129 |
115 } // namespace content | 130 } // namespace content |
OLD | NEW |