Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4348)

Unified Diff: chrome/plugin/command_buffer_stub.cc

Issue 367002: Added Pepper 3D render context that instantiates the GPU plugin.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/plugin/command_buffer_stub.h ('k') | chrome/plugin/plugin_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/command_buffer_stub.cc
===================================================================
--- chrome/plugin/command_buffer_stub.cc (revision 35153)
+++ chrome/plugin/command_buffer_stub.cc (working copy)
@@ -8,6 +8,8 @@
#include "chrome/plugin/command_buffer_stub.h"
#include "chrome/plugin/plugin_channel.h"
+using gpu::Buffer;
+
CommandBufferStub::CommandBufferStub(PluginChannel* channel,
gfx::NativeView view)
: channel_(channel),
@@ -42,23 +44,25 @@
// Assume service is responsible for duplicating the handle from the calling
// process.
base::ProcessHandle peer_handle;
- if (base::OpenProcessHandle(channel_->peer_pid(), &peer_handle))
+ if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle))
return;
command_buffer_.reset(new gpu::CommandBufferService);
// Initialize the CommandBufferService and GPUProcessor.
- base::SharedMemory* shared_memory = command_buffer_->Initialize(size);
- if (shared_memory) {
- processor_ = new gpu::GPUProcessor(command_buffer_.get());
- if (processor_->Initialize(view_)) {
- command_buffer_->SetPutOffsetChangeCallback(
- NewCallback(processor_.get(),
- &gpu::GPUProcessor::ProcessCommands));
- shared_memory->ShareToProcess(peer_handle, ring_buffer);
- } else {
- processor_ = NULL;
- command_buffer_.reset();
+ if (command_buffer_->Initialize(size)) {
+ Buffer buffer = command_buffer_->GetRingBuffer();
+ if (buffer.shared_memory) {
+ processor_ = new gpu::GPUProcessor(command_buffer_.get());
+ if (processor_->Initialize(view_)) {
+ command_buffer_->SetPutOffsetChangeCallback(
+ NewCallback(processor_.get(),
+ &gpu::GPUProcessor::ProcessCommands));
+ buffer.shared_memory->ShareToProcess(peer_handle, ring_buffer);
+ } else {
+ processor_ = NULL;
+ command_buffer_.reset();
+ }
}
}
@@ -85,19 +89,23 @@
command_buffer_->DestroyTransferBuffer(id);
}
-void CommandBufferStub::OnGetTransferBuffer(int32 id,
- base::SharedMemoryHandle* transfer_buffer) {
+void CommandBufferStub::OnGetTransferBuffer(
+ int32 id,
+ base::SharedMemoryHandle* transfer_buffer,
+ size_t* size) {
*transfer_buffer = 0;
+ *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))
+ if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle))
return;
- base::SharedMemory* shared_memory = command_buffer_->GetTransferBuffer(id);
- if (shared_memory) {
- shared_memory->ShareToProcess(peer_handle, transfer_buffer);
+ Buffer buffer = command_buffer_->GetTransferBuffer(id);
+ if (buffer.shared_memory) {
+ buffer.shared_memory->ShareToProcess(peer_handle, transfer_buffer);
+ *size = buffer.shared_memory->max_size();
}
base::CloseProcessHandle(peer_handle);
« no previous file with comments | « chrome/plugin/command_buffer_stub.h ('k') | chrome/plugin/plugin_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698