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

Unified Diff: chrome/gpu/gpu_command_buffer_stub.cc

Issue 1136006: Calling OpenGL from the renderer process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months 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/gpu/gpu_command_buffer_stub.h ('k') | chrome/gpu/gpu_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/gpu/gpu_command_buffer_stub.cc
===================================================================
--- chrome/gpu/gpu_command_buffer_stub.cc (revision 42644)
+++ chrome/gpu/gpu_command_buffer_stub.cc (working copy)
@@ -6,6 +6,7 @@
#include "base/process_util.h"
#include "base/shared_memory.h"
+#include "build/build_config.h"
#include "chrome/common/gpu_messages.h"
#include "chrome/gpu/gpu_channel.h"
#include "chrome/gpu/gpu_command_buffer_stub.h"
@@ -13,12 +14,23 @@
using gpu::Buffer;
GpuCommandBufferStub::GpuCommandBufferStub(GpuChannel* channel,
+ gfx::NativeView view,
+ GpuCommandBufferStub* parent,
+ const gfx::Size& size,
+ uint32 parent_texture_id,
int32 route_id)
: channel_(channel),
+ view_(view),
+ parent_(parent),
+ initial_size_(size),
+ parent_texture_id_(parent_texture_id),
route_id_(route_id) {
}
GpuCommandBufferStub::~GpuCommandBufferStub() {
+ if (processor_.get()) {
+ processor_->Destroy();
+ }
}
void GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
@@ -34,6 +46,8 @@
OnDestroyTransferBuffer);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetTransferBuffer,
OnGetTransferBuffer);
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer,
+ OnResizeOffscreenFrameBuffer);
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
}
@@ -55,8 +69,18 @@
if (command_buffer_->Initialize(size)) {
Buffer buffer = command_buffer_->GetRingBuffer();
if (buffer.shared_memory) {
- processor_ = new gpu::GPUProcessor(command_buffer_.get());
- if (processor_->Initialize(gfx::kNullPluginWindow)) {
+ gpu::GPUProcessor* parent_processor =
+ parent_ ? parent_->processor_.get() : NULL;
+ processor_.reset(new gpu::GPUProcessor(command_buffer_.get()));
+ // TODO(apatrick): The reinterpret_cast below is only valid on windows.
+#if !defined(OS_WIN)
+ DCHECK_EQ(view_, static_cast<gfx::NativeView>(0));
+#endif
+ if (processor_->Initialize(
+ reinterpret_cast<gfx::PluginWindowHandle>(view_),
+ parent_processor,
+ initial_size_,
+ parent_texture_id_)) {
command_buffer_->SetPutOffsetChangeCallback(
NewCallback(processor_.get(),
&gpu::GPUProcessor::ProcessCommands));
@@ -66,7 +90,7 @@
buffer.shared_memory->ShareToProcess(channel_->renderer_handle(),
ring_buffer);
} else {
- processor_ = NULL;
+ processor_.reset();
command_buffer_.reset();
}
}
@@ -117,4 +141,8 @@
}
}
+void GpuCommandBufferStub::OnResizeOffscreenFrameBuffer(const gfx::Size& size) {
+ processor_->ResizeOffscreenFrameBuffer(size);
+}
+
#endif // ENABLE_GPU
« no previous file with comments | « chrome/gpu/gpu_command_buffer_stub.h ('k') | chrome/gpu/gpu_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698