Chromium Code Reviews| 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/software_output_device_mac.h" | 5 #include "content/browser/compositor/software_output_device_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 | 133 |
| 134 void SoftwareOutputDeviceMac::EndPaint() { | 134 void SoftwareOutputDeviceMac::EndPaint() { |
| 135 SoftwareOutputDevice::EndPaint(); | 135 SoftwareOutputDevice::EndPaint(); |
| 136 { | 136 { |
| 137 TRACE_EVENT0("browser", "IOSurfaceUnlock"); | 137 TRACE_EVENT0("browser", "IOSurfaceUnlock"); |
| 138 IOReturn io_result = IOSurfaceUnlock(io_surfaces_[current_index_], | 138 IOReturn io_result = IOSurfaceUnlock(io_surfaces_[current_index_], |
| 139 kIOSurfaceLockAvoidSync, nullptr); | 139 kIOSurfaceLockAvoidSync, nullptr); |
| 140 if (io_result) | 140 if (io_result) |
| 141 DLOG(ERROR) << "Failed to unlock IOSurface " << io_result; | 141 DLOG(ERROR) << "Failed to unlock IOSurface " << io_result; |
| 142 } | 142 } |
| 143 canvas_.reset(); | |
| 143 | 144 |
| 144 canvas_.reset(); | 145 ui::AcceleratedWidgetMac* widget = |
| 145 base::TimeTicks vsync_timebase; | 146 ui::AcceleratedWidgetMac::Get(compositor_->widget()); |
| 146 base::TimeDelta vsync_interval; | 147 if (widget) { |
| 147 ui::AcceleratedWidgetMacGotFrame( | 148 widget->GotIOSurfaceFrame(io_surfaces_[current_index_], pixel_size_, |
| 148 compositor_->widget(), 0, false, 0, io_surfaces_[current_index_], | 149 scale_factor_); |
| 149 pixel_size_, scale_factor_, &vsync_timebase, &vsync_interval); | 150 base::TimeTicks vsync_timebase; |
| 150 if (!update_vsync_callback_.is_null()) | 151 base::TimeDelta vsync_interval; |
| 151 update_vsync_callback_.Run(vsync_timebase, vsync_interval); | 152 widget->GetVSyncParameters(&vsync_timebase, &vsync_interval); |
| 153 if (!update_vsync_callback_.is_null()) | |
|
tapted
2016/05/27 00:33:19
does this need to be outside the if (widget) block
ccameron
2016/06/03 02:43:01
This is just updating vsync info, so it doesn't ne
| |
| 154 update_vsync_callback_.Run(vsync_timebase, vsync_interval); | |
| 155 } | |
| 152 | 156 |
| 153 current_index_ = !current_index_; | 157 current_index_ = !current_index_; |
| 154 } | 158 } |
| 155 | 159 |
| 156 void SoftwareOutputDeviceMac::DiscardBackbuffer() { | 160 void SoftwareOutputDeviceMac::DiscardBackbuffer() { |
| 157 for (int i = 0; i < 2; ++i) | 161 for (int i = 0; i < 2; ++i) |
| 158 io_surfaces_[i].reset(); | 162 io_surfaces_[i].reset(); |
| 159 } | 163 } |
| 160 | 164 |
| 161 void SoftwareOutputDeviceMac::EnsureBackbuffer() {} | 165 void SoftwareOutputDeviceMac::EnsureBackbuffer() {} |
| 162 | 166 |
| 163 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { | 167 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { |
| 164 return this; | 168 return this; |
| 165 } | 169 } |
| 166 | 170 |
| 167 void SoftwareOutputDeviceMac::GetVSyncParameters( | 171 void SoftwareOutputDeviceMac::GetVSyncParameters( |
| 168 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { | 172 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { |
| 169 update_vsync_callback_ = callback; | 173 update_vsync_callback_ = callback; |
| 170 } | 174 } |
| 171 | 175 |
| 172 } // namespace content | 176 } // namespace content |
| OLD | NEW |