Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "gpu/ipc/service/image_transport_surface_overlay_mac.h" | 5 #include "gpu/ipc/service/image_transport_surface_overlay_mac.h" |
| 6 | 6 |
| 7 #include <CoreGraphics/CoreGraphics.h> | 7 #include <CoreGraphics/CoreGraphics.h> |
| 8 #include <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
| 9 #include <OpenGL/CGLRenderers.h> | 9 #include <OpenGL/CGLRenderers.h> |
| 10 #include <OpenGL/CGLTypes.h> | 10 #include <OpenGL/CGLTypes.h> |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "ui/gfx/transform.h" | 36 #include "ui/gfx/transform.h" |
| 37 #include "ui/gl/gl_context.h" | 37 #include "ui/gl/gl_context.h" |
| 38 #include "ui/gl/gl_fence.h" | 38 #include "ui/gl/gl_fence.h" |
| 39 #include "ui/gl/gl_image_io_surface.h" | 39 #include "ui/gl/gl_image_io_surface.h" |
| 40 #include "ui/gl/gpu_switching_manager.h" | 40 #include "ui/gl/gpu_switching_manager.h" |
| 41 #include "ui/gl/scoped_api.h" | 41 #include "ui/gl/scoped_api.h" |
| 42 #include "ui/gl/scoped_cgl.h" | 42 #include "ui/gl/scoped_cgl.h" |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 // Keep previously-used CAContexts around until 5 subsequent swaps have been | |
| 47 // issued, to ensure that the CAContext is no longer being displayed. This | |
| 48 // value was determined empirically. | |
| 49 const size_t kSwapsToKeepDiscardedSizeDependentState = 5; | |
| 50 | |
| 46 void CheckGLErrors(const char* msg) { | 51 void CheckGLErrors(const char* msg) { |
| 47 GLenum gl_error; | 52 GLenum gl_error; |
| 48 while ((gl_error = glGetError()) != GL_NO_ERROR) { | 53 while ((gl_error = glGetError()) != GL_NO_ERROR) { |
| 49 LOG(ERROR) << "OpenGL error hit " << msg << ": " << gl_error; | 54 LOG(ERROR) << "OpenGL error hit " << msg << ": " << gl_error; |
| 50 } | 55 } |
| 51 } | 56 } |
| 52 | 57 |
| 53 void IOSurfaceContextNoOp(scoped_refptr<ui::IOSurfaceContext>) { | 58 void IOSurfaceContextNoOp(scoped_refptr<ui::IOSurfaceContext>) { |
| 54 } | 59 } |
| 55 | 60 |
| 56 } // namespace | 61 } // namespace |
| 57 | 62 |
| 58 namespace gpu { | 63 namespace gpu { |
| 59 | 64 |
| 60 scoped_refptr<gl::GLSurface> ImageTransportSurfaceCreateNativeSurface( | 65 scoped_refptr<gl::GLSurface> ImageTransportSurfaceCreateNativeSurface( |
| 61 GpuChannelManager* manager, | 66 GpuChannelManager* manager, |
| 62 GpuCommandBufferStub* stub, | 67 GpuCommandBufferStub* stub, |
| 63 SurfaceHandle handle) { | 68 SurfaceHandle handle) { |
| 64 return new ImageTransportSurfaceOverlayMac(stub, handle); | 69 return new ImageTransportSurfaceOverlayMac(stub, handle); |
| 65 } | 70 } |
| 66 | 71 |
| 67 ImageTransportSurfaceOverlayMac::ImageTransportSurfaceOverlayMac( | 72 ImageTransportSurfaceOverlayMac::ImageTransportSurfaceOverlayMac( |
| 68 GpuCommandBufferStub* stub, | 73 GpuCommandBufferStub* stub, |
| 69 SurfaceHandle handle) | 74 SurfaceHandle handle) |
| 70 : stub_(stub->AsWeakPtr()), | 75 : stub_(stub->AsWeakPtr()), |
| 71 handle_(handle), | 76 handle_(handle), |
| 72 use_remote_layer_api_(ui::RemoteLayerAPISupported()), | 77 use_remote_layer_api_(ui::RemoteLayerAPISupported()), |
| 73 scale_factor_(1), | |
| 74 gl_renderer_id_(0) { | 78 gl_renderer_id_(0) { |
| 75 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 79 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
| 76 ca_layer_tree_coordinator_.reset( | |
| 77 new ui::CALayerTreeCoordinator(use_remote_layer_api_)); | |
| 78 } | 80 } |
| 79 | 81 |
| 80 ImageTransportSurfaceOverlayMac::~ImageTransportSurfaceOverlayMac() { | 82 ImageTransportSurfaceOverlayMac::~ImageTransportSurfaceOverlayMac() { |
| 81 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); | 83 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); |
| 82 if (stub_.get()) { | 84 if (stub_.get()) { |
| 83 stub_->SetLatencyInfoCallback( | 85 stub_->SetLatencyInfoCallback( |
| 84 base::Callback<void(const std::vector<ui::LatencyInfo>&)>()); | 86 base::Callback<void(const std::vector<ui::LatencyInfo>&)>()); |
| 85 } | 87 } |
| 86 Destroy(); | 88 Destroy(); |
| 87 } | 89 } |
| 88 | 90 |
| 89 bool ImageTransportSurfaceOverlayMac::Initialize(gl::GLSurface::Format format) { | 91 bool ImageTransportSurfaceOverlayMac::Initialize(gl::GLSurface::Format format) { |
| 90 if (!stub_.get() || !stub_->decoder()) | 92 if (!stub_.get() || !stub_->decoder()) |
| 91 return false; | 93 return false; |
| 92 | 94 |
| 93 stub_->SetLatencyInfoCallback( | 95 stub_->SetLatencyInfoCallback( |
| 94 base::Bind(&ImageTransportSurfaceOverlayMac::SetLatencyInfo, | 96 base::Bind(&ImageTransportSurfaceOverlayMac::SetLatencyInfo, |
| 95 base::Unretained(this))); | 97 base::Unretained(this))); |
| 96 | 98 |
| 97 // Create the CAContext to send this to the GPU process, and the layer for | 99 if (!size_dependent_state_) |
|
tapted
2016/06/17 00:23:38
should this always be true? (e.g. can we DCHECK(!s
| |
| 98 // the context. | 100 Resize(gfx::Size(1, 1), 1, false); |
| 99 if (use_remote_layer_api_) { | |
| 100 CGSConnectionID connection_id = CGSMainConnectionID(); | |
| 101 ca_context_.reset([ | |
| 102 [CAContext contextWithCGSConnection:connection_id options:@{}] retain]); | |
| 103 [ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()]; | |
| 104 | |
| 105 fullscreen_low_power_ca_context_.reset([ | |
| 106 [CAContext contextWithCGSConnection:connection_id options:@{}] retain]); | |
| 107 [fullscreen_low_power_ca_context_ setLayer: | |
| 108 ca_layer_tree_coordinator_->GetFullscreenLowPowerLayerForDisplay()]; | |
| 109 } | |
| 110 return true; | 101 return true; |
| 111 } | 102 } |
| 112 | 103 |
| 113 void ImageTransportSurfaceOverlayMac::Destroy() { | 104 void ImageTransportSurfaceOverlayMac::Destroy() { |
| 114 ca_layer_tree_coordinator_.reset(); | 105 discarded_size_dependent_state_.push_back(std::move(size_dependent_state_)); |
|
tapted
2016/06/17 00:23:38
why not
discarded_size_dependent_state_.clear()
s
| |
| 115 if (previous_frame_fence_) { | 106 if (previous_frame_fence_) { |
| 116 gl::ScopedSetGLToRealGLApi scoped_set_gl_api; | 107 gl::ScopedSetGLToRealGLApi scoped_set_gl_api; |
| 117 // Ensure we are using the context with which the fence was created. | 108 // Ensure we are using the context with which the fence was created. |
| 118 gl::ScopedCGLSetCurrentContext scoped_set_current(fence_context_obj_); | 109 gl::ScopedCGLSetCurrentContext scoped_set_current(fence_context_obj_); |
| 119 CheckGLErrors("Before destroy fence"); | 110 CheckGLErrors("Before destroy fence"); |
| 120 previous_frame_fence_.reset(); | 111 previous_frame_fence_.reset(); |
| 121 CheckGLErrors("After destroy fence"); | 112 CheckGLErrors("After destroy fence"); |
| 122 } | 113 } |
| 123 } | 114 } |
| 124 | 115 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 gl::ScopedSetGLToRealGLApi scoped_set_gl_api; | 216 gl::ScopedSetGLToRealGLApi scoped_set_gl_api; |
| 226 TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::glFinish"); | 217 TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::glFinish"); |
| 227 CheckGLErrors("Before finish"); | 218 CheckGLErrors("Before finish"); |
| 228 glFinish(); | 219 glFinish(); |
| 229 CheckGLErrors("After finish"); | 220 CheckGLErrors("After finish"); |
| 230 } | 221 } |
| 231 | 222 |
| 232 base::TimeTicks finish_time = base::TimeTicks::Now(); | 223 base::TimeTicks finish_time = base::TimeTicks::Now(); |
| 233 | 224 |
| 234 bool fullscreen_low_power_layer_valid = false; | 225 bool fullscreen_low_power_layer_valid = false; |
| 235 ca_layer_tree_coordinator_->CommitPendingTreesToCA( | 226 size_dependent_state_->ca_layer_tree_coordinator_->CommitPendingTreesToCA( |
| 236 pixel_damage_rect, &fullscreen_low_power_layer_valid); | 227 pixel_damage_rect, &fullscreen_low_power_layer_valid); |
| 237 // TODO(ccameron): Plumb the fullscreen low power layer through to the | 228 // TODO(ccameron): Plumb the fullscreen low power layer through to the |
| 238 // appropriate window. | 229 // appropriate window. |
| 239 | 230 |
| 240 // Update the latency info to reflect the swap time. | 231 // Update the latency info to reflect the swap time. |
| 241 for (auto latency_info : latency_info_) { | 232 for (auto latency_info : latency_info_) { |
| 242 latency_info.AddLatencyNumberWithTimestamp( | 233 latency_info.AddLatencyNumberWithTimestamp( |
| 243 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, finish_time, 1); | 234 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, finish_time, 1); |
| 244 latency_info.AddLatencyNumberWithTimestamp( | 235 latency_info.AddLatencyNumberWithTimestamp( |
| 245 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, | 236 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, |
| 246 finish_time, 1); | 237 finish_time, 1); |
| 247 } | 238 } |
| 248 | 239 |
| 249 // Send acknowledgement to the browser. | 240 // Send acknowledgement to the browser. |
| 250 CAContextID ca_context_id = 0; | 241 CAContextID ca_context_id = 0; |
| 251 CAContextID fullscreen_low_power_ca_context_id = 0; | 242 CAContextID fullscreen_low_power_ca_context_id = 0; |
| 252 gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port; | 243 gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port; |
| 253 if (use_remote_layer_api_) { | 244 if (use_remote_layer_api_) { |
| 254 ca_context_id = [ca_context_ contextId]; | 245 ca_context_id = [size_dependent_state_->ca_context_ contextId]; |
| 255 fullscreen_low_power_ca_context_id = | 246 fullscreen_low_power_ca_context_id = |
| 256 [fullscreen_low_power_ca_context_ contextId]; | 247 [size_dependent_state_->fullscreen_low_power_ca_context_ contextId]; |
| 257 } else { | 248 } else { |
| 258 IOSurfaceRef io_surface = | 249 IOSurfaceRef io_surface = size_dependent_state_->ca_layer_tree_coordinator_ |
| 259 ca_layer_tree_coordinator_->GetIOSurfaceForDisplay(); | 250 ->GetIOSurfaceForDisplay(); |
| 260 if (io_surface) | 251 if (io_surface) |
| 261 io_surface_mach_port.reset(IOSurfaceCreateMachPort(io_surface)); | 252 io_surface_mach_port.reset(IOSurfaceCreateMachPort(io_surface)); |
| 262 } | 253 } |
| 263 SendAcceleratedSurfaceBuffersSwapped( | 254 SendAcceleratedSurfaceBuffersSwapped( |
| 264 handle_, ca_context_id, fullscreen_low_power_layer_valid, | 255 handle_, ca_context_id, fullscreen_low_power_layer_valid, |
| 265 fullscreen_low_power_ca_context_id, io_surface_mach_port, pixel_size_, | 256 fullscreen_low_power_ca_context_id, io_surface_mach_port, |
| 266 scale_factor_, std::move(latency_info_)); | 257 size_dependent_state_->pixel_size_, size_dependent_state_->scale_factor_, |
| 258 std::move(latency_info_)); | |
| 259 | |
| 260 // Free state from previous resizes only after several swaps. | |
| 261 for (auto& discarded_state : discarded_size_dependent_state_) | |
| 262 discarded_state->swaps_since_discarded_ += 1; | |
| 263 while (!discarded_size_dependent_state_.empty()) { | |
| 264 if (discarded_size_dependent_state_.front()->swaps_since_discarded_ > | |
| 265 kSwapsToKeepDiscardedSizeDependentState) { | |
| 266 discarded_size_dependent_state_.pop_front(); | |
| 267 } else { | |
| 268 break; | |
|
tapted
2016/06/17 00:23:38
optional nit: Maybe just move the `if` into the `w
| |
| 269 } | |
| 270 } | |
| 267 | 271 |
| 268 // Reset all state for the next frame. | 272 // Reset all state for the next frame. |
| 269 latency_info_.clear(); | 273 latency_info_.clear(); |
| 270 return gfx::SwapResult::SWAP_ACK; | 274 return gfx::SwapResult::SWAP_ACK; |
| 271 } | 275 } |
| 272 | 276 |
| 273 gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffers() { | 277 gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffers() { |
| 274 return SwapBuffersInternal( | 278 return SwapBuffersInternal(gfx::Rect(size_dependent_state_->pixel_size_)); |
| 275 gfx::Rect(0, 0, pixel_size_.width(), pixel_size_.height())); | |
| 276 } | 279 } |
| 277 | 280 |
| 278 gfx::SwapResult ImageTransportSurfaceOverlayMac::PostSubBuffer(int x, | 281 gfx::SwapResult ImageTransportSurfaceOverlayMac::PostSubBuffer(int x, |
| 279 int y, | 282 int y, |
| 280 int width, | 283 int width, |
| 281 int height) { | 284 int height) { |
| 282 return SwapBuffersInternal(gfx::Rect(x, y, width, height)); | 285 return SwapBuffersInternal(gfx::Rect(x, y, width, height)); |
| 283 } | 286 } |
| 284 | 287 |
| 285 bool ImageTransportSurfaceOverlayMac::SupportsPostSubBuffer() { | 288 bool ImageTransportSurfaceOverlayMac::SupportsPostSubBuffer() { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 309 const gfx::Rect& pixel_frame_rect, | 312 const gfx::Rect& pixel_frame_rect, |
| 310 const gfx::RectF& crop_rect) { | 313 const gfx::RectF& crop_rect) { |
| 311 if (transform != gfx::OVERLAY_TRANSFORM_NONE) { | 314 if (transform != gfx::OVERLAY_TRANSFORM_NONE) { |
| 312 DLOG(ERROR) << "Invalid overlay plane transform."; | 315 DLOG(ERROR) << "Invalid overlay plane transform."; |
| 313 return false; | 316 return false; |
| 314 } | 317 } |
| 315 if (z_order) { | 318 if (z_order) { |
| 316 DLOG(ERROR) << "Invalid non-zero Z order."; | 319 DLOG(ERROR) << "Invalid non-zero Z order."; |
| 317 return false; | 320 return false; |
| 318 } | 321 } |
| 319 return ca_layer_tree_coordinator_->SetPendingGLRendererBackbuffer( | 322 return size_dependent_state_->ca_layer_tree_coordinator_ |
| 320 static_cast<gl::GLImageIOSurface*>(image)->io_surface()); | 323 ->SetPendingGLRendererBackbuffer( |
| 324 static_cast<gl::GLImageIOSurface*>(image)->io_surface()); | |
| 321 } | 325 } |
| 322 | 326 |
| 323 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer( | 327 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer( |
| 324 gl::GLImage* contents_image, | 328 gl::GLImage* contents_image, |
| 325 const gfx::RectF& contents_rect, | 329 const gfx::RectF& contents_rect, |
| 326 float opacity, | 330 float opacity, |
| 327 unsigned background_color, | 331 unsigned background_color, |
| 328 unsigned edge_aa_mask, | 332 unsigned edge_aa_mask, |
| 329 const gfx::RectF& rect, | 333 const gfx::RectF& rect, |
| 330 bool is_clipped, | 334 bool is_clipped, |
| 331 const gfx::RectF& clip_rect, | 335 const gfx::RectF& clip_rect, |
| 332 const gfx::Transform& transform, | 336 const gfx::Transform& transform, |
| 333 int sorting_context_id, | 337 int sorting_context_id, |
| 334 unsigned filter) { | 338 unsigned filter) { |
| 335 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; | 339 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; |
| 336 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; | 340 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; |
| 337 if (contents_image) { | 341 if (contents_image) { |
| 338 gl::GLImageIOSurface* io_surface_image = | 342 gl::GLImageIOSurface* io_surface_image = |
| 339 static_cast<gl::GLImageIOSurface*>(contents_image); | 343 static_cast<gl::GLImageIOSurface*>(contents_image); |
| 340 io_surface = io_surface_image->io_surface(); | 344 io_surface = io_surface_image->io_surface(); |
| 341 cv_pixel_buffer = io_surface_image->cv_pixel_buffer(); | 345 cv_pixel_buffer = io_surface_image->cv_pixel_buffer(); |
| 342 } | 346 } |
| 343 return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree() | 347 return size_dependent_state_->ca_layer_tree_coordinator_ |
| 348 ->GetPendingCARendererLayerTree() | |
| 344 ->ScheduleCALayer(is_clipped, gfx::ToEnclosingRect(clip_rect), | 349 ->ScheduleCALayer(is_clipped, gfx::ToEnclosingRect(clip_rect), |
| 345 sorting_context_id, transform, io_surface, | 350 sorting_context_id, transform, io_surface, |
| 346 cv_pixel_buffer, contents_rect, | 351 cv_pixel_buffer, contents_rect, |
| 347 gfx::ToEnclosingRect(rect), background_color, | 352 gfx::ToEnclosingRect(rect), background_color, |
| 348 edge_aa_mask, opacity, filter); | 353 edge_aa_mask, opacity, filter); |
| 349 } | 354 } |
| 350 | 355 |
| 351 void ImageTransportSurfaceOverlayMac::ScheduleCALayerInUseQuery( | 356 void ImageTransportSurfaceOverlayMac::ScheduleCALayerInUseQuery( |
| 352 std::vector<CALayerInUseQuery> queries) { | 357 std::vector<CALayerInUseQuery> queries) { |
| 353 for (auto& query : queries) { | 358 for (auto& query : queries) { |
| 354 IOSurfaceInUseQuery io_surface_query; | 359 IOSurfaceInUseQuery io_surface_query; |
| 355 io_surface_query.texture = query.texture; | 360 io_surface_query.texture = query.texture; |
| 356 if (query.image) { | 361 if (query.image) { |
| 357 gl::GLImageIOSurface* io_surface_image = | 362 gl::GLImageIOSurface* io_surface_image = |
| 358 static_cast<gl::GLImageIOSurface*>(query.image.get()); | 363 static_cast<gl::GLImageIOSurface*>(query.image.get()); |
| 359 io_surface_query.io_surface = io_surface_image->io_surface(); | 364 io_surface_query.io_surface = io_surface_image->io_surface(); |
| 360 } | 365 } |
| 361 io_surface_in_use_queries_.push_back(std::move(io_surface_query)); | 366 io_surface_in_use_queries_.push_back(std::move(io_surface_query)); |
| 362 } | 367 } |
| 363 } | 368 } |
| 364 | 369 |
| 365 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { | 370 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { |
| 366 return true; | 371 return true; |
| 367 } | 372 } |
| 368 | 373 |
| 369 bool ImageTransportSurfaceOverlayMac::Resize(const gfx::Size& pixel_size, | 374 bool ImageTransportSurfaceOverlayMac::Resize(const gfx::Size& pixel_size, |
| 370 float scale_factor, | 375 float scale_factor, |
| 371 bool has_alpha) { | 376 bool has_alpha) { |
| 372 pixel_size_ = pixel_size; | 377 if (size_dependent_state_ && |
| 373 scale_factor_ = scale_factor; | 378 size_dependent_state_->pixel_size_ == pixel_size && |
| 374 ca_layer_tree_coordinator_->Resize(pixel_size, scale_factor); | 379 size_dependent_state_->scale_factor_ == scale_factor) { |
| 380 return true; | |
| 381 } | |
| 382 if (size_dependent_state_) | |
| 383 discarded_size_dependent_state_.push_back(std::move(size_dependent_state_)); | |
| 384 | |
| 385 size_dependent_state_.reset(new SizeDependentState); | |
| 386 size_dependent_state_->pixel_size_ = pixel_size; | |
| 387 size_dependent_state_->scale_factor_ = scale_factor; | |
| 388 size_dependent_state_->ca_layer_tree_coordinator_.reset( | |
| 389 new ui::CALayerTreeCoordinator(use_remote_layer_api_)); | |
| 390 size_dependent_state_->ca_layer_tree_coordinator_->Resize(pixel_size, | |
| 391 scale_factor); | |
| 392 | |
| 393 // Create the CAContext to send this to the GPU process, and the layer for | |
| 394 // the context. | |
| 395 if (use_remote_layer_api_) { | |
| 396 CGSConnectionID connection_id = CGSMainConnectionID(); | |
| 397 size_dependent_state_->ca_context_.reset([ | |
| 398 [CAContext contextWithCGSConnection:connection_id options:@{}] retain]); | |
|
tapted
2016/06/17 00:23:38
nit: use base::scoped_policy::RETAIN ?
| |
| 399 [size_dependent_state_->ca_context_ | |
| 400 setLayer:size_dependent_state_->ca_layer_tree_coordinator_ | |
| 401 ->GetCALayerForDisplay()]; | |
| 402 | |
| 403 size_dependent_state_->fullscreen_low_power_ca_context_.reset([ | |
| 404 [CAContext contextWithCGSConnection:connection_id options:@{}] retain]); | |
|
tapted
2016/06/17 00:23:38
nit: base::scoped_policy::RETAIN
| |
| 405 [size_dependent_state_->fullscreen_low_power_ca_context_ | |
| 406 setLayer:size_dependent_state_->ca_layer_tree_coordinator_ | |
| 407 ->GetFullscreenLowPowerLayerForDisplay()]; | |
| 408 } | |
|
tapted
2016/06/17 00:23:38
I think it would be good to move all this into the
| |
| 375 return true; | 409 return true; |
| 376 } | 410 } |
| 377 | 411 |
| 378 void ImageTransportSurfaceOverlayMac::OnGpuSwitched() { | 412 void ImageTransportSurfaceOverlayMac::OnGpuSwitched() { |
| 379 // Create a new context, and use the GL renderer ID that the new context gets. | 413 // Create a new context, and use the GL renderer ID that the new context gets. |
| 380 scoped_refptr<ui::IOSurfaceContext> context_on_new_gpu = | 414 scoped_refptr<ui::IOSurfaceContext> context_on_new_gpu = |
| 381 ui::IOSurfaceContext::Get(ui::IOSurfaceContext::kCALayerContext); | 415 ui::IOSurfaceContext::Get(ui::IOSurfaceContext::kCALayerContext); |
| 382 if (!context_on_new_gpu) | 416 if (!context_on_new_gpu) |
| 383 return; | 417 return; |
| 384 GLint context_renderer_id = -1; | 418 GLint context_renderer_id = -1; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 399 | 433 |
| 400 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::IOSurfaceInUseQuery() = | 434 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::IOSurfaceInUseQuery() = |
| 401 default; | 435 default; |
| 402 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::IOSurfaceInUseQuery( | 436 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::IOSurfaceInUseQuery( |
| 403 const IOSurfaceInUseQuery&) = default; | 437 const IOSurfaceInUseQuery&) = default; |
| 404 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::IOSurfaceInUseQuery( | 438 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::IOSurfaceInUseQuery( |
| 405 IOSurfaceInUseQuery&&) = default; | 439 IOSurfaceInUseQuery&&) = default; |
| 406 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::~IOSurfaceInUseQuery() = | 440 ImageTransportSurfaceOverlayMac::IOSurfaceInUseQuery::~IOSurfaceInUseQuery() = |
| 407 default; | 441 default; |
| 408 | 442 |
| 443 ImageTransportSurfaceOverlayMac::SizeDependentState::SizeDependentState() = | |
|
tapted
2016/06/17 00:23:38
nit: (if you want to keep the declaration in the h
| |
| 444 default; | |
| 445 ImageTransportSurfaceOverlayMac::SizeDependentState::~SizeDependentState() = | |
| 446 default; | |
| 447 | |
| 409 } // namespace gpu | 448 } // namespace gpu |
| OLD | NEW |