summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 23:54:31 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 23:54:31 +0000
commit2727c73679b340aaf11c41ed4e57ada626f9c5a5 (patch)
tree8ce56f37c1a07fad0b97a6d6abaf372f0239eb86 /chrome/plugin
parentb49b27f504501ecafee601985176dcbad9540f56 (diff)
downloadchromium_src-2727c73679b340aaf11c41ed4e57ada626f9c5a5.zip
chromium_src-2727c73679b340aaf11c41ed4e57ada626f9c5a5.tar.gz
chromium_src-2727c73679b340aaf11c41ed4e57ada626f9c5a5.tar.bz2
Removed GPU plugin.
Pepper 3D v2 does not use the GPU plugin. It is integrated with the accelerated compositor. TEST=PPAPI 3D v2 still works, trybots BUG=none Review URL: http://codereview.chromium.org/6588090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/command_buffer_stub.cc195
-rw-r--r--chrome/plugin/command_buffer_stub.h84
-rw-r--r--chrome/plugin/command_buffer_stub_win.cc73
-rw-r--r--chrome/plugin/plugin_main.cc2
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc38
-rw-r--r--chrome/plugin/webplugin_delegate_stub.h9
6 files changed, 1 insertions, 400 deletions
diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc
deleted file mode 100644
index 9aea1ee..0000000
--- a/chrome/plugin/command_buffer_stub.cc
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/plugin/command_buffer_stub.h"
-
-#include "base/callback.h"
-#include "base/scoped_open_process.h"
-#include "base/shared_memory.h"
-#include "chrome/common/gpu_messages.h"
-#include "chrome/common/plugin_messages.h"
-#include "chrome/plugin/plugin_channel.h"
-
-using gpu::Buffer;
-
-CommandBufferStub::CommandBufferStub(PluginChannel* channel,
- int plugin_host_route_id,
- gfx::PluginWindowHandle window)
- : channel_(channel),
- plugin_host_route_id_(plugin_host_route_id),
- window_(window) {
- route_id_ = channel->GenerateRouteID();
- channel->AddRoute(route_id_, this, NULL);
-}
-
-CommandBufferStub::~CommandBufferStub() {
- Destroy();
- channel_->RemoveRoute(route_id_);
-}
-
-bool CommandBufferStub::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(CommandBufferStub, message)
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncGetState, OnAsyncGetState);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Flush, OnFlush);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateTransferBuffer,
- OnCreateTransferBuffer);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
- OnDestroyTransferBuffer);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetTransferBuffer,
- OnGetTransferBuffer);
-#if defined(OS_MACOSX)
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize);
-#endif
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- DCHECK(handled);
- return handled;
-}
-
-void CommandBufferStub::OnChannelError() {
- NOTREACHED() << "CommandBufferService::OnChannelError called";
-}
-
-bool CommandBufferStub::Send(IPC::Message* message) {
- if (!channel_) {
- delete message;
- return false;
- }
-
- return channel_->Send(message);
-}
-
-void CommandBufferStub::NotifyRepaint() {
- Send(new GpuCommandBufferMsg_NotifyRepaint(route_id_));
-}
-
-void CommandBufferStub::OnInitialize(base::SharedMemoryHandle ring_buffer,
- int32 size,
- bool* result) {
- // TODO(apatrick): Pepper3D v1 is not used anymore. This function is never
- // called. Delete the GPU plugin.
- NOTREACHED();
- *result = false;
-}
-
-void CommandBufferStub::OnGetState(gpu::CommandBuffer::State* state) {
- *state = command_buffer_->GetState();
-}
-
-void CommandBufferStub::OnAsyncGetState() {
- gpu::CommandBuffer::State state = command_buffer_->GetState();
- Send(new GpuCommandBufferMsg_UpdateState(route_id_, state));
-}
-
-void CommandBufferStub::OnFlush(int32 put_offset,
- gpu::CommandBuffer::State* state) {
- *state = command_buffer_->FlushSync(put_offset);
-}
-
-void CommandBufferStub::OnAsyncFlush(int32 put_offset) {
- gpu::CommandBuffer::State state = command_buffer_->FlushSync(put_offset);
- Send(new GpuCommandBufferMsg_UpdateState(route_id_, state));
-}
-
-void CommandBufferStub::OnCreateTransferBuffer(int32 size, int32* id) {
- *id = command_buffer_->CreateTransferBuffer(size);
-}
-
-void CommandBufferStub::OnDestroyTransferBuffer(int32 id) {
- command_buffer_->DestroyTransferBuffer(id);
-}
-
-void CommandBufferStub::OnGetTransferBuffer(
- int32 id,
- base::SharedMemoryHandle* transfer_buffer,
- uint32* size) {
- *transfer_buffer = base::SharedMemoryHandle();
- *size = 0;
-
- // Assume service is responsible for duplicating the handle to the calling
- // process.
- base::ProcessHandle peer_handle;
- if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle))
- return;
-
- Buffer buffer = command_buffer_->GetTransferBuffer(id);
- if (buffer.shared_memory) {
- buffer.shared_memory->ShareToProcess(peer_handle, transfer_buffer);
- *size = buffer.shared_memory->created_size();
- }
-
- base::CloseProcessHandle(peer_handle);
-}
-
-void CommandBufferStub::Destroy() {
- processor_.reset();
- command_buffer_.reset();
-
- DestroyPlatformSpecific();
-}
-
-#if !defined(OS_WIN)
-bool CommandBufferStub::InitializePlatformSpecific() {
- return true;
-}
-
-void CommandBufferStub::DestroyPlatformSpecific() {
-}
-#endif // defined(OS_WIN)
-
-#if defined(OS_MACOSX)
-void CommandBufferStub::OnSetWindowSize(const gfx::Size& size) {
- // Try using the IOSurface version first.
- bool notify_repaint = false;
- uint64 new_backing_store = processor_->SetWindowSizeForIOSurface(size);
- if (new_backing_store) {
- Send(new PluginHostMsg_AcceleratedSurfaceSetIOSurface(
- plugin_host_route_id_,
- window_,
- size.width(),
- size.height(),
- new_backing_store));
- notify_repaint = true;
- } else {
- // If |new_backing_store| is 0, it might mean that the IOSurface APIs are
- // not available. In this case, see if TransportDIBs are supported.
- TransportDIB::Handle transport_dib =
- processor_->SetWindowSizeForTransportDIB(size);
- if (TransportDIB::is_valid(transport_dib)) {
- Send(new PluginHostMsg_AcceleratedSurfaceSetTransportDIB(
- plugin_host_route_id_,
- window_,
- size.width(),
- size.height(),
- transport_dib));
- notify_repaint = true;
- }
- }
- if (notify_repaint) {
- // Indicate to the client that at least one repaint is needed.
- NotifyRepaint();
- }
-}
-
-void CommandBufferStub::SwapBuffersCallback() {
- Send(new PluginHostMsg_AcceleratedSurfaceBuffersSwapped(
- plugin_host_route_id_, window_, processor_->GetSurfaceId()));
-}
-
-void CommandBufferStub::AllocTransportDIB(const size_t size,
- TransportDIB::Handle* dib_handle) {
- Send(new PluginHostMsg_AllocTransportDIB(plugin_host_route_id_,
- size,
- dib_handle));
-}
-
-void CommandBufferStub::FreeTransportDIB(TransportDIB::Id dib_id) {
- Send(new PluginHostMsg_FreeTransportDIB(plugin_host_route_id_,
- dib_id));
-}
-#endif
diff --git a/chrome/plugin/command_buffer_stub.h b/chrome/plugin/command_buffer_stub.h
deleted file mode 100644
index a2667f1..0000000
--- a/chrome/plugin/command_buffer_stub.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_PLUGIN_COMMAND_BUFFER_STUB_H_
-#define CHROME_PLUGIN_COMMAND_BUFFER_STUB_H_
-#pragma once
-
-#if defined(ENABLE_GPU)
-
-#include "app/surface/transport_dib.h"
-#include "base/ref_counted.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/command_buffer/service/gpu_processor.h"
-#include "ipc/ipc_channel.h"
-#include "ipc/ipc_message.h"
-#include "ui/gfx/native_widget_types.h"
-
-class PluginChannel;
-
-class CommandBufferService;
-
-class CommandBufferStub : public IPC::Channel::Listener,
- public IPC::Message::Sender {
- public:
- CommandBufferStub(PluginChannel* channel,
- int plugin_host_route_id,
- gfx::PluginWindowHandle window);
-
- virtual ~CommandBufferStub();
-
- // IPC::Channel::Listener implementation:
- virtual bool OnMessageReceived(const IPC::Message& message);
- virtual void OnChannelError();
-
- // IPC::Message::Sender implementation:
- virtual bool Send(IPC::Message* msg);
-
- int route_id() const { return route_id_; }
-
- // Notify the client that it must repaint due to the window becoming invalid
- // or a lost context.
- void NotifyRepaint();
-
- private:
- // Message handlers:
- void OnInitialize(base::SharedMemoryHandle ring_buffer,
- int32 size,
- bool* result);
- void OnGetState(gpu::CommandBuffer::State* state);
- void OnAsyncGetState();
- void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state);
- void OnAsyncFlush(int32 put_offset);
- void OnCreateTransferBuffer(int32 size, int32* id);
- void OnDestroyTransferBuffer(int32 id);
- void OnGetTransferBuffer(int32 id,
- base::SharedMemoryHandle* transfer_buffer,
- uint32* size);
-
- // Destroy all owned objects.
- void Destroy();
-
- bool InitializePlatformSpecific();
- void DestroyPlatformSpecific();
-
-#if defined(OS_MACOSX)
- void OnSetWindowSize(const gfx::Size& size);
- void SwapBuffersCallback();
- void AllocTransportDIB(const size_t size, TransportDIB::Handle* dib_handle);
- void FreeTransportDIB(TransportDIB::Id dib_id);
-#endif
-
- scoped_refptr<PluginChannel> channel_;
- int plugin_host_route_id_;
- gfx::PluginWindowHandle window_;
- int route_id_;
- scoped_ptr<gpu::CommandBufferService> command_buffer_;
- scoped_ptr<gpu::GPUProcessor> processor_;
-};
-
-#endif // ENABLE_GPU
-
-#endif // CHROME_PLUGIN_COMMAND_BUFFER_STUB_H_
diff --git a/chrome/plugin/command_buffer_stub_win.cc b/chrome/plugin/command_buffer_stub_win.cc
deleted file mode 100644
index 11369a6..0000000
--- a/chrome/plugin/command_buffer_stub_win.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <windows.h>
-
-#include "chrome/plugin/command_buffer_stub.h"
-
-namespace {
-const wchar_t* kPreviousWndProcProperty = L"CommandBufferStubPrevWndProc";
-const wchar_t* kCommandBufferStubProperty = L"CommandBufferStub";
-
-// Message handler for the GPU plugin's child window. Used to intercept
-// WM_PAINT events and forward repaint notifications to the client.
-LRESULT WINAPI WndProc(HWND handle,
- UINT message,
- WPARAM w_param,
- LPARAM l_param) {
- WNDPROC previous_wnd_proc = reinterpret_cast<WNDPROC>(
- ::GetProp(handle, kPreviousWndProcProperty));
- CommandBufferStub* stub = reinterpret_cast<CommandBufferStub*>(
- ::GetProp(handle, kCommandBufferStubProperty));
-
- switch (message) {
- case WM_ERASEBKGND:
- // Do not clear background. Avoids flickering.
- return 1;
- case WM_PAINT:
- // Validate the whole window to prevent another WM_PAINT message.
- ValidateRect(handle, NULL);
-
- // Notify client that the window is invalid and needs to be repainted.
- stub->NotifyRepaint();
-
- return 1;
- default:
- return CallWindowProc(previous_wnd_proc,
- handle,
- message,
- w_param,
- l_param);
- }
-}
-} // namespace anonymous
-
-bool CommandBufferStub::InitializePlatformSpecific() {
- // Subclass window.
- WNDPROC previous_wnd_proc = reinterpret_cast<WNDPROC>(
- ::GetWindowLongPtr(window_, GWLP_WNDPROC));
- ::SetProp(window_,
- kPreviousWndProcProperty,
- reinterpret_cast<HANDLE>(previous_wnd_proc));
- ::SetWindowLongPtr(window_,
- GWLP_WNDPROC,
- reinterpret_cast<LONG_PTR>(WndProc));
-
- // Record pointer to this in window.
- ::SetProp(window_,
- kCommandBufferStubProperty,
- reinterpret_cast<HANDLE>(this));
-
- return true;
-}
-
-void CommandBufferStub::DestroyPlatformSpecific() {
- // Restore window.
- WNDPROC previous_wnd_proc = reinterpret_cast<WNDPROC>(
- ::GetProp(window_, kPreviousWndProcProperty));
- ::SetWindowLongPtr(window_, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(
- previous_wnd_proc));
- ::RemoveProp(window_, kPreviousWndProcProperty);
- ::RemoveProp(window_, kCommandBufferStubProperty);
-}
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index 5c94e52..d8264fe 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -17,7 +17,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/default_plugin.h"
-#include "chrome/common/gpu_plugin.h"
#include "chrome/common/hi_res_timer_manager.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h"
@@ -174,7 +173,6 @@ int PluginMain(const MainFunctionParams& parameters) {
#endif
chrome::RegisterInternalDefaultPlugin();
- chrome::RegisterInternalGPUPlugin();
MessageLoop::current()->Run();
}
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index 75a3dc8..0624e3e 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -28,10 +28,6 @@
#include "printing/native_metafile.h"
#endif // defined(OS_WIN)
-#if defined(ENABLE_GPU)
-#include "app/gfx/gl/gl_context.h"
-#endif
-
using WebKit::WebBindings;
using WebKit::WebCursorInfo;
using webkit::npapi::WebPlugin;
@@ -72,13 +68,6 @@ WebPluginDelegateStub::~WebPluginDelegateStub() {
in_destructor_ = true;
child_process_logging::SetActiveURL(page_url_);
-#if defined(ENABLE_GPU)
- // Make sure there is no command buffer before destroying the window handle.
- // The GPU service code might otherwise asynchronously perform an operation
- // using the window handle.
- command_buffer_stub_.reset();
-#endif
-
if (channel_->in_send()) {
// The delegate or an npobject is in the callstack, so don't delete it
// right away.
@@ -144,10 +133,6 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
OnHandleURLRequestReply)
IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply,
OnHTTPRangeRequestReply)
- IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer,
- OnCreateCommandBuffer)
- IPC_MESSAGE_HANDLER(PluginMsg_DestroyCommandBuffer,
- OnDestroyCommandBuffer)
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle,
OnSetFakeAcceleratedSurfaceWindowHandle)
@@ -416,29 +401,6 @@ void WebPluginDelegateStub::OnInstallMissingPlugin() {
delegate_->InstallMissingPlugin();
}
-void WebPluginDelegateStub::OnCreateCommandBuffer(int* route_id) {
- *route_id = 0;
-#if defined(ENABLE_GPU)
- // Fail to create the command buffer if some GL implementation cannot be
- // initialized.
- if (!gfx::GLContext::InitializeOneOff())
- return;
-
- command_buffer_stub_.reset(new CommandBufferStub(
- channel_,
- instance_id_,
- delegate_->windowed_handle()));
-
- *route_id = command_buffer_stub_->route_id();
-#endif // ENABLE_GPU
-}
-
-void WebPluginDelegateStub::OnDestroyCommandBuffer() {
-#if defined(ENABLE_GPU)
- command_buffer_stub_.reset();
-#endif
-}
-
void WebPluginDelegateStub::CreateSharedBuffer(
uint32 size,
base::SharedMemory* shared_buf,
diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h
index e769a84..b56bca7 100644
--- a/chrome/plugin/webplugin_delegate_stub.h
+++ b/chrome/plugin/webplugin_delegate_stub.h
@@ -12,10 +12,10 @@
#include "base/ref_counted.h"
#include "base/shared_memory.h"
#include "base/task.h"
-#include "chrome/plugin/command_buffer_stub.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_channel.h"
#include "third_party/npapi/bindings/npapi.h"
+#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
class PluginChannel;
@@ -103,8 +103,6 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
const GURL& url,
int notify_id);
void OnHTTPRangeRequestReply(unsigned long resource_id, int range_request_id);
- void OnCreateCommandBuffer(int* route_id);
- void OnDestroyCommandBuffer();
void CreateSharedBuffer(uint32 size,
base::SharedMemory* shared_buf,
@@ -123,17 +121,12 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
GURL page_url_;
#if defined(ENABLE_GPU)
- // If this is the GPU plugin, the stub object that forwards to the
- // command buffer service.
- scoped_ptr<CommandBufferStub> command_buffer_stub_;
-
#if defined(OS_MACOSX)
// If this is a GPU-accelerated plug-in, we need to be able to receive a fake
// window handle which is used for subsequent communication back to the
// browser.
void OnSetFakeAcceleratedSurfaceWindowHandle(gfx::PluginWindowHandle window);
#endif
-
#endif
DISALLOW_IMPLICIT_CONSTRUCTORS(WebPluginDelegateStub);