Chromium Code Reviews| 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 <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 "app/app_switches.h" | 9 #include "app/app_switches.h" |
| 10 #include "app/surface/io_surface_support_mac.h" | 10 #include "app/surface/io_surface_support_mac.h" |
| 11 #import "base/chrome_application_mac.h" | 11 #import "base/chrome_application_mac.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/mac/scoped_cftyperef.h" | 14 #include "base/mac/scoped_cftyperef.h" |
| 15 #import "base/mac/scoped_nsautorelease_pool.h" | 15 #import "base/mac/scoped_nsautorelease_pool.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #import "base/scoped_nsobject.h" | 17 #import "base/scoped_nsobject.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 20 #include "base/sys_string_conversions.h" | 20 #include "base/sys_string_conversions.h" |
| 21 #import "chrome/browser/accessibility/browser_accessibility_cocoa.h" | 21 #import "chrome/browser/accessibility/browser_accessibility_cocoa.h" |
| 22 #include "chrome/browser/accessibility/browser_accessibility_state.h" | 22 #include "chrome/browser/accessibility/browser_accessibility_state.h" |
| 23 #include "chrome/browser/browser_thread.h" | 23 #include "chrome/browser/browser_thread.h" |
| 24 #include "chrome/browser/browser_trial.h" | 24 #include "chrome/browser/browser_trial.h" |
| 25 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" | 25 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" |
| 26 #import "chrome/browser/cocoa/view_id_util.h" | 26 #import "chrome/browser/cocoa/view_id_util.h" |
| 27 #include "chrome/browser/gpu_process_host.h" | |
| 27 #include "chrome/browser/plugin_process_host.h" | 28 #include "chrome/browser/plugin_process_host.h" |
| 28 #include "chrome/browser/renderer_host/backing_store_mac.h" | 29 #include "chrome/browser/renderer_host/backing_store_mac.h" |
| 29 #include "chrome/browser/renderer_host/render_process_host.h" | 30 #include "chrome/browser/renderer_host/render_process_host.h" |
| 30 #include "chrome/browser/renderer_host/render_view_host.h" | 31 #include "chrome/browser/renderer_host/render_view_host.h" |
| 31 #include "chrome/browser/renderer_host/render_widget_host.h" | 32 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 32 #include "chrome/browser/spellchecker_platform_engine.h" | 33 #include "chrome/browser/spellchecker_platform_engine.h" |
| 33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/native_web_keyboard_event.h" | 35 #include "chrome/common/native_web_keyboard_event.h" |
| 35 #include "chrome/common/edit_command.h" | 36 #include "chrome/common/edit_command.h" |
| 37 #include "chrome/common/gpu_messages.h" | |
| 36 #include "chrome/common/plugin_messages.h" | 38 #include "chrome/common/plugin_messages.h" |
| 37 #include "chrome/common/render_messages.h" | 39 #include "chrome/common/render_messages.h" |
| 38 #include "skia/ext/platform_canvas.h" | 40 #include "skia/ext/platform_canvas.h" |
| 39 #include "third_party/skia/include/core/SkColor.h" | 41 #include "third_party/skia/include/core/SkColor.h" |
| 40 #include "third_party/WebKit/WebKit/chromium/public/mac/WebInputEventFactory.h" | 42 #include "third_party/WebKit/WebKit/chromium/public/mac/WebInputEventFactory.h" |
| 41 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 43 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 42 #include "webkit/glue/plugins/webplugin.h" | 44 #include "webkit/glue/plugins/webplugin.h" |
| 43 #include "webkit/glue/webaccessibility.h" | 45 #include "webkit/glue/webaccessibility.h" |
| 44 #import "third_party/mozilla/ComplexTextInputPanel.h" | 46 #import "third_party/mozilla/ComplexTextInputPanel.h" |
| 45 | 47 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 scoped_nsobject<NSOpenGLPixelFormat> glPixelFormat_; | 165 scoped_nsobject<NSOpenGLPixelFormat> glPixelFormat_; |
| 164 CGLPixelFormatObj cglPixelFormat_; // weak, backed by |glPixelFormat_|. | 166 CGLPixelFormatObj cglPixelFormat_; // weak, backed by |glPixelFormat_|. |
| 165 scoped_nsobject<NSOpenGLContext> glContext_; | 167 scoped_nsobject<NSOpenGLContext> glContext_; |
| 166 CGLContextObj cglContext_; // weak, backed by |glContext_|. | 168 CGLContextObj cglContext_; // weak, backed by |glContext_|. |
| 167 | 169 |
| 168 CVDisplayLinkRef displayLink_; // Owned by us. | 170 CVDisplayLinkRef displayLink_; // Owned by us. |
| 169 | 171 |
| 170 RenderWidgetHostViewMac* renderWidgetHostView_; // weak | 172 RenderWidgetHostViewMac* renderWidgetHostView_; // weak |
| 171 gfx::PluginWindowHandle pluginHandle_; // weak | 173 gfx::PluginWindowHandle pluginHandle_; // weak |
| 172 | 174 |
| 173 // True if the backing IO surface was updated since we last painted. | 175 // The number of swap buffers calls that have been requested by the |
| 174 BOOL surfaceWasSwapped_; | 176 // GPU process, or a monotonically increasing number of calls to |
| 177 // updateSwapBuffersCount:fromRenderer:routeId: if the update came | |
| 178 // from an accelerated plugin. | |
| 179 uint64 swapBuffersCount_; | |
| 180 // The number of swap buffers calls that have been processed by the | |
| 181 // display link thread. This is only used with the GPU process | |
| 182 // update path. | |
| 183 volatile uint64 acknowledgedSwapBuffersCount_; | |
| 184 | |
| 185 // Auxiliary information needed to formulate an acknowledgment to | |
| 186 // the GPU process. These are constant after the first message. | |
| 187 // These are both zero for updates coming from a plugin process. | |
| 188 volatile int rendererId_; | |
| 189 volatile int32 routeId_; | |
| 175 | 190 |
| 176 // Cocoa methods can only be called on the main thread, so have a copy of the | 191 // Cocoa methods can only be called on the main thread, so have a copy of the |
| 177 // view's size, since it's required on the displaylink thread. | 192 // view's size, since it's required on the displaylink thread. |
| 178 NSSize cachedSize_; | 193 NSSize cachedSize_; |
| 179 | 194 |
| 180 // -globalFrameDidChange: can be called recursively, this counts how often it | 195 // -globalFrameDidChange: can be called recursively, this counts how often it |
| 181 // holds the CGL lock. | 196 // holds the CGL lock. |
| 182 int globalFrameDidChangeCGLLockCount_; | 197 int globalFrameDidChangeCGLLockCount_; |
| 183 } | 198 } |
| 184 | 199 |
| 185 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r | 200 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r |
| 186 pluginHandle:(gfx::PluginWindowHandle)pluginHandle; | 201 pluginHandle:(gfx::PluginWindowHandle)pluginHandle; |
| 187 - (void)drawView; | 202 - (void)drawView; |
| 188 | 203 |
| 204 // Updates the number of swap buffers calls that have been requested. | |
| 205 // This is currently called with non-zero values only in response to | |
| 206 // updates from the GPU process. For accelerated plugins, all zeros | |
| 207 // are passed, and the view takes this as a hint that no flow control | |
| 208 // or acknowledgment of the swap buffers are desired. | |
| 209 - (void)updateSwapBuffersCount:(uint64)count | |
| 210 fromRenderer:(int)rendererId | |
| 211 routeId:(int32)routeId; | |
| 212 | |
| 189 // NSViews autorelease subviews when they die. The RWHVMac gets destroyed when | 213 // NSViews autorelease subviews when they die. The RWHVMac gets destroyed when |
| 190 // RHWVCocoa gets dealloc'd, which means the AcceleratedPluginView child views | 214 // RHWVCocoa gets dealloc'd, which means the AcceleratedPluginView child views |
| 191 // can be around a little longer than the RWHVMac. This is called when the | 215 // can be around a little longer than the RWHVMac. This is called when the |
| 192 // RWHVMac is about to be deleted (but it's still valid while this method runs). | 216 // RWHVMac is about to be deleted (but it's still valid while this method runs). |
| 193 - (void)onRenderWidgetHostViewGone; | 217 - (void)onRenderWidgetHostViewGone; |
| 194 | 218 |
| 195 // This _must_ be atomic, since it's accessed from several threads. | 219 // This _must_ be atomic, since it's accessed from several threads. |
| 196 @property BOOL surfaceWasSwapped; | |
| 197 | |
| 198 // This _must_ be atomic, since it's accessed from several threads. | |
| 199 @property NSSize cachedSize; | 220 @property NSSize cachedSize; |
| 200 @end | 221 @end |
| 201 | 222 |
| 202 @implementation AcceleratedPluginView | 223 @implementation AcceleratedPluginView |
| 203 @synthesize surfaceWasSwapped = surfaceWasSwapped_; | |
| 204 @synthesize cachedSize = cachedSize_; | 224 @synthesize cachedSize = cachedSize_; |
| 205 | 225 |
| 206 - (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime { | 226 - (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime { |
| 207 // There is no autorelease pool when this method is called because it will be | 227 // There is no autorelease pool when this method is called because it will be |
| 208 // called from a background thread. | 228 // called from a background thread. |
| 209 base::mac::ScopedNSAutoreleasePool pool; | 229 base::mac::ScopedNSAutoreleasePool pool; |
| 210 | 230 |
| 211 if (![self surfaceWasSwapped]) | 231 bool sendAck = (rendererId_ != 0 || routeId_ != 0); |
| 232 uint64 currentSwapBuffersCount = swapBuffersCount_; | |
| 233 if (currentSwapBuffersCount == acknowledgedSwapBuffersCount_) { | |
| 212 return kCVReturnSuccess; | 234 return kCVReturnSuccess; |
| 235 } | |
| 213 | 236 |
| 214 [self drawView]; | 237 [self drawView]; |
| 215 [self setSurfaceWasSwapped:NO]; | 238 |
| 239 acknowledgedSwapBuffersCount_ = currentSwapBuffersCount; | |
| 240 if (sendAck && renderWidgetHostView_) { | |
| 241 renderWidgetHostView_->AcknowledgeSwapBuffers( | |
| 242 rendererId_, | |
| 243 routeId_, | |
| 244 acknowledgedSwapBuffersCount_); | |
| 245 } | |
| 246 | |
| 216 return kCVReturnSuccess; | 247 return kCVReturnSuccess; |
| 217 } | 248 } |
| 218 | 249 |
| 219 // This is the renderer output callback function | 250 // This is the renderer output callback function |
| 220 static CVReturn DrawOneAcceleratedPluginCallback( | 251 static CVReturn DrawOneAcceleratedPluginCallback( |
| 221 CVDisplayLinkRef displayLink, | 252 CVDisplayLinkRef displayLink, |
| 222 const CVTimeStamp* now, | 253 const CVTimeStamp* now, |
| 223 const CVTimeStamp* outputTime, | 254 const CVTimeStamp* outputTime, |
| 224 CVOptionFlags flagsIn, | 255 CVOptionFlags flagsIn, |
| 225 CVOptionFlags* flagsOut, | 256 CVOptionFlags* flagsOut, |
| 226 void* displayLinkContext) { | 257 void* displayLinkContext) { |
| 227 CVReturn result = | 258 CVReturn result = |
| 228 [(AcceleratedPluginView*)displayLinkContext getFrameForTime:outputTime]; | 259 [(AcceleratedPluginView*)displayLinkContext getFrameForTime:outputTime]; |
| 229 return result; | 260 return result; |
| 230 } | 261 } |
| 231 | 262 |
| 232 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r | 263 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r |
| 233 pluginHandle:(gfx::PluginWindowHandle)pluginHandle { | 264 pluginHandle:(gfx::PluginWindowHandle)pluginHandle { |
| 234 if ((self = [super initWithFrame:NSZeroRect])) { | 265 if ((self = [super initWithFrame:NSZeroRect])) { |
| 235 renderWidgetHostView_ = r; | 266 renderWidgetHostView_ = r; |
| 236 pluginHandle_ = pluginHandle; | 267 pluginHandle_ = pluginHandle; |
| 237 cachedSize_ = NSZeroSize; | 268 cachedSize_ = NSZeroSize; |
| 269 swapBuffersCount_ = 0; | |
| 270 acknowledgedSwapBuffersCount_ = 0; | |
| 271 rendererId_ = 0; | |
| 272 routeId_ = 0; | |
| 238 | 273 |
| 239 [self setAutoresizingMask:NSViewMaxXMargin|NSViewMinYMargin]; | 274 [self setAutoresizingMask:NSViewMaxXMargin|NSViewMinYMargin]; |
| 240 | 275 |
| 241 NSOpenGLPixelFormatAttribute attributes[] = | 276 NSOpenGLPixelFormatAttribute attributes[] = |
| 242 { NSOpenGLPFAAccelerated, NSOpenGLPFADoubleBuffer, 0}; | 277 { NSOpenGLPFAAccelerated, NSOpenGLPFADoubleBuffer, 0}; |
| 243 | 278 |
| 244 glPixelFormat_.reset([[NSOpenGLPixelFormat alloc] | 279 glPixelFormat_.reset([[NSOpenGLPixelFormat alloc] |
| 245 initWithAttributes:attributes]); | 280 initWithAttributes:attributes]); |
| 246 glContext_.reset([[NSOpenGLContext alloc] initWithFormat:glPixelFormat_ | 281 glContext_.reset([[NSOpenGLContext alloc] initWithFormat:glPixelFormat_ |
| 247 shareContext:nil]); | 282 shareContext:nil]); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 // Called on a background thread. Synchronized via the CGL context lock. | 318 // Called on a background thread. Synchronized via the CGL context lock. |
| 284 CGLLockContext(cglContext_); | 319 CGLLockContext(cglContext_); |
| 285 | 320 |
| 286 if (renderWidgetHostView_) { | 321 if (renderWidgetHostView_) { |
| 287 // TODO(thakis): Pixel or view coordinates for size? | 322 // TODO(thakis): Pixel or view coordinates for size? |
| 288 renderWidgetHostView_->DrawAcceleratedSurfaceInstance( | 323 renderWidgetHostView_->DrawAcceleratedSurfaceInstance( |
| 289 cglContext_, pluginHandle_, [self cachedSize]); | 324 cglContext_, pluginHandle_, [self cachedSize]); |
| 290 } | 325 } |
| 291 | 326 |
| 292 CGLFlushDrawable(cglContext_); | 327 CGLFlushDrawable(cglContext_); |
| 328 CGLSetCurrentContext(0); | |
| 293 CGLUnlockContext(cglContext_); | 329 CGLUnlockContext(cglContext_); |
| 294 } | 330 } |
| 295 | 331 |
| 332 - (void)updateSwapBuffersCount:(uint64)count | |
| 333 fromRenderer:(int)rendererId | |
| 334 routeId:(int32)routeId { | |
| 335 if (rendererId == 0 && routeId == 0) { | |
| 336 // This notification is coming from a plugin process, for which we | |
| 337 // don't have flow control implemented right now. Fake up a swap | |
| 338 // buffers count so that we can at least skip useless renders. | |
| 339 ++swapBuffersCount_; | |
| 340 } else { | |
| 341 rendererId_ = rendererId; | |
| 342 routeId_ = routeId; | |
| 343 swapBuffersCount_ = count; | |
| 344 } | |
| 345 } | |
| 346 | |
| 296 - (void)onRenderWidgetHostViewGone { | 347 - (void)onRenderWidgetHostViewGone { |
| 297 if (!renderWidgetHostView_) | 348 if (!renderWidgetHostView_) |
| 298 return; | 349 return; |
| 299 | 350 |
| 300 CGLLockContext(cglContext_); | 351 CGLLockContext(cglContext_); |
| 301 // Deallocate the plugin handle while we still can. | 352 // Deallocate the plugin handle while we still can. |
| 302 renderWidgetHostView_->DeallocFakePluginWindowHandle(pluginHandle_); | 353 renderWidgetHostView_->DeallocFakePluginWindowHandle(pluginHandle_); |
| 303 renderWidgetHostView_ = NULL; | 354 renderWidgetHostView_ = NULL; |
| 304 CGLUnlockContext(cglContext_); | 355 CGLUnlockContext(cglContext_); |
| 305 } | 356 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 333 CGLLockContext(cglContext_); | 384 CGLLockContext(cglContext_); |
| 334 // This call to -update can call -globalFrameDidChange: again, see | 385 // This call to -update can call -globalFrameDidChange: again, see |
| 335 // http://crbug.com/55754 comments 22 and 24. | 386 // http://crbug.com/55754 comments 22 and 24. |
| 336 [glContext_ update]; | 387 [glContext_ update]; |
| 337 | 388 |
| 338 // You would think that -update updates the viewport. You would be wrong. | 389 // You would think that -update updates the viewport. You would be wrong. |
| 339 CGLSetCurrentContext(cglContext_); | 390 CGLSetCurrentContext(cglContext_); |
| 340 NSSize size = [self frame].size; | 391 NSSize size = [self frame].size; |
| 341 glViewport(0, 0, size.width, size.height); | 392 glViewport(0, 0, size.width, size.height); |
| 342 | 393 |
| 394 CGLSetCurrentContext(0); | |
|
Nico
2010/11/24 23:43:29
Why did you add this line?
Ken Russell (switch to Gerrit)
2010/11/25 01:02:08
OpenGL's rules are that a context can only be curr
| |
| 343 CGLUnlockContext(cglContext_); | 395 CGLUnlockContext(cglContext_); |
| 344 globalFrameDidChangeCGLLockCount_--; | 396 globalFrameDidChangeCGLLockCount_--; |
| 345 | 397 |
| 346 if (globalFrameDidChangeCGLLockCount_ == 0) { | 398 if (globalFrameDidChangeCGLLockCount_ == 0) { |
| 347 // Make sure the view is synchronized with the correct display. | 399 // Make sure the view is synchronized with the correct display. |
| 348 CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext( | 400 CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext( |
| 349 displayLink_, cglContext_, cglPixelFormat_); | 401 displayLink_, cglContext_, cglPixelFormat_); |
| 350 } | 402 } |
| 351 } | 403 } |
| 352 | 404 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 931 int32 height, | 983 int32 height, |
| 932 TransportDIB::Handle transport_dib) { | 984 TransportDIB::Handle transport_dib) { |
| 933 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 985 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 934 plugin_container_manager_.SetSizeAndTransportDIB(window, | 986 plugin_container_manager_.SetSizeAndTransportDIB(window, |
| 935 width, | 987 width, |
| 936 height, | 988 height, |
| 937 transport_dib); | 989 transport_dib); |
| 938 } | 990 } |
| 939 | 991 |
| 940 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( | 992 void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( |
| 941 gfx::PluginWindowHandle window, uint64 surface_id) { | 993 gfx::PluginWindowHandle window, |
| 994 uint64 surface_id, | |
| 995 int renderer_id, | |
| 996 int32 route_id, | |
| 997 uint64 swap_buffers_count) { | |
| 942 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 998 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 943 PluginViewMap::iterator it = plugin_views_.find(window); | 999 PluginViewMap::iterator it = plugin_views_.find(window); |
| 944 DCHECK(plugin_views_.end() != it); | 1000 DCHECK(plugin_views_.end() != it); |
| 945 if (plugin_views_.end() == it) { | 1001 if (plugin_views_.end() == it) { |
| 946 return; | 1002 return; |
| 947 } | 1003 } |
| 948 DCHECK([it->second isKindOfClass:[AcceleratedPluginView class]]); | 1004 DCHECK([it->second isKindOfClass:[AcceleratedPluginView class]]); |
| 949 | 1005 |
| 950 plugin_container_manager_.SetSurfaceWasPaintedTo(window, surface_id); | 1006 plugin_container_manager_.SetSurfaceWasPaintedTo(window, surface_id); |
| 951 AcceleratedPluginView* view = | 1007 AcceleratedPluginView* view = |
| 952 static_cast<AcceleratedPluginView*>(it->second); | 1008 static_cast<AcceleratedPluginView*>(it->second); |
| 953 // The surface is hidden until its first paint, to not show gargabe. | 1009 // The surface is hidden until its first paint, to not show gargabe. |
| 954 if (plugin_container_manager_.SurfaceShouldBeVisible(window)) | 1010 if (plugin_container_manager_.SurfaceShouldBeVisible(window)) |
| 955 [view setHidden:NO]; | 1011 [view setHidden:NO]; |
| 956 [view setSurfaceWasSwapped:YES]; | 1012 [view updateSwapBuffersCount:swap_buffers_count |
| 1013 fromRenderer:renderer_id | |
| 1014 routeId:route_id]; | |
| 957 } | 1015 } |
| 958 | 1016 |
| 959 void RenderWidgetHostViewMac::UpdateRootGpuViewVisibility( | 1017 void RenderWidgetHostViewMac::UpdateRootGpuViewVisibility( |
| 960 bool show_gpu_widget) { | 1018 bool show_gpu_widget) { |
| 961 // Plugins are destroyed on page navigate. The compositor layer on the other | 1019 // Plugins are destroyed on page navigate. The compositor layer on the other |
| 962 // hand is created on demand and then stays alive until its renderer process | 1020 // hand is created on demand and then stays alive until its renderer process |
| 963 // dies (usually on cross-domain navigation). Instead, only a flag | 1021 // dies (usually on cross-domain navigation). Instead, only a flag |
| 964 // |is_gpu_rendering_active()| is flipped when the compositor output should be | 1022 // |is_gpu_rendering_active()| is flipped when the compositor output should be |
| 965 // shown/hidden. | 1023 // shown/hidden. |
| 966 // Show/hide the view belonging to the compositor here. | 1024 // Show/hide the view belonging to the compositor here. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 981 } | 1039 } |
| 982 } | 1040 } |
| 983 | 1041 |
| 984 void RenderWidgetHostViewMac::HandleDelayedGpuViewHiding() { | 1042 void RenderWidgetHostViewMac::HandleDelayedGpuViewHiding() { |
| 985 if (needs_gpu_visibility_update_after_repaint_) { | 1043 if (needs_gpu_visibility_update_after_repaint_) { |
| 986 UpdateRootGpuViewVisibility(false); | 1044 UpdateRootGpuViewVisibility(false); |
| 987 needs_gpu_visibility_update_after_repaint_ = false; | 1045 needs_gpu_visibility_update_after_repaint_ = false; |
| 988 } | 1046 } |
| 989 } | 1047 } |
| 990 | 1048 |
| 1049 namespace { | |
| 1050 class BuffersSwappedAcknowledger : public Task { | |
| 1051 public: | |
| 1052 BuffersSwappedAcknowledger( | |
| 1053 int renderer_id, | |
| 1054 int32 route_id, | |
| 1055 uint64 swap_buffers_count) | |
| 1056 : renderer_id_(renderer_id), | |
| 1057 route_id_(route_id), | |
| 1058 swap_buffers_count_(swap_buffers_count) { | |
| 1059 } | |
| 1060 | |
| 1061 void Run() { | |
| 1062 GpuProcessHost::Get()->Send( | |
| 1063 new GpuMsg_AcceleratedSurfaceBuffersSwappedACK( | |
| 1064 renderer_id_, route_id_, swap_buffers_count_)); | |
| 1065 } | |
| 1066 | |
| 1067 private: | |
|
apatrick_chromium
2010/11/24 23:56:09
indentation
Ken Russell (switch to Gerrit)
2010/11/25 01:02:08
Done.
| |
| 1068 int renderer_id_; | |
| 1069 int32 route_id_; | |
| 1070 uint64 swap_buffers_count_; | |
| 1071 | |
| 1072 DISALLOW_COPY_AND_ASSIGN(BuffersSwappedAcknowledger); | |
| 1073 }; | |
| 1074 } // anonymous namespace | |
| 1075 | |
| 1076 void RenderWidgetHostViewMac::AcknowledgeSwapBuffers( | |
| 1077 int renderer_id, | |
| 1078 int32 route_id, | |
| 1079 uint64 swap_buffers_count) { | |
| 1080 BrowserThread::PostTask( | |
| 1081 BrowserThread::IO, FROM_HERE, | |
| 1082 new BuffersSwappedAcknowledger( | |
| 1083 renderer_id, route_id, swap_buffers_count)); | |
| 1084 } | |
| 1085 | |
| 991 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { | 1086 void RenderWidgetHostViewMac::GpuRenderingStateDidChange() { |
| 992 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1087 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 993 if (GetRenderWidgetHost()->is_gpu_rendering_active()) { | 1088 if (GetRenderWidgetHost()->is_gpu_rendering_active()) { |
| 994 UpdateRootGpuViewVisibility( | 1089 UpdateRootGpuViewVisibility( |
| 995 GetRenderWidgetHost()->is_gpu_rendering_active()); | 1090 GetRenderWidgetHost()->is_gpu_rendering_active()); |
| 996 } else { | 1091 } else { |
| 997 needs_gpu_visibility_update_after_repaint_ = true; | 1092 needs_gpu_visibility_update_after_repaint_ = true; |
| 998 } | 1093 } |
| 999 } | 1094 } |
| 1000 | 1095 |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2579 if (!string) return NO; | 2674 if (!string) return NO; |
| 2580 | 2675 |
| 2581 // If the user is currently using an IME, confirm the IME input, | 2676 // If the user is currently using an IME, confirm the IME input, |
| 2582 // and then insert the text from the service, the same as TextEdit and Safari. | 2677 // and then insert the text from the service, the same as TextEdit and Safari. |
| 2583 [self confirmComposition]; | 2678 [self confirmComposition]; |
| 2584 [self insertText:string]; | 2679 [self insertText:string]; |
| 2585 return YES; | 2680 return YES; |
| 2586 } | 2681 } |
| 2587 | 2682 |
| 2588 @end | 2683 @end |
| OLD | NEW |