| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 // RenderWidgetHostViewMac, public: | 588 // RenderWidgetHostViewMac, public: |
| 589 | 589 |
| 590 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) | 590 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) |
| 591 : render_widget_host_(widget), | 591 : render_widget_host_(widget), |
| 592 about_to_validate_and_paint_(false), | 592 about_to_validate_and_paint_(false), |
| 593 call_set_needs_display_in_rect_pending_(false), | 593 call_set_needs_display_in_rect_pending_(false), |
| 594 text_input_type_(WebKit::WebTextInputTypeNone), | 594 text_input_type_(WebKit::WebTextInputTypeNone), |
| 595 is_loading_(false), | 595 is_loading_(false), |
| 596 is_hidden_(false), | 596 is_hidden_(false), |
| 597 shutdown_factory_(this), | 597 shutdown_factory_(this), |
| 598 needs_gpu_visibility_update_after_repaint_(false) { | 598 needs_gpu_visibility_update_after_repaint_(false), |
| 599 compositing_surface_(gfx::kNullPluginWindow) { |
| 599 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| goes away. | 600 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| goes away. |
| 600 // Since we autorelease it, our caller must put |native_view()| into the view | 601 // Since we autorelease it, our caller must put |native_view()| into the view |
| 601 // hierarchy right after calling us. | 602 // hierarchy right after calling us. |
| 602 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] | 603 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] |
| 603 initWithRenderWidgetHostViewMac:this] autorelease]; | 604 initWithRenderWidgetHostViewMac:this] autorelease]; |
| 604 render_widget_host_->set_view(this); | 605 render_widget_host_->set_view(this); |
| 605 | 606 |
| 606 // Turn on accessibility only if VoiceOver is running. | 607 // Turn on accessibility only if VoiceOver is running. |
| 607 if (IsVoiceOverRunning()) { | 608 if (IsVoiceOverRunning()) { |
| 608 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); | 609 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 // process won't process any GL commands until the browser sends a paint ack, | 1096 // process won't process any GL commands until the browser sends a paint ack, |
| 1096 // but since the browser window is already closed, it will never arrive. | 1097 // but since the browser window is already closed, it will never arrive. |
| 1097 // To resolve this we ask the GPU process to destroy the command buffer | 1098 // To resolve this we ask the GPU process to destroy the command buffer |
| 1098 // associated with the given render widget. Once the command buffer is | 1099 // associated with the given render widget. Once the command buffer is |
| 1099 // destroyed, all GL commands from the renderer will immediately receive | 1100 // destroyed, all GL commands from the renderer will immediately receive |
| 1100 // channel error. | 1101 // channel error. |
| 1101 if (render_widget_host_ && | 1102 if (render_widget_host_ && |
| 1102 plugin_container_manager_.IsRootContainer(window)) { | 1103 plugin_container_manager_.IsRootContainer(window)) { |
| 1103 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::GetForRenderer( | 1104 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::GetForRenderer( |
| 1104 render_widget_host_->process()->id(), | 1105 render_widget_host_->process()->id(), |
| 1105 content:: | 1106 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH); |
| 1106 CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETHOSTVIEWMAC_DEALLOCFAKEPLUGINWINDOWHA
NDLE); | |
| 1107 if (ui_shim) { | 1107 if (ui_shim) { |
| 1108 ui_shim->DidDestroyAcceleratedSurface( | 1108 ui_shim->DidDestroyAcceleratedSurface( |
| 1109 render_widget_host_->process()->id(), | 1109 render_widget_host_->process()->id(), |
| 1110 render_widget_host_->routing_id()); | 1110 render_widget_host_->routing_id()); |
| 1111 } | 1111 } |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 plugin_container_manager_.DestroyFakePluginWindowHandle(window); | 1114 plugin_container_manager_.DestroyFakePluginWindowHandle(window); |
| 1115 } | 1115 } |
| 1116 | 1116 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { | 1290 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { |
| 1291 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1291 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1292 if (GetRenderWidgetHost()->is_accelerated_compositing_active()) { | 1292 if (GetRenderWidgetHost()->is_accelerated_compositing_active()) { |
| 1293 UpdateRootGpuViewVisibility( | 1293 UpdateRootGpuViewVisibility( |
| 1294 GetRenderWidgetHost()->is_accelerated_compositing_active()); | 1294 GetRenderWidgetHost()->is_accelerated_compositing_active()); |
| 1295 } else { | 1295 } else { |
| 1296 needs_gpu_visibility_update_after_repaint_ = true; | 1296 needs_gpu_visibility_update_after_repaint_ = true; |
| 1297 } | 1297 } |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 gfx::PluginWindowHandle RenderWidgetHostViewMac::AcquireCompositingSurface() { | 1300 gfx::PluginWindowHandle RenderWidgetHostViewMac::GetCompositingSurface() { |
| 1301 return AllocateFakePluginWindowHandle(/*opaque=*/true, /*root=*/true); | 1301 if (compositing_surface_ == gfx::kNullPluginWindow) |
| 1302 } | 1302 compositing_surface_ = AllocateFakePluginWindowHandle( |
| 1303 | 1303 /*opaque=*/true, /*root=*/true); |
| 1304 void RenderWidgetHostViewMac::ReleaseCompositingSurface( | 1304 return compositing_surface_; |
| 1305 gfx::PluginWindowHandle surface) { | |
| 1306 DestroyFakePluginWindowHandle(surface); | |
| 1307 } | 1305 } |
| 1308 | 1306 |
| 1309 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( | 1307 void RenderWidgetHostViewMac::DrawAcceleratedSurfaceInstance( |
| 1310 CGLContextObj context, | 1308 CGLContextObj context, |
| 1311 gfx::PluginWindowHandle plugin_handle, | 1309 gfx::PluginWindowHandle plugin_handle, |
| 1312 NSSize size) { | 1310 NSSize size) { |
| 1313 // Called on the display link thread. | 1311 // Called on the display link thread. |
| 1314 CGLSetCurrentContext(context); | 1312 CGLSetCurrentContext(context); |
| 1315 | 1313 |
| 1316 glMatrixMode(GL_PROJECTION); | 1314 glMatrixMode(GL_PROJECTION); |
| (...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2939 if (!string) return NO; | 2937 if (!string) return NO; |
| 2940 | 2938 |
| 2941 // If the user is currently using an IME, confirm the IME input, | 2939 // If the user is currently using an IME, confirm the IME input, |
| 2942 // and then insert the text from the service, the same as TextEdit and Safari. | 2940 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2943 [self confirmComposition]; | 2941 [self confirmComposition]; |
| 2944 [self insertText:string]; | 2942 [self insertText:string]; |
| 2945 return YES; | 2943 return YES; |
| 2946 } | 2944 } |
| 2947 | 2945 |
| 2948 @end | 2946 @end |
| OLD | NEW |