| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/surface/accelerated_surface_mac.h" | 5 #include "app/surface/accelerated_surface_mac.h" |
| 6 | 6 |
| 7 #include "app/gfx/gl/gl_bindings.h" | 7 #include "app/gfx/gl/gl_bindings.h" |
| 8 #include "app/gfx/gl/gl_implementation.h" | 8 #include "app/gfx/gl/gl_implementation.h" |
| 9 #include "app/surface/io_surface_support_mac.h" | 9 #include "app/surface/io_surface_support_mac.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 dib_free_callback_->Run(transport_dib_->id()); | 300 dib_free_callback_->Run(transport_dib_->id()); |
| 301 } | 301 } |
| 302 transport_dib_.reset(); | 302 transport_dib_.reset(); |
| 303 | 303 |
| 304 // Ask the renderer to create a TransportDIB. | 304 // Ask the renderer to create a TransportDIB. |
| 305 size_t dib_size = size.width() * 4 * size.height(); // 4 bytes per pixel. | 305 size_t dib_size = size.width() * 4 * size.height(); // 4 bytes per pixel. |
| 306 TransportDIB::Handle dib_handle; | 306 TransportDIB::Handle dib_handle; |
| 307 if (dib_alloc_callback_.get()) { | 307 if (dib_alloc_callback_.get()) { |
| 308 dib_alloc_callback_->Run(dib_size, &dib_handle); | 308 dib_alloc_callback_->Run(dib_size, &dib_handle); |
| 309 } | 309 } |
| 310 if (!TransportDIB::is_valid(dib_handle)) { | 310 if (!TransportDIB::is_valid_handle(dib_handle)) { |
| 311 // If the allocator fails, it means the DIB was not created in the browser, | 311 // If the allocator fails, it means the DIB was not created in the browser, |
| 312 // so there is no need to run the deallocator here. | 312 // so there is no need to run the deallocator here. |
| 313 return TransportDIB::DefaultHandleValue(); | 313 return TransportDIB::DefaultHandleValue(); |
| 314 } | 314 } |
| 315 transport_dib_.reset(TransportDIB::Map(dib_handle)); | 315 transport_dib_.reset(TransportDIB::Map(dib_handle)); |
| 316 if (transport_dib_.get() == NULL) { | 316 if (transport_dib_.get() == NULL) { |
| 317 // TODO(dspringer): if the Map() fails, should the deallocator be run so | 317 // TODO(dspringer): if the Map() fails, should the deallocator be run so |
| 318 // that the DIB is deallocated in the browser? | 318 // that the DIB is deallocated in the browser? |
| 319 return TransportDIB::DefaultHandleValue(); | 319 return TransportDIB::DefaultHandleValue(); |
| 320 } | 320 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 338 } | 338 } |
| 339 return transport_dib_->handle(); | 339 return transport_dib_->handle(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void AcceleratedSurface::SetTransportDIBAllocAndFree( | 342 void AcceleratedSurface::SetTransportDIBAllocAndFree( |
| 343 Callback2<size_t, TransportDIB::Handle*>::Type* allocator, | 343 Callback2<size_t, TransportDIB::Handle*>::Type* allocator, |
| 344 Callback1<TransportDIB::Id>::Type* deallocator) { | 344 Callback1<TransportDIB::Id>::Type* deallocator) { |
| 345 dib_alloc_callback_.reset(allocator); | 345 dib_alloc_callback_.reset(allocator); |
| 346 dib_free_callback_.reset(deallocator); | 346 dib_free_callback_.reset(deallocator); |
| 347 } | 347 } |
| OLD | NEW |