summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-28 23:36:54 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-28 23:36:54 +0000
commit36dbfe198cb0eab50ff4a7300fc86b8314d30cde (patch)
treec7b2271be2e885ca87ac58d53e338cca322276a4 /chrome/plugin
parent406e6e22b82ef80e8bc44f45d85efa68799bc552 (diff)
downloadchromium_src-36dbfe198cb0eab50ff4a7300fc86b8314d30cde.zip
chromium_src-36dbfe198cb0eab50ff4a7300fc86b8314d30cde.tar.gz
chromium_src-36dbfe198cb0eab50ff4a7300fc86b8314d30cde.tar.bz2
Moved creation of GPU command buffer shared memory into the browser process.
This is to allow the GPU process to be sandboxed on all platforms. TEST=try, run WebGL app on win and mac. BUG=none Review URL: http://codereview.chromium.org/6588029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/command_buffer_stub.cc70
-rw-r--r--chrome/plugin/command_buffer_stub.h4
2 files changed, 12 insertions, 62 deletions
diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc
index 2ef657a..9aea1ee 100644
--- a/chrome/plugin/command_buffer_stub.cc
+++ b/chrome/plugin/command_buffer_stub.cc
@@ -2,12 +2,13 @@
// 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/command_buffer_stub.h"
#include "chrome/plugin/plugin_channel.h"
using gpu::Buffer;
@@ -67,66 +68,13 @@ void CommandBufferStub::NotifyRepaint() {
Send(new GpuCommandBufferMsg_NotifyRepaint(route_id_));
}
-void CommandBufferStub::OnInitialize(int32 size,
- base::SharedMemoryHandle* ring_buffer) {
- DCHECK(!command_buffer_.get());
-
- *ring_buffer = base::SharedMemory::NULLHandle();
-
- // Assume service is responsible for duplicating the handle from the calling
- // process.
- base::ScopedOpenProcess peer_process;
- if (!peer_process.Open(channel_->peer_pid()))
- return;
-
- command_buffer_.reset(new gpu::CommandBufferService);
-
- // Initialize the CommandBufferService.
- if (!command_buffer_->Initialize(size)) {
- Destroy();
- return;
- }
-
- // Get the ring buffer.
- Buffer buffer = command_buffer_->GetRingBuffer();
- if (!buffer.shared_memory) {
- Destroy();
- return;
- }
-
- // Initialize the GPUProcessor.
- processor_.reset(new gpu::GPUProcessor(command_buffer_.get(), NULL));
- if (!processor_->Initialize(window_, gfx::Size(), NULL, std::vector<int32>(),
- NULL, 0)) {
- Destroy();
- return;
- }
-
- // Perform platform specific initialization.
- if (!InitializePlatformSpecific()) {
- Destroy();
- return;
- }
-
- // Share the ring buffer to the client process.
- if (!buffer.shared_memory->ShareToProcess(peer_process.handle(),
- ring_buffer)) {
- Destroy();
- return;
- }
-
- // Setup callbacks for events.
- command_buffer_->SetPutOffsetChangeCallback(
- NewCallback(processor_.get(),
- &gpu::GPUProcessor::ProcessCommands));
-#if defined(OS_MACOSX)
- processor_->SetSwapBuffersCallback(
- NewCallback(this,
- &CommandBufferStub::SwapBuffersCallback));
- processor_->SetTransportDIBAllocAndFree(
- NewCallback(this, &CommandBufferStub::AllocTransportDIB),
- NewCallback(this, &CommandBufferStub::FreeTransportDIB));
-#endif
+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) {
diff --git a/chrome/plugin/command_buffer_stub.h b/chrome/plugin/command_buffer_stub.h
index 96974ab..a2667f1 100644
--- a/chrome/plugin/command_buffer_stub.h
+++ b/chrome/plugin/command_buffer_stub.h
@@ -45,7 +45,9 @@ class CommandBufferStub : public IPC::Channel::Listener,
private:
// Message handlers:
- void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer);
+ 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);