| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 base::StringPrintf("window %s delegate %s controller %s", | 1230 base::StringPrintf("window %s delegate %s controller %s", |
| 1231 object_getClassName(window), | 1231 object_getClassName(window), |
| 1232 object_getClassName([window delegate]), | 1232 object_getClassName([window delegate]), |
| 1233 object_getClassName([window windowController])); | 1233 object_getClassName([window windowController])); |
| 1234 base::debug::SetCrashKeyValue(kCrashKey, value); | 1234 base::debug::SetCrashKeyValue(kCrashKey, value); |
| 1235 } | 1235 } |
| 1236 | 1236 |
| 1237 return true; | 1237 return true; |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 bool should_post_notification = false; | |
| 1241 | |
| 1242 if (use_core_animation_) { | 1240 if (use_core_animation_) { |
| 1243 if (!CreateCompositedIOSurfaceAndLayer()) { | 1241 if (!CreateCompositedIOSurfaceAndLayer()) { |
| 1244 LOG(ERROR) << "Failed to create CompositingIOSurface or its layer"; | 1242 LOG(ERROR) << "Failed to create CompositingIOSurface or its layer"; |
| 1245 return false; | 1243 return false; |
| 1246 } | 1244 } |
| 1247 } else { | 1245 } else { |
| 1248 if (!compositing_iosurface_) { | 1246 if (!compositing_iosurface_) { |
| 1249 compositing_iosurface_.reset( | 1247 compositing_iosurface_.reset( |
| 1250 CompositingIOSurfaceMac::Create(window_number())); | 1248 CompositingIOSurfaceMac::Create(window_number())); |
| 1251 } | 1249 } |
| 1252 if (!compositing_iosurface_) { | 1250 if (!compositing_iosurface_) { |
| 1253 LOG(ERROR) << "Failed to create CompositingIOSurfaceMac"; | 1251 LOG(ERROR) << "Failed to create CompositingIOSurfaceMac"; |
| 1254 return false; | 1252 return false; |
| 1255 } | 1253 } |
| 1256 } | 1254 } |
| 1257 should_post_notification = true; | |
| 1258 | 1255 |
| 1259 if (!compositing_iosurface_->SetIOSurface( | 1256 if (!compositing_iosurface_->SetIOSurface( |
| 1260 surface_handle, size, surface_scale_factor, latency_info)) { | 1257 surface_handle, size, surface_scale_factor, latency_info)) { |
| 1261 LOG(ERROR) << "Failed SetIOSurface on CompositingIOSurfaceMac"; | 1258 LOG(ERROR) << "Failed SetIOSurface on CompositingIOSurfaceMac"; |
| 1262 return false; | 1259 return false; |
| 1263 } | 1260 } |
| 1264 | 1261 |
| 1265 GotAcceleratedFrame(); | 1262 GotAcceleratedFrame(); |
| 1266 | 1263 |
| 1267 gfx::Size window_size(NSSizeToCGSize([cocoa_view_ frame].size)); | 1264 gfx::Size window_size(NSSizeToCGSize([cocoa_view_ frame].size)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1279 [compositing_iosurface_layer_ setNeedsDisplay]; | 1276 [compositing_iosurface_layer_ setNeedsDisplay]; |
| 1280 } else { | 1277 } else { |
| 1281 if (!compositing_iosurface_->DrawIOSurface(this)) { | 1278 if (!compositing_iosurface_->DrawIOSurface(this)) { |
| 1282 [cocoa_view_ setNeedsDisplay:YES]; | 1279 [cocoa_view_ setNeedsDisplay:YES]; |
| 1283 GotAcceleratedCompositingError(); | 1280 GotAcceleratedCompositingError(); |
| 1284 return false; | 1281 return false; |
| 1285 } | 1282 } |
| 1286 } | 1283 } |
| 1287 } | 1284 } |
| 1288 | 1285 |
| 1289 if (should_post_notification && [[cocoa_view_ delegate] | |
| 1290 respondsToSelector:@selector(compositingIOSurfaceCreated)]) { | |
| 1291 [[cocoa_view_ delegate] compositingIOSurfaceCreated]; | |
| 1292 } | |
| 1293 | |
| 1294 return true; | 1286 return true; |
| 1295 } | 1287 } |
| 1296 | 1288 |
| 1297 void RenderWidgetHostViewMac::AckPendingSwapBuffers() { | 1289 void RenderWidgetHostViewMac::AckPendingSwapBuffers() { |
| 1298 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::AckPendingSwapBuffers"); | 1290 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::AckPendingSwapBuffers"); |
| 1299 | 1291 |
| 1300 // Cancel any outstanding delayed calls to this function. | 1292 // Cancel any outstanding delayed calls to this function. |
| 1301 pending_swap_buffers_acks_weak_factory_.InvalidateWeakPtrs(); | 1293 pending_swap_buffers_acks_weak_factory_.InvalidateWeakPtrs(); |
| 1302 | 1294 |
| 1303 while (!pending_swap_buffers_acks_.empty()) { | 1295 while (!pending_swap_buffers_acks_.empty()) { |
| (...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3723 return YES; | 3715 return YES; |
| 3724 } | 3716 } |
| 3725 | 3717 |
| 3726 - (BOOL)isOpaque { | 3718 - (BOOL)isOpaque { |
| 3727 if (renderWidgetHostView_->use_core_animation_) | 3719 if (renderWidgetHostView_->use_core_animation_) |
| 3728 return YES; | 3720 return YES; |
| 3729 return [super isOpaque]; | 3721 return [super isOpaque]; |
| 3730 } | 3722 } |
| 3731 | 3723 |
| 3732 @end | 3724 @end |
| OLD | NEW |