summaryrefslogtreecommitdiffstats
path: root/chrome/common/gpu_plugin.cc
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 23:28:15 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 23:28:15 +0000
commit7477ea6f6a173b586622fd276433a346760ffbf4 (patch)
tree678229a49ae5c4bb1a54a61374466cdddf57db59 /chrome/common/gpu_plugin.cc
parente4f7cec0a45a803faf00875a070090b165ff1fc5 (diff)
downloadchromium_src-7477ea6f6a173b586622fd276433a346760ffbf4.zip
chromium_src-7477ea6f6a173b586622fd276433a346760ffbf4.tar.gz
chromium_src-7477ea6f6a173b586622fd276433a346760ffbf4.tar.bz2
Added Pepper 3D device that instantiates the GPU plugin and sends GLES2 commands to it via a command buffer.
Added API for managing buffers to Pepper 3D device. Removed DCHECK from WebPluginImpl::SetWindow that checks against a windowless plugin being given a window handle. Please check this! Now an initially windowless plugin instance gets a handle when it requests a Pepper 3D context. Perhaps the window handle should be concealed from the underlying plugin isntance. Removed enable_gpu gyp variable and C macro. GPU code is always built on windows but not mac or linux. It is enabled at runtime with the --enable-gpu-plugin switch. Redesigned CommandBuffer interface so it exposes shared memory through a Buffer. This was necessary because Pepper has no notion of shared memory handles. The Buffer exposes the shared memory as both a handle (through base::SharedMemory) and the mapped address and size. Refactored CommandBufferEngine so mapped shared memory addresses and sizes are returned with a single call rather than two separate calls. Added 3D demo to pepper test plugin. TEST=try servers BUG=none Review URL: http://codereview.chromium.org/367002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35185 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gpu_plugin.cc')
-rw-r--r--chrome/common/gpu_plugin.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/common/gpu_plugin.cc b/chrome/common/gpu_plugin.cc
new file mode 100644
index 0000000..fc79cbb
--- /dev/null
+++ b/chrome/common/gpu_plugin.cc
@@ -0,0 +1,43 @@
+// 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 "base/command_line.h"
+#include "base/string_util.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/gpu_plugin.h"
+#include "gpu/gpu_plugin/gpu_plugin.h"
+#include "webkit/glue/plugins/plugin_list.h"
+
+#if defined(ENABLE_GPU)
+#include "webkit/glue/plugins/plugin_constants_win.h"
+#endif
+
+namespace chrome {
+
+void RegisterInternalGPUPlugin() {
+#if defined(ENABLE_GPU)
+ static const std::wstring kWideMimeType = ASCIIToWide(kGPUPluginMimeType);
+ static const NPAPI::PluginVersionInfo kGPUPluginInfo = {
+ FilePath(FILE_PATH_LITERAL("gpu-plugin")),
+ L"GPU Plug-in",
+ L"GPU Rendering Plug-in",
+ L"1",
+ kWideMimeType.c_str(),
+ L"",
+ L"",
+ {
+#if !defined(OS_LINUX)
+ gpu_plugin::NP_GetEntryPoints,
+#endif
+ gpu_plugin::NP_Initialize,
+ gpu_plugin::NP_Shutdown
+ }
+ };
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableGPUPlugin))
+ NPAPI::PluginList::Singleton()->RegisterInternalPlugin(kGPUPluginInfo);
+#endif // ENABLE_GPU
+}
+
+} // namespace chrome