diff options
Diffstat (limited to 'chrome/renderer/webplugin_delegate_pepper.cc')
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index ad8a952..94a43e2 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -168,17 +168,7 @@ void WebPluginDelegatePepper::UpdateGeometry( if (!instance()) return; - // TODO(sehr): do we need all this? - window_.clipRect.top = clip_rect_.y(); - window_.clipRect.left = clip_rect_.x(); - window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); - window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); - window_.height = window_rect_.height(); - window_.width = window_rect_.width(); - window_.x = window_rect_.x(); - window_.y = window_rect_.y(); - window_.type = NPWindowTypeDrawable; - instance()->NPP_SetWindow(&window_); + ForwardSetWindow(); } NPObject* WebPluginDelegatePepper::GetPluginScriptableObject() { @@ -373,8 +363,11 @@ NPError WebPluginDelegatePepper::Device3DInitializeContext( Buffer ring_buffer = command_buffer_->GetRingBuffer(); context->commandBuffer = ring_buffer.ptr; context->commandBufferSize = state.size; + context->repaintCallback = NULL; Synchronize3DContext(context, state); + ScheduleHandleRepaint(instance_->npp(), context); + // Ensure the service knows the window size before rendering anything. nested_delegate_->UpdateGeometry(window_rect_, clip_rect_); #if defined(OS_MACOSX) @@ -646,6 +639,33 @@ WebPluginDelegatePepper::~WebPluginDelegatePepper() { DestroyInstance(); } +void WebPluginDelegatePepper::ScheduleHandleRepaint( + NPP npp, NPDeviceContext3D* context) { + command_buffer_->SetNotifyRepaintTask(method_factory3d_.NewRunnableMethod( + &WebPluginDelegatePepper::ForwardHandleRepaint, + npp, + context)); +} + +void WebPluginDelegatePepper::ForwardHandleRepaint( + NPP npp, NPDeviceContext3D* context) { + context->repaintCallback(npp, context); + ScheduleHandleRepaint(npp, context); +} + +void WebPluginDelegatePepper::ForwardSetWindow() { + window_.clipRect.top = clip_rect_.y(); + window_.clipRect.left = clip_rect_.x(); + window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); + window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); + window_.height = window_rect_.height(); + window_.width = window_rect_.width(); + window_.x = window_rect_.x(); + window_.y = window_rect_.y(); + window_.type = NPWindowTypeDrawable; + instance()->NPP_SetWindow(&window_); +} + void WebPluginDelegatePepper::PluginDestroyed() { delete this; } |