| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 143 |
| 144 canvas_ = nullptr; | 144 canvas_.reset(); |
| 145 base::TimeTicks vsync_timebase; | 145 base::TimeTicks vsync_timebase; |
| 146 base::TimeDelta vsync_interval; | 146 base::TimeDelta vsync_interval; |
| 147 ui::AcceleratedWidgetMacGotFrame( | 147 ui::AcceleratedWidgetMacGotFrame( |
| 148 compositor_->widget(), 0, io_surfaces_[current_index_], pixel_size_, | 148 compositor_->widget(), 0, io_surfaces_[current_index_], pixel_size_, |
| 149 scale_factor_, &vsync_timebase, &vsync_interval); | 149 scale_factor_, &vsync_timebase, &vsync_interval); |
| 150 if (!update_vsync_callback_.is_null()) | 150 if (!update_vsync_callback_.is_null()) |
| 151 update_vsync_callback_.Run(vsync_timebase, vsync_interval); | 151 update_vsync_callback_.Run(vsync_timebase, vsync_interval); |
| 152 | 152 |
| 153 current_index_ = !current_index_; | 153 current_index_ = !current_index_; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void SoftwareOutputDeviceMac::DiscardBackbuffer() { | 156 void SoftwareOutputDeviceMac::DiscardBackbuffer() { |
| 157 for (int i = 0; i < 2; ++i) | 157 for (int i = 0; i < 2; ++i) |
| 158 io_surfaces_[i].reset(); | 158 io_surfaces_[i].reset(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void SoftwareOutputDeviceMac::EnsureBackbuffer() {} | 161 void SoftwareOutputDeviceMac::EnsureBackbuffer() {} |
| 162 | 162 |
| 163 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { | 163 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { |
| 164 return this; | 164 return this; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void SoftwareOutputDeviceMac::GetVSyncParameters( | 167 void SoftwareOutputDeviceMac::GetVSyncParameters( |
| 168 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { | 168 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { |
| 169 update_vsync_callback_ = callback; | 169 update_vsync_callback_ = callback; |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace content | 172 } // namespace content |
| OLD | NEW |