diff options
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/command_buffer_proxy.cc | 19 | ||||
-rw-r--r-- | chrome/renderer/command_buffer_proxy.h | 9 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 42 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.h | 9 |
4 files changed, 24 insertions, 55 deletions
diff --git a/chrome/renderer/command_buffer_proxy.cc b/chrome/renderer/command_buffer_proxy.cc index b2eaa86..2b71fa8 100644 --- a/chrome/renderer/command_buffer_proxy.cc +++ b/chrome/renderer/command_buffer_proxy.cc @@ -37,8 +37,6 @@ CommandBufferProxy::~CommandBufferProxy() { void CommandBufferProxy::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(CommandBufferProxy, message) IPC_MESSAGE_HANDLER(CommandBufferMsg_UpdateState, OnUpdateState); - IPC_MESSAGE_HANDLER(CommandBufferMsg_NotifyRepaint, - OnNotifyRepaint); IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP() } @@ -144,7 +142,16 @@ Buffer CommandBufferProxy::GetTransferBuffer(int32 id) { } // Cache the transfer buffer shared memory object client side. - base::SharedMemory* shared_memory = new base::SharedMemory(handle, false); +#if defined(OS_WIN) + // TODO(piman): Does Windows needs this version of the constructor ? It + // duplicates the handle, but I'm not sure why it is necessary - it was + // already duped by the CommandBufferStub. + base::SharedMemory* shared_memory = + new base::SharedMemory(handle, false, base::GetCurrentProcessHandle()); +#else + base::SharedMemory* shared_memory = + new base::SharedMemory(handle, false); +#endif // Map the shared memory on demand. if (!shared_memory->memory()) { @@ -168,12 +175,6 @@ void CommandBufferProxy::SetToken(int32 token) { NOTREACHED(); } -void CommandBufferProxy::OnNotifyRepaint() { - if (notify_repaint_task_.get()) - MessageLoop::current()->PostNonNestableTask( - FROM_HERE, notify_repaint_task_.release()); -} - void CommandBufferProxy::SetParseError( gpu::error::Error error) { // Not implemented in proxy. diff --git a/chrome/renderer/command_buffer_proxy.h b/chrome/renderer/command_buffer_proxy.h index 990f6f3..a2fb9c4 100644 --- a/chrome/renderer/command_buffer_proxy.h +++ b/chrome/renderer/command_buffer_proxy.h @@ -51,12 +51,6 @@ class CommandBufferProxy : public gpu::CommandBuffer, virtual void SetToken(int32 token); virtual void SetParseError(gpu::error::Error error); - // Set a task that will be invoked the next time the window becomes invalid - // and needs to be repainted. Takes ownership of task. - void SetNotifyRepaintTask(Task* task) { - notify_repaint_task_.reset(task); - } - #if defined(OS_MACOSX) virtual void SetWindowSize(int32 width, int32 height); #endif @@ -77,7 +71,6 @@ class CommandBufferProxy : public gpu::CommandBuffer, private: // Message handlers: void OnUpdateState(gpu::CommandBuffer::State state); - void OnNotifyRepaint(); // As with the service, the client takes ownership of the ring buffer. int32 size_; @@ -97,8 +90,6 @@ class CommandBufferProxy : public gpu::CommandBuffer, typedef std::queue<linked_ptr<Task> > AsyncFlushTaskQueue; AsyncFlushTaskQueue pending_async_flush_tasks_; - scoped_ptr<Task> notify_repaint_task_; - DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); }; diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 94a43e2..ad8a952 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -168,7 +168,17 @@ void WebPluginDelegatePepper::UpdateGeometry( if (!instance()) return; - ForwardSetWindow(); + // 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_); } NPObject* WebPluginDelegatePepper::GetPluginScriptableObject() { @@ -363,11 +373,8 @@ 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) @@ -639,33 +646,6 @@ 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; } diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h index 29bc814..5082d64 100644 --- a/chrome/renderer/webplugin_delegate_pepper.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -150,12 +150,9 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { NPAPI::PluginInstance *instance); ~WebPluginDelegatePepper(); - // Set a task that calls the repaint callback the next time the window - // is invalid and needs to be repainted. - void ScheduleHandleRepaint(NPP npp, NPDeviceContext3D* context); - - void ForwardHandleRepaint(NPP npp, NPDeviceContext3D* context); - void ForwardSetWindow(); + // Tells the plugin about the current state of the window. + // See NPAPI NPP_SetWindow for more information. + void WindowlessSetWindow(bool force_set_window); //----------------------------------------- // used for windowed and windowless plugins |